Skip to content

Updated rqt_controller_manager controller state color scheme to match list_controllers color scheme #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 29, 2025
Merged
Binary file modified controller_manager/doc/images/rqt_controller_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rqt_controller_manager/resource/led_cyan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rqt_controller_manager/resource/led_red.png
Binary file not shown.
Binary file added rqt_controller_manager/resource/led_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions rqt_controller_manager/rqt_controller_manager/controller_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def __init__(self, context):
path = get_package_share_directory("rqt_controller_manager")
self._icons = {
"active": QIcon(f"{path}/resource/led_green.png"),
"finalized": QIcon(f"{path}/resource/led_off.png"),
"inactive": QIcon(f"{path}/resource/led_red.png"),
"unconfigured": QIcon(f"{path}/resource/led_off.png"),
"inactive": QIcon(f"{path}/resource/led_cyan.png"),
"unconfigured": QIcon(f"{path}/resource/led_yellow.png"),
"unloaded": QIcon(f"{path}/resource/led_off.png"),
}

# Controllers display
Expand Down Expand Up @@ -229,10 +229,10 @@ def _on_ctrl_menu(self, pos):
menu = QMenu(self._widget.ctrl_table_view)
if ctrl.state == "active":
action_deactivate = menu.addAction(self._icons["inactive"], "Deactivate")
action_kill = menu.addAction(self._icons["finalized"], "Deactivate and Unload")
action_kill = menu.addAction(self._icons["unloaded"], "Deactivate and Unload")
elif ctrl.state == "inactive":
action_activate = menu.addAction(self._icons["active"], "Activate")
action_unload = menu.addAction(self._icons["unconfigured"], "Unload")
action_cleanup = menu.addAction(self._icons["unconfigured"], "Cleanup")
elif ctrl.state == "unconfigured":
action_configure = menu.addAction(self._icons["inactive"], "Configure")
action_spawn = menu.addAction(self._icons["active"], "Configure and Activate")
Expand All @@ -251,11 +251,13 @@ def _on_ctrl_menu(self, pos):
elif action is action_kill:
self._deactivate_controller(ctrl.name)
unload_controller(self._node, self._cm_name, ctrl.name)
elif ctrl.state in ("finalized", "inactive"):
elif ctrl.state == "inactive":
if action is action_activate:
self._activate_controller(ctrl.name)
elif action is action_unload:
elif action is action_cleanup:
# TODO: use cleanup service once available
unload_controller(self._node, self._cm_name, ctrl.name)
load_controller(self._node, self._cm_name, ctrl.name)
elif ctrl.state == "unconfigured":
if action is action_configure:
configure_controller(self._node, self._cm_name, ctrl.name)
Expand Down Expand Up @@ -358,7 +360,7 @@ def _on_hw_menu(self, pos):
menu = QMenu(self._widget.hw_table_view)
if hw_component.state.label == "active":
action_deactivate = menu.addAction(self._icons["inactive"], "Deactivate")
action_cleanup = menu.addAction(self._icons["finalized"], "Deactivate and Cleanup")
action_cleanup = menu.addAction(self._icons["unconfigured"], "Deactivate and Cleanup")
elif hw_component.state.label == "inactive":
action_activate = menu.addAction(self._icons["active"], "Activate")
action_cleanup = menu.addAction(self._icons["unconfigured"], "Cleanup")
Expand Down Expand Up @@ -514,10 +516,11 @@ def data(self, index, role):
if index.column() == 0:
return ctrl.name
elif index.column() == 1:
return ctrl.state or "not loaded"
return ctrl.state or "unloaded"

if role == Qt.DecorationRole and index.column() == 0:
return self._icons.get(ctrl.state)
state_key = ctrl.state if ctrl.state else "unloaded"
return self._icons.get(state_key)

if role == Qt.FontRole and index.column() == 0:
bf = QFont()
Expand Down Expand Up @@ -565,7 +568,7 @@ def data(self, index, role):
if index.column() == 0:
return hw_component.name
elif index.column() == 1:
return hw_component.state.label or "not loaded"
return hw_component.state.label or "unloaded"

if role == Qt.DecorationRole and index.column() == 0:
return self._icons.get(hw_component.state.label)
Expand Down