I am trying to fuse IMU and GPS with the help of robot_localization pkg. I might also fuse encoder data in the future. I get this weird jumping in odometry in rviz. I get that GPS is published every second and it "corrects" odometry. But why the huge drift in the first place.

Here's config for fusion:

frequency: 20.0
sensor_timeout: 0.01
two_d_mode: true
publish_acceleration: true
publish_tf: true

map_frame: map              # Defaults to "map" if unspecified
odom_frame: odom            # Defaults to "odom" if unspecified
base_link_frame: base_link  # Defaults to "base_link" if unspecified
world_frame: odom           # Defaults to the value of odom_frame if unspecified

odom0: odometry/gps
odom0_config: [ true,  true, true, # [x, y, z]
               false, false, false, # [roll, pitch, yaw]
               false, false, false, # [x_vel, y_vel, z_vel]
               false, false, false, # [roll_vel, pitch_vel, yaw_vel]
               false, false, false] # [x_accel, y_accel, z_accel]
odom0_differential: false
odom0_queue_size: 5

imu0: imu/data
imu0_config: [false, false, false, # [x, y, z]
               true,  true,  true, # [roll, pitch, yaw]
              false, false, false, # [x_vel, y_vel, z_vel]
              false, false,  true, # [roll_vel, pitch_vel, yaw_vel]
               true,  true, false] # [x_accel, y_accel, z_accel]
imu0_differential: false
imu0_queue_size: 5
imu0_remove_gravitational_acceleration: true

enter image description here It's not on gif repeat it is actually jumping back every second.


1 Answer 1


You need a velocity reference. r_l is not good at working with only pose + acceleration data. It's going to be integrating the acceleration from the IMU and causing the velocity estimate to grow very rapidly (your IMU accelerometer will obviously have biases).

By the way, you have two_d_mode enabled, but are fusing a bunch of 3D variables (roll, pitch, Z) from your input sources.


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.