BackOpen source
Open source2026Author

next_EKF

Odometry and IMU fusion, tuned from measured noise

Most EKF tuning is a guess dressed as a covariance. This one measures the IMU's actual noise first, then hands the filter numbers it can trust.

Problem

An EKF is only as good as the covariances it is given, and in practice those are usually copied from an example or tuned until the output looks smooth. Smooth is not the same as correct, a filter can be confidently wrong in exactly the situations that matter.

The IMU on this robot has real, measurable noise characteristics. Using them is cheaper than guessing and produces a filter whose behaviour can be explained.

What I built

A characterisation step, then the fusion that consumes it.

  • Allan variance analysis extracting gyro and accelerometer bias-instability and random-walk terms
  • Measured covariances injected into the IMU messages themselves
  • Complementary filter for orientation
  • robot_localization EKF fusing encoders and IMU into a Nav2-ready odometry estimate

From raw sensor to a filter that can be justified

  1. Log the IMU at rest

    Long enough for the Allan deviation curve to be meaningful.

  2. Allan variance analysis

    Reads bias instability and random walk off the curve.

  3. Inject the measured terms as covariances

    Into the IMU messages, so the consumer does not have to be told separately.

  4. EKF fuses encoders and IMU

    Weighting each by quantified uncertainty.

  5. Nav2-ready odometry

Limitations and failure modes

  • The measured terms describe this IMU on this platform. A different unit needs its own characterisation, the method transfers, the numbers do not.

Attribution

Built by me
The characterisation, the covariance injection and the fusion configuration.
Based on external research
robot_localization and Allan variance analysis are established work.

Related

  • SMR300

    Autonomy stack for a 300 kg industrial AMR

  • next_HI

    CANopen hardware interface and the CiA 402 state machine