How do you use contact sensor to make a bridge from Gazebo to ROS2 ?
Environment
- OS Version: Ubuntu 22.04 precisely using WSL2 through windows 10
- Source or binary build? Source build, branch: ROS2 latest commit from Aditya Panda 22/03 with gazebo garden / Tried also the humble branch with gazebo fortress
- ROS version: humble
Description
- Expected behavior: Doing a bridge from gz::msgs::Contact to ros_gz_interfaces/msg/Contact using or ignition::msgs::Contact to ros_gz_interfaces/msg/Contact depending of the gazebo version tested
Actual behavior: Last errors were: The bridge was launched but couldn't echocause of:
ros2 topic echo \topic_name
I received the error: The message type 'ros_gz_interfaces/msg/Contacts' is invalid
Mostly, the errors were:
[WARN] [1681217678.043852626] [ros_gz_bridge]: Failed to create a bridge for topic [/chatter] with ROS2 type [ros_gz_interfaces/msg/Contact] to topic [/chatter] with Gazebo Transport type [ignition.msgs.Contact]
Where the bridge didn't even start.
Steps to reproduce
- Install Gazebo Garden / Fortress
- Install ROS2 Humble
- 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.
- Launch the bridge:
ros2 run ros_gz_bridge parameter_bridge /chatter@ros_gz_interfaces/msg/Contacts[gz.msgs.Contacts
Still using garden - 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.
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)