ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[solved] How to use libgazebo_ros_p3d ?

asked 2022-05-09 02:55:58 -0600

Bastian2909 gravatar image

updated 2022-05-09 06:43:42 -0600

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-09 06:14:53 -0600

Joe28965 gravatar image

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.

edit flag offensive delete link more

Comments

thank you so much, it was indeed called dummy !

Bastian2909 gravatar image Bastian2909  ( 2022-05-09 06:43:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-05-09 02:55:58 -0600

Seen: 2,574 times

Last updated: May 09 '22