gz_ros2_control: /robot_controller/joint_trajectory topic is not translated to Gazebo Sim

Hello,

I am on ROS2 Jazzy, Moveit2 and Gazebo Sim Harmonic. I use a custom robot 6DoF Robot which I did the moveit2 setup assistant for, and using the robot with moveit2 in Gazebo Sim Harmonic works.

My issue is, that although launching moveit servo with my custom robot without gazebo is functional, I cannot use it combined with Gazebo Sim.

The issue is see is the Gazebo Plugin for ROS2 Control.

When launching the robot without gazebo, I can use the hardware plugin in my ros2_control.xacro file as this:

    <hardware>
        <plugin>mock_components/GenericSystem</plugin>
    </hardware>

When launching my robot in gazebo, I use the gz_ros2_control package as this:

    <hardware>
        <plugin>gz_ros2_control/GazeboSimSystem</plugin>
    </hardware>

In the case of launching both gazebo and moveit servo, and only launching mock_components plugin, the robot controller I define in gazebo cannot be activated:

[controller_manager]: Could not switch controllers since prepare command mode switch was rejected.

The robot is not actuated and flops onto the ground. This makes sense, as the gazebo plugin is missing.

In the case of launching gz_ros2_control/GazeboSimSystem as my hardware plugin, I can see that my /robot_controller/joint_trajectory topic is populated, but neither the robot in rviz2 nor in gazebo move. Somehow, the gz_ros2_control/GazeboSimSystem does not pick up this topic, although it should? I can see, that the /robot_controller node is subscribed to /robot_controller/joint_trajectory.

I tested this with ompl and the standard moveit2 p2p motion I can set in the MotionPlanning plugin in rviz, and the /robot_controller/joint_trajectory is empty there, too.

How can I get the gazebo sim plugin to transfer my joint trajectory to gazebo and move the simulated robot? Is it another topic I need to publish to for the plugin to work?

Thanks a lot in advance!

All the best and merry christmas,

Julian

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

gazebo does not support joints with position+velocity interfaces, but if they are consistent it “just” works. Problem is when your velocity controller is claiming the interface, then the position command of JTC will be overridden with zeros from the inactive velocity controllers. The hardware component can’t detect which controller is claiming what, which means that we can’t throw a warning in a setup like yours.