0
$\begingroup$

So this is kind of a wierd issue.

I have a two-wheeled robot with a caster and i'm using diff_drive to test it in gazebo with ros2-galactic. my tf tree is a little different where my base_link is not the root link.

in my urdf I set the wheels parant link to be base_link, and so it appears just as the robot spawns.

<joint name="br_wheel_joint" type="continuous">
  <parent link="base_link"/>
  <child link="br_wheel"/>
  <origin xyz="0.0 ${-wheels_base/2} ${wheel_radius}" rpy="0 0 0"/>
  <axis xyz="0 1 0"/>
</joint>


<gazebo>
<plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'>
  <ros>
    <namespace>/my_robot</namespace>
  </ros>

  <update_rate>500</update_rate>
  <num_wheel_pairs>1</num_wheel_pairs>

  <left_joint>bl_wheel_joint</left_joint>
  <right_joint>br_wheel_joint</right_joint>

  <!-- kinematics -->
  <wheel_separation>${wheels_base} </wheel_separation>

  <wheel_diameter>${2*wheel_radius}</wheel_diameter>

  <!-- limits -->
  <max_wheel_torque>20</max_wheel_torque>
  <max_wheel_acceleration>2.0</max_wheel_acceleration>

  <!-- output -->
  <publish_odom>true</publish_odom>
  <publish_odom_tf>false</publish_odom_tf>
  <publish_wheel_tf>true</publish_wheel_tf>

  <robot_base_frame>base_footprint</robot_base_frame>
  <odometry_frame>odom</odometry_frame>
  
</plugin>

but as soon as diff_drive starts publishing the transform, for some reason the parant link changes to my root link.

tf2 tree

I assume its bacause diff_drive takes the root link as parent link when publishing the transform, although I dont understand why. I tried playing wroung with the <robot_base_frame> tag but it appears that it was depracted after transitioning to ros2. Any thoughts on this issue ?

$\endgroup$

2 Answers 2

0
$\begingroup$

You should change robot_base_frame to your actual "base_link" - since your robot has no "base_footprint":

<robot_base_frame>base_link</robot_base_frame>

Note though: this may cause a different issue - as I presume the diff_drive plugin will be publishing the odom->base_link TF transform, and then base_link will have two parents - this often causes problems with TF lookup.

$\endgroup$
0
$\begingroup$

The issue arises because the plugin is publishing the wheel transform (TF) to the specified base frame, causing the parent link to change unexpectedly.

To resolve this, you can modify the plugin configuration by setting the <publish_wheel_tf> parameter to false. This will prevent the plugin from publishing the wheel TF and should resolve the issue you're experiencing.

Here’s the necessary change:

<publish_wheel_tf>false</publish_wheel_tf>

This adjustment will stop the plugin from interfering with the parent link, ensuring that the TF tree remains stable.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.