refactor: added config file and moved constants
- Moved hardcoded configuration constants to a dedicated config.py file. - Created VideoConfig, AudioConfig, MainConfig, and Settings classes in config.py ref: N25B-236
This commit is contained in:
@@ -10,6 +10,7 @@ from robot_interface.endpoints.actuation_receiver import ActuationReceiver
|
||||
from robot_interface.endpoints.main_receiver import MainReceiver
|
||||
from robot_interface.endpoints.video_sender import VideoSender
|
||||
from robot_interface.state import state
|
||||
from robot_interface.core.config import settings
|
||||
from robot_interface.utils.timeblock import TimeBlock
|
||||
|
||||
|
||||
@@ -45,7 +46,7 @@ def main_loop(context):
|
||||
|
||||
while True:
|
||||
if state.exit_event.is_set(): break
|
||||
socks = dict(poller.poll(100))
|
||||
socks = dict(poller.poll(settings.main_config.poll_timeout_ms))
|
||||
|
||||
for receiver in receivers:
|
||||
if receiver.socket not in socks: continue
|
||||
@@ -59,7 +60,7 @@ def main_loop(context):
|
||||
logging.warn("Endpoint \"%s\" took too long (%.2f ms) on the main thread.",
|
||||
message["endpoint"], time_ms)
|
||||
|
||||
with TimeBlock(overtime_callback, 50):
|
||||
with TimeBlock(overtime_callback, settings.main_config.max_handler_time_ms):
|
||||
response = receiver.handle_message(message)
|
||||
|
||||
if receiver.socket.getsockopt(zmq.TYPE) == zmq.REP:
|
||||
|
||||
Reference in New Issue
Block a user