From 6334ff853f5805b7a9584f3c954e658d3daa0add Mon Sep 17 00:00:00 2001 From: rmatsuda Date: Tue, 10 Dec 2024 13:09:07 +0200 Subject: [PATCH 1/2] FIX: robot warnings and ADD robot and NDI IPs --- invesalius/constants.py | 5 ++--- invesalius/data/viewer_volume.py | 2 +- invesalius/gui/dialogs.py | 2 +- invesalius/gui/preferences.py | 2 +- invesalius/gui/task_navigator.py | 2 ++ 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 45694d9ba..30e84f4e7 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -828,7 +828,7 @@ DEFAULT_TRACKER = SELECT NDICOMPORT = b"COM1" -NDI_IP = ["P9-13715.local", "P9-13719.local"] +NDI_IP = ["P9-13715.local", "P9-13719.local", "P9-25026.local"] TRACKERS = [ _("Claron MicronTracker"), @@ -1126,8 +1126,7 @@ PULSE_DURATION_IN_MILLISECONDS = 0.2 # Robot -ROBOT_ElFIN_IP = ["192.168.200.251", "143.107.220.251", "169.254.153.251", "127.0.0.1"] -ROBOT_DOBOT_IP = ["192.168.1.6"] +ROBOT_IPS = ["192.168.200.251", "143.107.220.251", "169.254.153.251", "127.0.0.1", "192.168.1.6", "169.254.128.103"] MTMS_RADIUS = 15 diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index df1ff14c6..b70b503aa 100644 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -1038,7 +1038,7 @@ def DisableTargetMode(self): if self.distance_text is not None: self.ren.RemoveActor(self.distance_text.actor) - # Remove the actor for 'distance' text. + # Remove the actor for 'robot warnings' text. if self.robot_warnings_text is not None: self.ren.RemoveActor(self.robot_warnings_text.actor) diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index 113650f79..0a73588a5 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -6510,7 +6510,7 @@ def __init__(self, title: str = _("Set Robot IP")): def _init_gui(self) -> None: # ComboBox for spatial tracker device selection tooltip = _("Choose or type the robot IP") - robot_ip_options = [_("Select robot IP:")] + const.ROBOT_ElFIN_IP + robot_ip_options = [_("Select robot IP:")] + const.ROBOT_IPS choice_IP = wx.ComboBox( self, -1, "", choices=robot_ip_options, style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER ) diff --git a/invesalius/gui/preferences.py b/invesalius/gui/preferences.py index 37ba95cb5..34b97f081 100644 --- a/invesalius/gui/preferences.py +++ b/invesalius/gui/preferences.py @@ -1579,7 +1579,7 @@ def __init__(self, parent, tracker, robot): # ComboBox for spatial tracker device selection tooltip = _("Choose or type the robot IP") - robot_ip_options = [_("Select robot IP:")] + const.ROBOT_ElFIN_IP + const.ROBOT_DOBOT_IP + robot_ip_options = [_("Select robot IP:")] + const.ROBOT_IPS choice_IP = wx.ComboBox( self, -1, "", choices=robot_ip_options, style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER ) diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index 7433ce873..cd516779e 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -1905,6 +1905,7 @@ def OnRobotTrackTargetButton(self, evt=None, ctrl=None): # objective set by another button; hence this check. if self.robot.objective == RobotObjective.TRACK_TARGET: self.robot.SetObjective(RobotObjective.NONE) + Publisher.sendMessage("Robot to Neuronavigation: Update robot warning", robot_warning="") # 'Move away' button def EnableRobotMoveAwayButton(self, enabled=False): @@ -1925,6 +1926,7 @@ def OnRobotMoveAwayButton(self, evt=None, ctrl=None): # objective set by another button; hence this check. if self.robot.objective == RobotObjective.MOVE_AWAY_FROM_HEAD: self.robot.SetObjective(RobotObjective.NONE) + Publisher.sendMessage("Robot to Neuronavigation: Update robot warning", robot_warning="") # 'Free drive' button def EnableRobotFreeDriveButton(self, enabled=False): From 888ccc6a42014695aa829bb80821133a722f6847 Mon Sep 17 00:00:00 2001 From: rmatsuda Date: Tue, 10 Dec 2024 13:11:01 +0200 Subject: [PATCH 2/2] RUFF --- invesalius/constants.py | 11 +++++++++-- invesalius/gui/task_navigator.py | 8 ++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 30e84f4e7..c9c1c8d48 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -828,7 +828,7 @@ DEFAULT_TRACKER = SELECT NDICOMPORT = b"COM1" -NDI_IP = ["P9-13715.local", "P9-13719.local", "P9-25026.local"] +NDI_IP = ["P9-13715.local", "P9-13719.local", "P9-25026.local"] TRACKERS = [ _("Claron MicronTracker"), @@ -1126,7 +1126,14 @@ PULSE_DURATION_IN_MILLISECONDS = 0.2 # Robot -ROBOT_IPS = ["192.168.200.251", "143.107.220.251", "169.254.153.251", "127.0.0.1", "192.168.1.6", "169.254.128.103"] +ROBOT_IPS = [ + "192.168.200.251", + "143.107.220.251", + "169.254.153.251", + "127.0.0.1", + "192.168.1.6", + "169.254.128.103", +] MTMS_RADIUS = 15 diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index cd516779e..11df7b939 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -1905,7 +1905,9 @@ def OnRobotTrackTargetButton(self, evt=None, ctrl=None): # objective set by another button; hence this check. if self.robot.objective == RobotObjective.TRACK_TARGET: self.robot.SetObjective(RobotObjective.NONE) - Publisher.sendMessage("Robot to Neuronavigation: Update robot warning", robot_warning="") + Publisher.sendMessage( + "Robot to Neuronavigation: Update robot warning", robot_warning="" + ) # 'Move away' button def EnableRobotMoveAwayButton(self, enabled=False): @@ -1926,7 +1928,9 @@ def OnRobotMoveAwayButton(self, evt=None, ctrl=None): # objective set by another button; hence this check. if self.robot.objective == RobotObjective.MOVE_AWAY_FROM_HEAD: self.robot.SetObjective(RobotObjective.NONE) - Publisher.sendMessage("Robot to Neuronavigation: Update robot warning", robot_warning="") + Publisher.sendMessage( + "Robot to Neuronavigation: Update robot warning", robot_warning="" + ) # 'Free drive' button def EnableRobotFreeDriveButton(self, enabled=False):