Ros2_control issues

Hi everybody,

i’m working on a 4 wheel autonomous robot simulation with ROS and Gazebo.
Currently it operates with the diff-drive plugin but i’m planning on switching to an ackerman steering approach. Therefore im trying to setup ros2_control, but i got quiet some problems with it:

My setup:
Ubuntu 20.04
Ros Foxy
Gazebo 11.11.0
installed ros2_control package via sudo apt install ros-foxy-gazebo-ros2-control
installed gazebo_ros2_control package via sudo apt install ros-foxy-gazebo-ros2-control

Inside my URDF File i configured ros2_control as follows:

  <!-- Position Config -->
  <ros2_control name="GazeboSystem" type="system">
      <!-- <plugin>test_system</plugin> -->
    <joint name="front_right_steer_joint">
      <command_interface name="position">
        <param name="min">-0.45</param>
        <param name="max">0.45</param>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>
    <joint name="front_left_steer_joint">
      <command_interface name="position">
        <param name="min">-0.45</param>
        <param name="max">0.45</param>
      <state_interface name="position"/>
      <state_interface name="velocity"/>
      <state_interface name="effort"/>

I also added the gazebo_ros2_control plugin to the URDF file:

    <plugin filename="" name="gazebo_ros2_control">
      <parameters>$(find tunnel_bot)/config/steering_controller_position.yaml</parameters>

And thats the used config file steering_controller_position.yaml:

    update_rate: 1  # Hz

      type: joint_trajectory_controller/JointTrajectoryController

      type: joint_state_broadcaster/JointStateBroadcaster

      - front_right_steer_joint
      - front_left_steer_joint
    interface_name: position
      - position
      - position
      - velocity

Now lets get into the issue:
When using the ros2_control hardware plugin gazebo_ros2_control/GazeboSystem im getting the following error:

[ros2_control_node-1] terminate called after throwing an instance of 'pluginlib::LibraryLoadException'
[ros2_control_node-1]   what():  According to the loaded plugin descriptions the class gazebo_ros2_control/GazeboSystem with base class type hardware_interface::SystemInterface does not exist. Declared types are  fake_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem test_system

what finally leads to:

[ERROR] [ros2_control_node-1]: process has died [pid 135528, exit code -6, cmd '/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_3n96b75a --params-file /home/ima-untow/dev_ws/install/tunnel_bot/share/tunnel_bot/config/steering_controller_position.yaml'].

but when i search for the gazebo_ros2_control package i find inside /opt/ros/foxy/share/gazebo_ros2_control/gazebo_hardware_plugins.xml this:

<library path="gazebo_hardware_plugins">

which in my eyes indicates that the plugin indeed is available.

If i use the test_system plugin istead:

  <ros2_control name="GazeboSystem" type="system">
      <!-- <plugin>gazebo_ros2_control/GazeboSystem</plugin> -->
    ...(same as above)...

i get the following error:

[ros2_control_node-1] terminate called after throwing an instance of 'std::runtime_error'
[ros2_control_node-1]   what():  Wrong state or command interface configuration.
[ros2_control_node-1] missing state interfaces:
[ros2_control_node-1] ' front_right_steer_joint/effort '	' front_left_steer_joint/effort '	
[ros2_control_node-1] missing command interfaces:
[ros2_control_node-1] ' front_right_steer_joint/position '	' front_left_steer_joint/position '

So at this point i’m totally confused, because in my opinion the interfaces aren’t missing. Dont get me wrong, im trying to use the gazebo_ros2_control/GazeboSystem but thought it may be relevant that the output changes when using the test_system.

Can anyone help me out? Any hint is appreciated.
Thanks alot in advance.

P.S. If any further documentation or log-files are needed just say so - i’m quiet new to this.

Hey! Great question. This is also the first example of the inevitable issue where this is really a question that would be better suited to ROS answers so I’d want to encourage people to post questions there first, and then if they find an answer elsewhere (e.g. here) to go back and answer their own post.

That being said, I’d still like to help and I think I might have a solution (this is tied into the stuff for the video I’m currently working on!).

I think the problem is simply that when you added the plugin, you have a hyphen after gazebo where there should be an underscore.
As far as I can tell, the actual interface plugin (which you managed to find) is not “visible” by default, but loading the other plugin makes it available, but that plugin is not being loaded correctly due to the wrong name.

So try fixing that and let us know how it goes, if it’s still not working we can keep looking :slight_smile:

Edit: Also, you probably know this but you will want to use the DiffDriveController rather than the JointTrajectoryController that you’ve mentioned.

1 Like

Hi Josh,
I’m speechless right now… thats such a dumb mistake… I tried fixing it for days.
You helped a lot, thank you so much!

I’m looking forward to your ros2_control video. Keep up the good work!
Greetings from Germany :slight_smile:

1 Like

Awesome! Good luck with the rest of the robot! (and feel free to post in the projects category if you’d like to show it off to others :slight_smile: )

1 Like