filter-rs is a port of the filterpy library and aims to provide Kalman filtering and optimal estimation for Rust.
This port is a work in progress and incomplete. To learn more about Kalman filters check out Roger R Labbe Jr.'s awesome book Kalman-and-Bayesian-Filters-in-Python.
This library will grow as I work through the book myself and the API will most likely evolve and become more rustic, too. Feedback on the API design is always appreciated, as well as pull requests for missing features.
The API is based on nalgebra
matrices with structural genericity. That means, that the shapes of inputs can
statically checked and are always correct at runtime.
``` let x0 = 0.0; let dx0 = 0.0; let g = 0.2; let h - 0.2; let dt = 0.01;
let fgh = GHFilter::new(x0, dx0, g, h, dt);
```
The Kalman filter has to be initialised with sensible values. A default filter can be constructed but should not be used.
```
let mut kf: KalmanFilter
kf.x = Vector2::new(2.0, 0.0); kf.F = Matrix2::new( 1.0, 1.0, 0.0, 1.0, ); kf.H = Vector2::new(1.0, 0.0).transpose(); kf.P *= 1000.0; kf.R = Matrix1::new(5.0); kf.Q = Matrix2::repeat(0.0001);
let mut results = Vec::default(); for t in 0..100 { let z = Vector1::new(t as f64); kf.update(&z, None, None); kf.predict(None, None, None, None); results.push(kf.x.clone()); } ```
Tickboxes will be filled for each module that has feature parity with the filtyerpy library.
[ ] IMM Estimator
[ ] Extended Kalman Filter
[ ] Ensemble Kalman Filter
[ ] Discrete Bayes
[ ] GH-Filter
[ ] GHK-Filter
[ ] Fading Memory Filter
[ ] H-Infinity Filter
[ ] Least Squares Filter
This project is licensed under the MIT License - see the LICENSE file for details