6 releases
0.3.1 | Aug 19, 2024 |
---|---|
0.3.0 | Jul 30, 2024 |
0.2.2 | Jul 29, 2024 |
0.1.0 | Jul 26, 2024 |
#58 in Robotics
36KB
581 lines
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));
}
Dependencies
~4MB
~79K SLoC