From 7ae48c04785cce52433f067f4ca63b43f90687f4 Mon Sep 17 00:00:00 2001 From: Marcio Campos <82606834+MarcioCamposJr@users.noreply.github.com> Date: Tue, 11 Aug 2026 11:52:39 -0300 Subject: [PATCH 1/2] ADD: New whitelist messages from navigation messages to accept send to any robot --- main_loop.py | 14 +++++--------- robot/constants.py | 6 ++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/main_loop.py b/main_loop.py index 4931e1d..6fa7bc4 100644 --- a/main_loop.py +++ b/main_loop.py @@ -282,16 +282,12 @@ 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: + msg_robot_id = msg_data.get("robot_id", -1) + if msg_robot_id != robot_id or topic[i] not in const.PUB_MESSAGES_WL: + 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", From f65b3453dca499b82bf06edcf094a448af368db6 Mon Sep 17 00:00:00 2001 From: Marcio Campos <82606834+MarcioCamposJr@users.noreply.github.com> Date: Tue, 11 Aug 2026 12:00:03 -0300 Subject: [PATCH 2/2] MOD: Change the filter to recive whitelist message from navigation --- main_loop.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main_loop.py b/main_loop.py index 6fa7bc4..5c33d8b 100644 --- a/main_loop.py +++ b/main_loop.py @@ -284,9 +284,12 @@ def main(connection=None): msg_data = buf[i]["data"] if isinstance(msg_data, dict): - msg_robot_id = msg_data.get("robot_id", -1) - if msg_robot_id != robot_id or topic[i] not in const.PUB_MESSAGES_WL: - continue + msg_robot_id = msg_data.get("robot_id", 0) + if msg_robot_id != robot_id: + if topic[i] in const.PUB_MESSAGES_WL and msg_robot_id == -1: + pass + else: + continue else: continue