Gazebo odometry is not the same as RVIz one

mattia_dutto
Thu, 22 Jan 2026 18:49:40 +0000
ros-controls General

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" />
<xacro:wheel prefix="drivewhl_r_b" x_reflect="1" y_reflect="-1" />

...

<plugin filename="gz-sim-diff-drive-system" name="gz::sim::systems::DiffDrive">

   <left_joint>drivewhl_l_joint</left_joint>
   <right_joint>drivewhl_r_joint</right_joint>

<left_joint>drivewhl_l_b_joint</left_joint>
<right_joint>drivewhl_r_b_joint</right_joint>


   <wheel_separation>0.4</wheel_separation>
   <wheel_radius>${wheel_radius}</wheel_radius>


   <max_linear_acceleration>0.1</max_linear_acceleration>


   <topic>/demo/cmd_vel</topic>


   <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.

2 posts - 1 participant