Atlas Robotics
LocalizationIntermediate

What is sensor fusion? Combining imperfect sensors into a better estimate

Atlasbot · 17/8/2026 · 11 min read

What is sensor fusion? Combining imperfect sensors into a better estimate
Sensor Fusion combines odometry and IMU according to dynamic confidence weighting

The previous two articles raised the issue: Odometry drifts when the wheel slips, IMU drifts according to its own integral — no single source is completely reliable. Sensor Fusion is a technique that combines many of these imperfect data sources into an estimate that is better than each source alone.

Key concepts

Core idea: each sensor is reliable in a different aspect, sensor fusion is a way to automatically weight those sources according to the situation:

When the robot goes straight, the speed is stable on a flat floor:
    → more reliable odometry (accurate encoder, less noise under ideal conditions)

When the robot just accelerates quickly or passes through a slippery floor (suspected of wheel slippage):
    → more gyroscope information (IMU) for rotation angle

The difficult problem is not "combining two numbers" (simple arithmetic average), but knowing when to trust which source more — which is exactly the problem that the Kalman filter and its EKF variant (next problem) are designed to solve.

In short: Sensor fusion is not "averaging the sensors together" — it is a continuous estimation process, self-adjusting the level of trust in each source based on the uncertainty of that source at each time.

How it works

The most popular package for sensor fusion in the ROS2 ecosystem is robot_localization, which runs an EKF that receives input from multiple sources at once:

ekf_filter_node:
  ros__parameters:
    odom0: /wheel_odometry
    odom0_config: [true,  true,  false,   # x, y, z
                    false, false, true,    # roll, pitch, yaw
                    false, false, false,   # vx, vy, vz
                    false, false, true,    # vroll, vpitch, vyaw
                    false, false, false]   # ax, ay, az
    imu0: /imu/data
    imu0_config: [false, false, false,
                   false, false, true,     # Just trust yaw from IMU
                   false, false, false,
                   false, false, true,     # and vyaw from gyroscope
                   false, false, false]

The configuration array (_config) is where to declare exactly which data fields come from which source — sample configuration on information x, y from odometry wheel (don't trust yaw, because odometry is less accurate in angle when there is slippage), but trust yaw/vyaw from IMU.

The principle is not limited to odometry + IMU — GPS, visual odometry, or AMCL results can be merged, each source contributing information in the aspect it is most reliable in.

Technical details

Formulas

The simplest form of sensor fusion — combining two independent estimates according to inverse-variance weighting — is the mathematical foundation that Kalman Filter extends:

x_fusion = (x1/σ1² + x2/σ2²) / (1/σ1² + 1/σ2²)

For example: odometry measured x1=10.2m (standard deviation σ1=0.5m, less reliable)
    IMU-derived measured x2=10.0m (standard deviation σ2=0.1m, much more reliable)

x_fusion = (10.2/0.25 + 10.0/0.01) / (1/0.25 + 1/0.01)
         = (40.8 + 1000) / (4 + 100) = 1040.8/104 ≈ 10.01m

The result is much closer to the more reliable estimate (x2) — following the principle "the more certain source (smaller σ) is more trusted", automatically, without the need for manual if-else code to choose which source.

Parameters

The covariance value declared in robot_localization accurately reflects the relative level of trust between sources — smaller numbers mean more trust:

SourcesRelative uncertainty
Position (x,y) from odometry wheelOn average, gradually increasing with distance traveled
Yaw from short-term gyroscope (IMU).Low (very reliable in the short term)
Absolute position from AMCL (next article)Low when well converged, high when initially initialized

Practical applications

For AMR operating both indoors and outdoors, the standard robot_localization architecture often uses 2 nested EKFs: a "local" EKF that only fuses odometry + IMU to publish odom→base_link (smooth, high frequency, no need for GPS); an EKF "global" fusion adds GPS (when there is a signal) to publish map→odom (more absolutely accurate but updates less frequently, and temporarily stops contributing when GPS is obscured near a tall building) — exactly the 2-storey architecture odom/map learned in the Coordinate System lesson, now each floor is also "fed" by its own sensor fusion filter suitable for the characteristics of each floor.

Practical example

def fusion(x1, sigma1, x2, sigma2):
    w1 = 1 / sigma1**2
    w2 = 1 / sigma2**2
    return (x1*w1 + x2*w2) / (w1 + w2)

x_odom, sigma_odom = 10.2, 0.5
x_imu, sigma_imu = 10.0, 0.1

result = fusion(x_odom, sigma_odom, x_imu, sigma_imu)
print(f"Odometry: {x_odom}m (do lech chuan {sigma_odom}m)")
print(f"IMU-derived: {x_imu}m (do lech chuan {sigma_imu}m)")
print(f"Ket qua fusion: {result:.2f}m")
Output:
Odometry: 10.2m (do lech chuan 0.5m)
IMU-derived: 10.0m (do lech chuan 0.1m)
Ket qua fusion: 10.01m

The fusion result is not a simple average ((10.2+10.0)/2 = 10.1) but leans heavily toward the more reliable source — exactly the expected behavior of inverse-variance weighting.

Common mistakes

  • Counting wrong position in array _config 15 elements — fixed order (x,y,z, roll,pitch,yaw, vx,vy,vz, vroll,vpitch,vyaw, ax,ay,az) it is easy to miscount position true/false — always compare clear comments for each line As in the example above, don't just count.
  • Believing the same physical quantity from many conflicting sources — For example: believing yaw from odometry and IMU at the same time without clearly understanding that these two sources can contradict each other when wheel slippage occurs — should clearly choose the most reliable source for each quantity, do not believe uncontrolled duplication.
  • Unrealistic covariance declaration — A sensor source that declares covariance too small (overconfident) compared to the actual accuracy will "overwhelm" other sources in the fusion even though it itself is not that reliable — always use a covariance value that reflects the actual measured characteristics of the sensor, not an arbitrary default number.
  • Fusion sources have very different update frequencies without proper timing — GPS updates 1Hz while odometry updates 50Hz — filter needs to properly interpolate/predict between sparse GPS updates, not just "keep the same value" until the next update.

Conclusion

Sensor fusion turns multiple sources of imperfect data into a more reliable estimate than each individual source, based on uncertainty weighting — the mathematical foundation of Kalman Filter. robot_localization is a standard tool in ROS2 that realizes this principle through declarative configuration, without needing to write the filter yourself from scratch. The next article in this section is about EKF (Extended Kalman Filter) — the specific algorithm behind robot_localization, extending the newly learned weighting principle to nonlinear systems.

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.

What is sensor fusion? Combining imperfect sensors into a better estimate — Atlas Robotics