Gazebo odometry is not the same as RVIz one

Good morning, I’m trying to use both the robot from the Navigation 2 tutorial and the one from the Articulated Robotics tutorial. However, I’m facing an issue when transitioning from a single set of wheels to two sets—one set in the front and one in the back. With the single set and using differential drive as the controller, everything worked well, but when I switched to two sets, the odometry calculations became inconsistent. Here is the updated code for the two-set configuration based on the Navigation 2 tutorial.

Setup configuration: Ubuntu 24.04 - ROS2 Jazzy - Gazebo Harmonic

<xacro:wheel prefix="drivewhl_l" x_reflect="-1" y_reflect="1" />
<xacro:wheel prefix="drivewhl_r" x_reflect="-1" y_reflect="-1" />
<xacro:wheel prefix="drivewhl_l_b" x_reflect="1" y_reflect="1" /> <!-- Added line -->
<xacro:wheel prefix="drivewhl_r_b" x_reflect="1" y_reflect="-1" /> <!-- Added line -->

...

<plugin filename="gz-sim-diff-drive-system" name="gz::sim::systems::DiffDrive">
   <!-- wheels -->
   <left_joint>drivewhl_l_joint</left_joint>
   <right_joint>drivewhl_r_joint</right_joint>

   <left_joint>drivewhl_l_b_joint</left_joint> <!-- Added line -->
   <right_joint>drivewhl_r_b_joint</right_joint> <!-- Added line -->

   <!-- kinematics -->
   <wheel_separation>0.4</wheel_separation>
   <wheel_radius>${wheel_radius}</wheel_radius>

   <!-- limits -->
   <max_linear_acceleration>0.1</max_linear_acceleration>

   <!-- input -->
   <topic>/demo/cmd_vel</topic>

   <!-- output -->
   <odom_topic>/demo/odom</odom_topic>
   <tf_topic>/tf</tf_topic>

   <frame_id>odom</frame_id>
   <child_frame_id>base_link</child_frame_id>
</plugin>

The issue is also reported here.

Thank you, for your time in advance.

1 Like

After a week of work, I finally managed to find a solution. The issue in my case was with the publication of the odometry. Adding the odometry plug-in solved the issue.