Odometry fusion: combining encoders, IMU and RF2O in one node
Atlasbot · 17/8/2026 · 11 min read
Three sources of motion estimation have been introduced individually: Encoder (the Differential Drive article), IMU (the Sensor Fusion article), and RF2O (the previous article). This article conflates all three into one configuration robot_localization real-world — not just the 2 sources as in the simple example in Sensor Fusion.
Key concepts
The core principle of integrating multiple sources is that each source only contributes the right amount of what it's strongest, not all the data it has.
Encoder (wheel_odom) → accurate for x, y WHEN WHEELS ARE NOT SLIPPING
RF2O → accurate for yaw/vyaw, independent of wheel slip
IMU (gyroscope) → accurate for instantaneous vyaw, responds quickly to sudden changes
How it works
ekf_local:
ros__parameters:
odom0: /wheel_odom
odom0_config: [true, true, false,
false, false, false,
false, false, false,
false, false, false,
false, false, false] # only trust x, y from encoder
odom1: /rf2o/odom
odom1_config: [false, false, false,
false, false, true,
false, false, false,
false, false, true,
false, false, false] # news yaw, vyaw from RF2O
imu0: /imu/data
imu0_config: [false, false, false,
false, false, false,
false, false, false,
false, false, true,
false, false, false] # vyaw news (gyroscope) from IMU
This is a direct application of the principle stated in Sensor Fusion: no source is reliable in every respect, dynamic EKF weights based on the uncertainty of each source, configuration part _config prespecified which field Every source is allowed to contribute.
In summary: There are more than 2 sources that are not to be ambiguously "safety" — each of which adds to address the blind spots of the others. RF2O compensates for the encoder when sliding the wheel; IMU compensates for both when immediate response to sudden directional changes is required. Adding a source that makes no new contributions (causing the same strengths as the existing source) only complicates the system without improving accuracy.
Technical details
Formulas
The _config array has exactly 15 elements, corresponding to 15 state dimensions for which robot_localization tracking — captures this structure which helps avoid confusion when configuring:
Order of the 15 state dimensions: [x, y, z, roll, pitch, yaw,
vx, vy, vz, vroll, vpitch, vyaw,
ax, ay, az]
Example: odom0_config enables only position [true, true, false, ...] (elements 1,2)
→ trust only x, y from the encoder and ignore all other components,
even if /wheel_odom publishes complete velocity data
Parameters
| Sources | Tin Field | Reason |
|---|---|---|
Encoder (odom0) | x, y | Accurately does not slide the wheel, but does not measure directly the reliable direction |
RF2O (odom1) | yaw, vyaw | Wheel-slip independent, good for direction |
IMU (imu0) | vyaw | Instantaneous response to sudden directional change |
Practical applications
Testing the fusion quality by comparison with each source individually is an important validation step before configurational trust:
ros2 topic echo /wheel_odom # encoder only
ros2 topic echo /rf2o/odom # only RF2O
ros2 topic echo /odometry/filtered # result after EKF
When the robot walks straight on a flat floor, the three sources should give close matches. As the robot traverses the slippery (doubtful sliding) floor segment, /wheel_odom and /rf2o/odom will begin to deviate from each other — Direct observation of this deviation through ros2 topic echo is a way of verifying in real-world whether the sensor fusion is functioning properly as expected, not just believing in the theoretical configuration. The robot_localization architecture supports arbitrary number of odom/imu/pose/twist sources (numbering odom0, odom1, odom2...) — three sources here are just typical examples for a non-GPS AMR. Outdoor robots can add GPS (pose source), camera-based robots can add visual odometry — in the same principle, except for the number and type of sources.
Practical example
Practical debugging scenario: the robot's reported position suddenly jumps in the log
Step 1: echo /wheel_odom -> vx, vy look reasonable, nothing unusual
Step 2: echo /rf2o/odom -> a large vyaw spike at the suspect time
Step 3: echo /odometry/filtered -> the EKF output jumps too
Conclusion: RF2O is producing noisy data at that moment — possibly while crossing
an area with few geometric features (discussed in RF2O) — reduce RF2O's
trust weight or recheck the covariance on /rf2o/odom
Common mistakes
- Enables the entire field of all sources rather than just the most powerful — as stated in the Abstract, making the system more complex without improving accuracy, possibly even interfering with each other if 2 sources contribute the same field with significantly different reliability.
- Incorrect element ordering in a 15-dimensional
_config— array as in the Formula section, misplacedtruecauses the EKF to misenter the field, making this error difficult to detect via conventional log. - Failing to directly compare individual sources when debugging— as the example above, bypassing the real-world validation step and relying only on the final EKF results makes it difficult to determine which source is confounding.
- Addition of a data source that coincides with an existing— source does not provide a commensurate benefit in added configurational complexity, which specific weak points each new source compensates before addition should be clearly defined.
Conclusion
Incorporating odometry is not about "the more sources the more accurate" unconditionally — the core principle is that each source only correctly contributes the part it is strongest, offsetting the blind spots of the others. The 15 - dimensional _config configuration is instrumental in realizing this principle explicitly. The last article of the Localization section, TF Tree , goes into debugging the coordinate tree when there are any errors in the entire sequence of the recently learned data sources.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.