Skip to content

Controller switch fails when using ALL interface configuration type for the controller being deactivated #2846

@wieset

Description

@wieset

Describe the bug
Since recent updates of ros2_control, our controller switches fail consistently as follows, although the controller being deactivated should release the interfaces to be claimed by the one being activated:

[gazebo-11] [WARN] [controller_manager]: Unable to activate controller 'joint_trajectory_controller' since the command interface 'LF_HAA/position' is currently claimed by another controller.
[controller_switch_manager-5] [WARN] [controller_switch_manager]: [_safely_switch_controllers_callback]: Switching controllers failed: Failed to switch controllers to ['joint_trajectory_controller']

It fails when we try to switch from a controller that uses controller_interface::interface_configuration_type::ALL as command interface configuration type to one which has explicitly set command interfaces.

The bug seems to be related to this PR and the early check for command interface conflicts: #2760

There, the future_available_command_interfaces are based on the names in the command interface configuration, although these are empty in case of the ALL interface configuration type, and therefore the switch fails:

controller_it->c->command_interface_configuration().names;

To Reproduce

  1. Create a controller with controller_interface::interface_configuration_type::ALL as type of the command interface configuration (and empty names)
  2. Try to switch to another controller that has explicit command interfaces set

Expected behavior
Successfully switch controllers

Environment (please complete the following information):
Ubuntu 24.04
ROS 2 Jazzy

Additional context
This reliance on command_interface_configuration().names is present in other places of the codebase as well, which will probably also cause problems when using controllers with the ALL interface configuration type.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions