ros-controls / ros2_control

Generic and simple controls framework for ROS 2
https://control.ros.org
Apache License 2.0
516 stars 306 forks source link

hardware_components_initial_state failed #1780

Closed Elfits closed 1 month ago

Elfits commented 1 month ago

Describe the bug I set as follows: control_node = Node( package="controller_manager", executable="ros2_control_node", parameters=[ robot_description, robot_controllers, { "hardware_components_initial_state": { "unconfigured": ["ABBMultiInterfaceHardware"] }, }, ], output="both", ) But the resource manager will automatically load, configure, and activate the hardware.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I need to hardware to be with the "unconfigured" state on start.

Screenshots What I got from the parameter: ros2 param get /controller_manager hardware_components_initial_state.unconfigured String values are: ['ABBMultiInterfaceHardware']

What I got after running the launch file: ... [ros2_control_node-1] [INFO] [1728398685.136254874] [ABBSystemHardware]: Configuring EGM interface... [ros2_control_node-1] [INFO] [1728398685.136370002] [ABBSystemHardware]: Configuring EGM for mechanical unit group on port 6511 [ros2_control_node-1] [INFO] [1728398685.142212872] [resource_manager]: Successful initialization of hardware 'ABBMultiInterfaceHardware' [ros2_control_node-1] [INFO] [1728398685.142404326] [resource_manager]: 'configure' hardware 'ABBMultiInterfaceHardware'

[ros2_control_node-1] [INFO] [1728398685.142419922] [resource_manager]: 'activate' hardware 'ABBMultiInterfaceHardware' [ros2_control_node-1] [INFO] [1728398685.142423570] [ABBSystemHardware]: Connecting to robot... [ros2_control_node-1] joint_1 [ros2_control_node-1] joint_2 [ros2_control_node-1] joint_3 [ros2_control_node-1] joint_4 [ros2_control_node-1] joint_5 [ros2_control_node-1] joint_6 [ros2_control_node-1] [INFO] [1728398685.164096534] [ABBSystemHardware]: Connected to robot [ros2_control_node-1] [INFO] [1728398685.164136500] [ABBSystemHardware]: ros2_control hardware interface was successfully started!

[ros2_control_node-1] [INFO] [1728398685.170917482] [controller_manager]: update rate is 250 Hz

Environment (please complete the following information):

Additional context I tried ABB and KUKA robots with different drivers, but same problem.

saikishor commented 1 month ago

Hello @Elfits!

Can you introspect the code around the following code to see if the parameters are reading correctly or not

https://github.com/ros-controls/ros2_control/blob/b00988134ddfe2e3fbd8178124fd41981b84ae41/controller_manager/src/controller_manager.cpp#L379-L403

Elfits commented 1 month ago

Hello @saikishor , Thanks for your quick reply! In order to test as you suggested, I cloned the Humble branch of ros2_control and added it to my workspace. I was surprised to find that when I compiled it myself, the functionality was correct. The hardware can be set to "configured" at the start. But when I was using ros2_control from direct installation, it failed. This workaround solved my problem. But I hope it is helpful for updating ros2_control.

saikishor commented 1 month ago

Hello @saikishor , Thanks for your quick reply! In order to test as you suggested, I cloned the Humble branch of ros2_control and added it to my workspace. I was surprised to find that when I compiled it myself, the functionality was correct. The hardware can be set to "configured" at the start. But when I was using ros2_control from direct installation, it failed. This workaround solved my problem. But I hope it is helpful for updating ros2_control.

Hello @Elfits!

This doesn't make sense. The binary should behave exactly the same as the source build one. Can you use the same tag as your installed binaries and recheck if it is working or not?

Thank you!

Elfits commented 1 month ago

Hello @saikishor , I was also supervised to find it. I am now testing with my laptop at home. I only added the source code into the workspace and recompiled the whole workspace from scratch. Then I ran the launch file and got what I needed. Before adding the source code, it failed. Tomorrow I will test this way in the lab, on a different computer.

Btw, I do not know how to use tags to recheck. And today when I was in the lab, I upgraded ros2_control to the latest version 2.43.1 using sudo apt install --only-upgrade, but it did not help. Both the old and newer version cannot set hardware as I needed. I have no idea.

saikishor commented 1 month ago

Hello @Elfits !

You can check the installed binary version using dpkg -l | grep controller-manager. Once you have the version there, you checkout that respective tag in ros2_control cloned repo

Elfits commented 1 month ago

Hi @saikishor I believe I found the season. Because the cm is a older version. I did upgrate ros2_control to 2.43.1. I do not know why...

$ dpkg -l | grep controller-manager ii ros-humble-controller-manager 2.36.0-1jammy.20231212.180309 amd64 Description of controller_manager ii ros-humble-controller-manager-msgs 2.36.0-1jammy.20231212.173340 amd64 Messages and services for the controller manager. ii ros-humble-moveit-simple-controller-manager 2.5.5-1jammy.20240126.010304 amd64 A generic, simple controller manager plugin for MoveIt. ii ros-humble-rqt-controller-manager 2.42.0-1jammy.20240728.233835 amd64 Graphical frontend for interacting with the controller manager.

But:

$ ros2 pkg xml ros2_control | grep ""

2.43.1
saikishor commented 1 month ago

Hi @saikishor I believe I found the season. Because the cm is a older version. I did upgrate ros2_control to 2.43.1. I do not know why...

I believe that it could be that there are added dependencies etc. I'm not sure though.

i suggest you to upgrade all the packages from the ros2_control

The following might help

sudo apt install -y ros-humble-ros2controlcli transmission_interface ros-humble-ros2-control* ros-humble-hardware* ros-humble-controller*
Elfits commented 1 month ago

Hi all, After upgrading all the dependencies, it has been solved. Thanks for your time on my stupid question... This can be closed since it is not a bug.