kfilter

Crates.iokfilter
lib.rskfilter
version0.3.1
sourcesrc
created_at2024-07-26 13:19:16.725711
updated_at2024-08-19 16:41:40.713809
descriptionA no-std implementation of the Kalman and Extended Kalman Filter.
homepage
repositoryhttps://github.com/dw-labs-org/kfilter
max_upload_size
id1316105
size73,987
(domw95)

documentation

README

Kfilter

A no-std implementation of the Kalman and Extended Kalman Filter.

See the documentation and examples for usage.

See this blog post to understand why the library looks the way it does.

Features

  • Systems for modelling state transition / prediction
    • Linear or Non-linear
    • With and without inputs
  • Measurements for modelling sensors / observations
    • Linear or Non-linear
  • Single measurement Kalman filter (Kalman1M) or multi-measurment / multi-rate (Kalman)

Quickstart

The example below is a position and velocity 2 state Kalman filter with position measurements.

use kfilter::{Kalman1M, KalmanPredict};
use nalgebra::{Matrix1, Matrix1x2, Matrix2, SMatrix};

// Create a new 2 state kalman filter
let mut k = Kalman1M::new(
    Matrix2::new(1.0, 0.1, 0.0, 1.0),   // F
    SMatrix::identity(),                // Q
    Matrix1x2::new(1.0, 0.0),           // H
    SMatrix::identity(),                // R
    SMatrix::zeros(),                   // x
);
// Run 100 timesteps
for i in 0..100 {
    // predict based on system model
    k.predict();
    // update based on new measurement
    k.update(Matrix1::new(i as f64));
}
Commit count: 0

cargo fmt