ukalman/lib.rs
1//! Super tiny zero allocation filters for embedded.
2//!
3//! Currently this crate only implements a tiny 1D kalman filter, useful for smoothing ADCs and similar
4//! 1D sensors. In the future, multidimensional and non-linear filters may be added.
5//!
6//! ```
7//! # use std::io::Read;
8//! # use ukalman::Kalman1D;
9//!
10//! // Initialises filter
11//! let mut filter = Kalman1D::new(2000.0, 67.4f32.powi(2));
12//!
13//! let mut f = std::fs::File::open("test_assets/cap_full_throttle.txt").unwrap();
14//! let mut str = String::new();
15//! f.read_to_string(&mut str).unwrap();
16//!
17//! // Estimate over some data
18//! for val in str.lines().flat_map(|s| s.parse::<u16>()) {
19//! // Filter with a static state model, and small system noise
20//! let est = filter.filter(val as f32, 191.93f32.powi(2), |x| x, |v| v + 0.001);
21//! std::println!("{:.0}", est);
22//! }
23//! ```
24
25#![no_std]
26
27mod kalman;
28
29pub use kalman::*;