Crates.io | kfilter |
lib.rs | kfilter |
version | 0.3.1 |
source | src |
created_at | 2024-07-26 13:19:16.725711 |
updated_at | 2024-08-19 16:41:40.713809 |
description | A no-std implementation of the Kalman and Extended Kalman Filter. |
homepage | |
repository | https://github.com/dw-labs-org/kfilter |
max_upload_size | |
id | 1316105 |
size | 73,987 |
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.
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));
}