FixTheRobot Explore Robotics / Systems Engineering / Engineering Guides / Module 02

Engineering Guides · Module 02

Sensor combination: encoder + IMU

Encoders give distance travelled; the IMU gives turning. The cheapest dead-reckoning pair.

  • Advanced
  • Module 02: Sensor Selection, Trade-offs & Integration
  • Written for ROS 2 Jazzy where ROS 2 is used
  • Sources checked 2026-11-05

Assumptions: General fusion guidance. Named algorithms appear only where their READMEs were checked (see the SLAM Selection Guide). No performance figures are given.

1. Engineering problem

Wheel odometry is smooth but wrong when wheels slip or the wheel size is misjudged; the IMU measures rotation independently of the wheels. Together they give a better local pose.

2. When is this needed?

  • Every wheeled robot as the local odometry base.
  • Between slower absolute updates (LiDAR, GNSS).

3. Selection and design decisions

What each sensor contributes

Contributions
SensorContributionWeakness the other covers
EncoderPrecise distance and speedSlip, wheel-size and track-width errors
IMUYaw rate independent of the wheelsBias drift

Fusion approaches

  • EKF with wheel velocity (vx, vyaw) and IMU yaw rate (see the robot_localization guide).
  • Slip detection by comparing wheel and IMU yaw rate.

4. Advantages and disadvantages

  • Fusing fewer variables is more robust; adding accelerations adds noise.
  • The result still drifts: it needs an absolute reference for long runs.

5. Requirements and constraints

  • Time synchronisation to within what the estimator tolerates (use the Sensor Time Synchronization Simulator).
  • Calibrated extrinsics between every fused pair, with the transform direction documented (see the frame-conventions guide).
  • Wheel radius and separation calibrated.
  • IMU mounting orientation and bias known.
  • Consistent time stamps.

6. Architecture

wheel encoders ─▶ wheel odometry ─┐
                                 ├─▶ EKF ─▶ odom → base_link
IMU (yaw rate) ──────────────────┘

7. Implementation

  1. Calibrate wheel radius and separation (drive a straight line and a circle).
  2. Check IMU axes and bias.
  3. Configure the EKF; test closed squares.
  4. Add slip rejection thresholds if needed.

Compare structures in the Sensor Fusion Architecture Builder.

8. Real examples

  • Any indoor differential-drive robot.

9. Failure scenarios

  • Wrong wheel radius: scale error in distance.
  • Wrong separation: turning error.
  • Slip: wheel and IMU disagree.
  • Gyro bias drift.

10. Troubleshooting

  1. Compare wheel yaw rate with IMU yaw rate while driving.
  2. Repeat a square in both directions: asymmetry shows calibration errors.

11. Validation

  • Closed-square error below your limit in both directions.
  • Spin test returns to the starting heading within IMU drift.
  • Straight 10 m run within your tolerance.

12. Engineering checklist

13. Further references

  • Class-level guidance written from general engineering knowledge; it contains no product specifications. Product-specific numbers must come from the manufacturer’s datasheet for the exact model and operating mode.
  • ROS 2 message types: sensor_msgs (jazzy branch).

Related on FixTheRobot