commaai/rednose

Kalman filter library

What it solves

Rednose is a Kalman filter framework designed for optimization problems involving sensor fusion, visual odometry, and SLAM (Simultaneous Localization and Mapping). It simplifies the process of creating accurate, computationally efficient filters that can operate both online and offline.

How it works

The framework provides several advanced estimation techniques to handle non-linear systems and 3D orientation:

  • Extended Kalman Filter (EKF): Uses sympy to symbolically compute Jacobians, removing the manual calculation errors typically associated with linearizing non-linear systems.
  • Error State Kalman Filter (ESKF): Manages 3D orientation by representing the system state with quaternions while using Euler angles to describe the error, avoiding gimbal lock and redundancy issues.
  • Multi-State Constraint Kalman Filter (MSCKF): Integrates feature-based visual odometry by managing the dependency between feature depth and camera location to prevent positive feedback loops in confidence estimation.
  • Rauch–Tung–Striebel (RTS) Smoothing: Enables offline estimation by running the filter backwards to improve accuracy and reduce initialization errors.
  • Mahalanobis Distance: Implements a statistical test to reject outliers in measurements that do not follow a Gaussian distribution.

Who it’s for

Developers and engineers working on robotics, autonomous vehicles, and 3D localization algorithms who need a robust way to implement complex sensor fusion filters in Python.

Highlights

  • Symbolic Jacobians: Automates the linearization process using SymPy.
  • Robust 3D Orientation: Specialized support for ESKFs to handle quaternions and Euler angles.
  • Visual Odometry Support: Full support for MSCKFs to integrate image-based features.
  • Offline Optimization: RTS smoothing for near-global optimization performance.
  • Outlier Rejection: Built-in Mahalanobis distance testing for noisy sensor data.