diff --git a/main_loop.py b/main_loop.py index 4931e1d..5c33d8b 100644 --- a/main_loop.py +++ b/main_loop.py @@ -282,16 +282,15 @@ def main(connection=None): for i in range(len(buf)): if topic[i] in const.PUB_MESSAGES: msg_data = buf[i]["data"] - - msg_robot_id = 0 + if isinstance(msg_data, dict): msg_robot_id = msg_data.get("robot_id", 0) - if msg_robot_id is None: - msg_robot_id = 0 - else: - msg_robot_id = int(msg_robot_id) - - if msg_robot_id != robot_id: + if msg_robot_id != robot_id: + if topic[i] in const.PUB_MESSAGES_WL and msg_robot_id == -1: + pass + else: + continue + else: continue get_function = { diff --git a/robot/constants.py b/robot/constants.py index fd7d99e..c74ab65 100644 --- a/robot/constants.py +++ b/robot/constants.py @@ -140,6 +140,12 @@ }, } +# Publisher messages from invesalius to any robot +# It's important these message to be in the PUB_MESSAGES list too +PUB_MESSAGES_WL = [ + "From Neuronavigation: Update tracker poses", +] + # Publisher messages from invesalius PUB_MESSAGES = [ "Neuronavigation to Robot: Connect to robot",