Localization
Localization Troubleshooting#
Filtered odometry drifts more than expected#
Symptom: The filtered estimate in RViz accumulates position error faster than expected during normal operation.
Cause: The process_noise_covariance values in rl_ekf.yaml are not tuned for the current operating conditions, or the IMU yaw contribution is being overridden by odometry errors due to wheel slip.
Fix: Increase the yaw-related diagonal values in process_noise_covariance to give the filter more freedom to correct heading, or reduce the gain parameter of the Madgwick filter (madgwick_filter_gain) on hardware to produce smoother orientation estimates. Log both /micipsa_base_controller/odom and /odometry/filtered simultaneously in RViz to compare and isolate whether the drift originates from odometry or from filter divergence.
IMU orientation is wrong on hardware, EKF heading estimate jumps at startup#
Symptom: The odom → base_footprint transform shows an unexpected initial rotation on the first few seconds after launch on real hardware.
Cause: The Madgwick filter has not yet converged to the correct orientation at startup. imu0_relative: true is set to mitigate this by treating the first measurement as zero, but if the Madgwick filter is still converging when the EKF initializes, the first few EKF updates will incorporate an incorrect absolute heading.
Fix: Allow a few seconds for the Madgwick filter to converge before launching the EKF, or reduce madgwick_filter_gain to slow convergence and reduce the startup jump. On a stationary robot, convergence typically takes 2–5 seconds with the default gain: 0.01.
