1818
1919from ament_index_python .packages import get_package_share_directory
2020from controller_manager .controller_manager_services import (
21+ cleanup_controller ,
2122 configure_controller ,
2223 list_controllers ,
2324 list_hardware_components ,
@@ -234,9 +235,7 @@ def _on_ctrl_menu(self, pos):
234235 )
235236 elif ctrl .state == "inactive" :
236237 action_activate = menu .addAction (self ._icons ["active" ], "Activate (active)" )
237- action_cleanup = menu .addAction (
238- self ._icons ["unconfigured" ], "Unload and Load (unconfigured)"
239- )
238+ action_cleanup = menu .addAction (self ._icons ["unconfigured" ], "Cleanup (unconfigured)" )
240239 action_unload = menu .addAction (self ._icons ["unloaded" ], "Unload (unloaded)" )
241240 elif ctrl .state == "unconfigured" :
242241 action_spawn = menu .addAction (self ._icons ["active" ], "Configure and Activate (active)" )
@@ -259,10 +258,7 @@ def _on_ctrl_menu(self, pos):
259258 if action is action_activate :
260259 self ._activate_controller (ctrl .name )
261260 elif action is action_cleanup :
262- # TODO: use cleanup service once available
263- # https://github.com/ros-controls/ros2_control/issues/759
264- unload_controller (self ._node , self ._cm_name , ctrl .name )
265- load_controller (self ._node , self ._cm_name , ctrl .name )
261+ cleanup_controller (self ._node , self ._cm_name , ctrl .name )
266262 elif action is action_unload :
267263 unload_controller (self ._node , self ._cm_name , ctrl .name )
268264 elif ctrl .state == "unconfigured" :
0 commit comments