ros-controls / ros2_control

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

hardware_components_initial_state failed #1780

Open Elfits opened 10 hours ago

Elfits commented 10 hours 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 9 hours 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 5 hours 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 5 hours 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 5 hours 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 4 hours 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