0
$\begingroup$

I'm facing an issue with my ROS 2 Humble setup using Gazebo Fortress. I have a differential drive robot simulated in Gazebo, and I'm trying to control it via ROS topics cmd_vel and odom. However, I noticed that these topics are not being created by the Gazebo plugin.

ros2 topic list

/clicked_point
/clock
/goal_pose
/initialpose
/joint_states
/parameter_events
/robot_description
/rosout
/tf
/tf_static

ign topic --list

/clock
/gazebo/resource_paths
/gui/camera/pose
/model/wheel_robot/odometry
/model/wheel_robot/tf
/stats
/world/empty/clock
/world/empty/dynamic_pose/info
/world/empty/model/wheel_robot/joint_state
/world/empty/pose/info
/world/empty/scene/deletion
/world/empty/scene/info
/world/empty/state
/world/empty/stats

Here is a snippet of my Gazebo plugin configuration:

<!-- differential drive plugin-->
    <gazebo>
      <plugin 
        filename="libignition-gazebo-diff-drive-system.so"
        name="ignition::gazebo::systems::DiffDrive" >
        <!-- Update rate in Hz -->
        <update_rate>50</update_rate>
  
        <!-- wheels -->
        <left_joint>base_to_left_wheel</left_joint>
        <right_joint>base_to_right_wheel</right_joint>
  
        <!-- kinematics -->
        <wheel_separation>0.65</wheel_separation>
        <wheel_radius>0.1</wheel_radius>

        <odom_publish_frequency>10</odom_publish_frequency>
  
        <!-- limits -->
        <max_wheel_torque>20</max_wheel_torque>
        <max_wheel_acceleration>1.0</max_wheel_acceleration>
  
        <!-- input -->
        <topic>cmd_vel</topic>

        <odometry_topic>odom</odometry_topic>
        <odometry_frame>odom</odometry_frame>
        <robot_base_frame>base_footprint</robot_base_frame>

        <publish_odom>true</publish_odom>
        <publish_odom_tf>true</publish_odom_tf>
        <publish_wheel_tf>true</publish_wheel_tf>
    
      </plugin>
  </gazebo

Strangely, when I use the ros_gz_bridge (in launch file), I'm able to see the cmd_vel topic and even send commands to it. However, I would like to avoid using the bridge and have the topics created directly by the Gazebo plugin.

# Bridge
    bridge = Node(
        package='ros_gz_bridge',
        executable='parameter_bridge',
        arguments=['cmd_vel@geometry_msgs/msg/[email protected]'],
        output='screen'
    )

Has anyone encountered a similar issue before? Any suggestions on what might be causing this issue or how to resolve it would be greatly appreciated.

$\endgroup$

1 Answer 1

0
$\begingroup$

This is "known" behavior.

ign topic --list only shows topics with publishers, but not topics with just subscribers.

This was reported here and fixed by this PR from Harmonic on.

The fix is not available on Garden, Fortress or lower versions. But the good news is that the topic is available, even though ign topic --list doesn't show it. So apart from it not being listed, it should work just fine to publish to that topic from a Gazebo publisher, there is no need to use the ros_gz_bridge.

If you're not sure about the topic name, than it can help to start Gazebo with debug logging enabled (ign gazebo -v 4) as the plugins typically show the topics they use in their debug output. Alternatively look in the source code for documentation and default values.

$\endgroup$
2
  • $\begingroup$ Thank you so much for the info. $\endgroup$
    – Dragon
    Commented May 6 at 6:56
  • $\begingroup$ Glad it helps. I added some info on how to find topic names if you don't know them. I wish I'd had that info when I first started... ;-) $\endgroup$
    – JRTG
    Commented May 6 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.