0
$\begingroup$

Rosanswers logo

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">
  </link>
  <!-- Robot Base_link -->
  <link name="base_link">
    <visual>
      <origin rpy="0 0 0" xyz="0.24765 0 0.16755"/>
      <geometry>
        <box size="0.4953 0.5505 0.3351"/>
      </geometry>
      <material name="Cyan">
        <color rgba="0 1.0 1.0 1.0"/>
      </material>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0.24765 0 0.16755"/>
      <geometry>
        <box size="0.4953 0.349 0.3351"/>
      </geometry>
    </collision>
  </link>
  <gazebo>
    <plugin name="libgazebo_ros_p3d" filename="libgazebo_ros_p3d.so">
        <ros>
            <namespace>p3d</namespace>
            <remapping>odom:=odom</remapping>
            </ros>
            <frame_name>map</frame_name>
            <body_name>base_link</body_name>
            <update_rate>200.0</update_rate>
            <gaussian_noise>0.01</gaussian_noise>
        </plugin>
      </gazebo>
      <joint name="dummy_joint" type="fixed">
        <parent link="dummy"/>
        <child link="base_link"/>
      </joint>
    </robot>

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


Originally posted by Bastian2909 on ROS Answers with karma: 68 on 2022-05-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Check in Gazebo what the body is called. Gazebo will merge static links together to make calculations and such easier. I wouldn't be surprised if your body is called dummy since that's the main link.

You can check it in Gazebo in the left panel. There you should be able to collapse a thing called Models. Find your model, collapse that and check what links are in there.


Originally posted by Joe28965 with karma: 1124 on 2022-05-09

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Bastian2909 on 2022-05-09:
thank you so much, it was indeed called dummy !

$\endgroup$

Your Answer

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