How to use libgazebo_ros_p3d ?

asked 2022-05-09 03:02:48 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I'm using ros2 foxy on ubuntu 20.04 with Gazebo multi-robot simulator, version 11.10.2 I'm trying to simulate a robot using the plugin libgazebo_ros_p3d as I need to have the position over the time published on a topic "odom".

My code work fine with and without the plugin (the simulation starts and I can control my robot), I even have other plugins used (IMU and diff-drive). However the plugins seem to not work (nothing is published) and i get the error :

[gazebo-4] [ERROR] [1652081431.073520636] [p3d.libgazebo_ros_p3d]: body_name: base_link does not exist

here is my code simplified :

<robot name="my_robot">
  <!-- link used to allow base_link to have an inertia-->
  <link name="dummy">
  <!-- Robot Base_link -->
  <link name="base_link">
      <origin rpy="0 0 0" xyz="0.24765 0 0.16755"/>
        <box size="0.4953 0.5505 0.3351"/>
      <material name="Cyan">
        <color rgba="0 1.0 1.0 1.0"/>
      <origin rpy="0 0 0" xyz="0.24765 0 0.16755"/>
        <box size="0.4953 0.349 0.3351"/>
    <plugin name="libgazebo_ros_p3d" filename="">
      <joint name="dummy_joint" type="fixed">
        <parent link="dummy"/>
        <child link="base_link"/>

BTW I have Inertial tags but id didn't paste them here to make the code a little bit easier to read, though i'm far from being an expert so if you belive I should add them i will !

Is there a way to make this plugin work with my code ? Or is there another way to publish odom as position over the time ? I can't seem to find much documentation on this subject sadly.

Thank you to anyone who took the time to read my question

edit retag flag offensive close merge delete