Skip to content

Commit

Permalink
catch RuntimeErrors when the service is no longer available
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Jan 6, 2024
1 parent 1f983b4 commit e7ed02d
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions rqt_controller_manager/rqt_controller_manager/controller_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,22 @@ def _list_controllers(self):
@rtype [str]
"""
# Add loaded controllers first
controllers = list_controllers(self._node, self._cm_name).controller

# Append potential controller configs found in the node's parameters
for name in _get_parameter_controller_names(self._node, self._cm_name):
add_ctrl = all(name != ctrl.name for ctrl in controllers)
if add_ctrl:
type_str = _get_controller_type(self._node, self._cm_name, name)
uninit_ctrl = ControllerState(name=name, type=type_str)
controllers.append(uninit_ctrl)
return controllers
try:
controllers = list_controllers(
self._node, self._cm_name, 2.0 / self._cm_update_freq
).controller

# Append potential controller configs found in the node's parameters
for name in _get_parameter_controller_names(self._node, self._cm_name):
add_ctrl = all(name != ctrl.name for ctrl in controllers)
if add_ctrl:
type_str = _get_controller_type(self._node, self._cm_name, name)
uninit_ctrl = ControllerState(name=name, type=type_str)
controllers.append(uninit_ctrl)
return controllers
except RuntimeError as e:
print(e)
return []

def _show_controllers(self):
table_view = self._widget.table_view
Expand Down

0 comments on commit e7ed02d

Please sign in to comment.