ros2_control icon indicating copy to clipboard operation
ros2_control copied to clipboard

Switch controllers services return always ok

Open halejo-as opened this issue 1 year ago • 5 comments

Describe the bug Calling the service /controller_manager/switch_controller return always true even if it could not switch the controllers.

To Reproduce Steps to reproduce the behavior:

  1. Launch any demo with a set of controllers loaded
  2. Switch for a non existing controller
ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{start_controllers: ["dummy_controller"]}"

Expected behavior The response expected should be ok = False but the ok is equals to true

response:
controller_manager_msgs.srv.SwitchController_Response(ok=True)

The controller manager node notify there is an error:

Resource conflict for controller 'dummy_controller'. Command interface 'XXXX' is already claimed.

Environment (please complete the following information):

  • Ubuntu 20.04
  • Foxy

Thanks for your help

halejo-as avatar Nov 24 '23 13:11 halejo-as

Foxy is End-Of-Life officially, there will be no more builds or releases for it. Could you please try reproducing the same on Humble/Iron/Rolling?

bmagyar avatar Nov 24 '23 16:11 bmagyar

Hello,

I tested in humble and appears the same problem:

  1. Launch the controllers, for example, ros2_control_demo_example_1 rrbot.launch.py
  2. Switch for a non existing controller

RESULT:

The controller manager notify the error

[controller_manager]: Could not 'activate' controller with name 'dummy_controller' because no controller with this name exists      
[controller_manager]: Empty activate and deactivate list, not requesting switch             

But the service response is Ok

response:
controller_manager_msgs.srv.SwitchController_Response(ok=True)

halejo-as avatar Jan 07 '24 13:01 halejo-as

same problem

gagapaga avatar Jan 26 '24 08:01 gagapaga

Hello!

Please try with the strictness set to STRICT when sending the service request. I think it should respond with false.

Thank you

saikishor avatar Jan 26 '24 09:01 saikishor

Hint: the problem with STRICT is, that it does return false also if the controller exists but is already in the desired state.

christophfroehlich avatar Jan 26 '24 17:01 christophfroehlich