MODIFICATION #1 src/robot/communication/directed_comm.py Instead of havind COMMUNICATION_IN_DIR as a string, it can be implemented as a Enum
class MqttTopic(Enum): COMMUNICATION_IN_DIR = "COMMUNICATION_IN_DIR"
def __init__(self, robot_id: int, mqtt_client: RobotMqttClient): super().__init__(robot_id, mqtt_client) self._topics_sub: dict[str, str] = {} self._subscribe(self.MqttTopic.COMMUNICATION_IN_DIR, f"comm/in/direct/{robot_id}") def _subscribe(self, key: MqttTopic, topic: str) -> None: self._topics_sub[key] = topic self.robot_mqtt_client.subscribe(topic) def handle_subscription(self, robot, m: MqttMsg) -> None: topic, msg = m.topic, m.message if topic ==self.topics_sub.get(self.MqttTopic.COMMUNICATION_IN_DIR.value): robot.communication_interrupt(msg) else: print(f"Received (unknown dir): {topic}> {msg}")
MODIFICATION #2 [src/robot/communication/simple_comm.py can implement the enum feature
Activity
Hasala-Kavinda commentedon Nov 13, 2025
MODIFICATION #1
src/robot/communication/directed_comm.py
Instead of havind COMMUNICATION_IN_DIR as a string, it can be implemented as a Enum
MODIFICATION #2
[src/robot/communication/simple_comm.py
can implement the enum feature