Robotics StackExchange | Archived questions

How do you use contact sensor to make a bridge from Gazebo to ROS2 ?

Environment

Description

ros2 topic echo \topic_name I received the error: The message type 'rosgzinterfaces/msg/Contacts' is invalid

Mostly, the errors were:

[WARN] [1681217678.043852626] [rosgzbridge]: Failed to create a bridge for topic [/chatter] with ROS2 type [rosgzinterfaces/msg/Contact] to topic [/chatter] with Gazebo Transport type [ignition.msgs.Contact]

Where the bridge didn't even start.

Steps to reproduce

  1. Install Gazebo Garden / Fortress
  2. Install ROS2 Humble
  3. Launch for instance (here with gazebo garden), commands change if fortress being used: gz sim shapes.sdf It will open Gazebo with simple sdf model. Actually, I'm using my own sdf, if you have your own it'll be better to ensure that in your sdf, you have the right plug-ins initialized. For instance, for the contact plug-in, i'm interested:

<!-- Contact plug-in --> <plugin filename="ignition-gazebo-contact-system" name="ignition::gazebo::systems::Contact"> </plugin> in fortress*

or

<!-- Contact plug-in --> <plugin filename="gz-sim-contact-system" name="gz::sim::systems::Contact"> </plugin> in garden

Written within the world scope. And:

<sensor name='object_contact_sensor' type='contact'> <contact> <collision>coude_collision</collision> </contact> </sensor>

Written within the link scope of the model I want the contacts. With coude_collision, the collision name of the link.

  1. Launch the bridge: ros2 run ros_gz_bridge parameter_bridge /chatter@ros_gz_interfaces/msg/Contacts[gz.msgs.Contacts Still using garden
  2. Launch an echo : ros2 topic echo --once /chatter

I can echo with gazebo like: gz topic -e -t topic_name But not with ROS2

Output

Would give your more in depth output.

Asked by Mildred34 on 2023-04-11 08:07:30 UTC

Comments

Launching a bridge from a terminal is now working. I forgot, to source the ros_gz_interfaces after compiling it in the terminal I used for ros2 topic echo...

I added the source command inside my bashrc file ; will not forget it again x)

Asked by Mildred34 on 2023-04-12 03:32:10 UTC

Answers

Looks like you haven't properly built ros_gz_interfaces, which is part of ros_gz. Have you followed these instructions for building ros_gz for Garden and ROS 2 Humble?

Asked by azeey on 2023-04-11 15:37:51 UTC

Comments