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:
Pim Hutting
2025-11-09 15:43:22 +01:00
parent c037eb7ec2
commit 4402b21a73
8 changed files with 74 additions and 21 deletions

View File

@@ -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: