Skip to content

Deactivate controllers when hardware component is inactive #1811

Open
@KmakD

Description

@KmakD

Describe the bug

Following this #1666 (comment). After ros-controls/ros2_control#2334 the controller should be deactivated if the hardware component it depends on becomes inactive. There are few issues with current implementation:

  1. The controller is only deactivated if the hardware component returns return_type::DEACTIVATE in write method. If deactivating using CLI the the controller stays active.
  2. This probably depends on above, but It is possible to activate the controller even if the hardware component is still in INACTIVE state.
  3. Only the controller that has claimed hardware interfaces is being deactivated. Other controllers that are chained are still active. All preeceding controllers should be also deactivated. If you try to deactivate the controller that is chained using CLI it will throw the following error:
[WARN] [1751882846.567267619] [controller_manager]: Unable to deactivate controller with name 'drive_controller' because preceding controller with name 'velocity_input_controller' is currently active and will not be deactivated.
[WARN] [1751882846.567294092] [controller_manager]: Could not deactivate controller with name 'drive_controller'. Check above warnings for more details. Check the state of the controllers and their required interfaces using `ros2 control list_controllers -v` CLI to get more information.
[ERROR] [1751882846.567311243] [controller_manager]: Aborting, no controller is switched! (::STRICT switch)
  1. Right now to resolve the inactive state you have to activate the hardware component and then activate the controller. It would be nice if this could be automated. The implementation details are open for discussion, here are a few possible approaches:
    • Allow to define a "system group" that defines all dependent hardware components and controllers. Then you could call activate on a group and manager would attempt to activate all hardware components and controllers.
    • When calling activate on the controller also try to activate hardware component it depends on.
    • Allow auto reactivation of controller if hardware becomes active again.

Tested on ROS 2 Jazzy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions