pub struct Smoother { /* private fields */ }Expand description
Smooths a noisy signal with an exponential moving average.
Cheap sensors are noisy, and a single bad sample should not trip an alarm or
flip an actuator. A Smoother dampens that jitter. The technique one layer
down is an exponential moving average: each output is a weighted blend of the
newest sample and the previous output, so recent readings count for more
without storing a history buffer.
§Examples
use pamoja_kit::Smoother;
let mut smoother = Smoother::new(0.5);
assert_eq!(smoother.update(10.0), 10.0); // the first sample seeds the average
assert_eq!(smoother.update(0.0), 5.0); // then each output blends halfwayImplementations§
Trait Implementations§
impl Copy for Smoother
impl StructuralPartialEq for Smoother
Auto Trait Implementations§
impl Freeze for Smoother
impl RefUnwindSafe for Smoother
impl Send for Smoother
impl Sync for Smoother
impl Unpin for Smoother
impl UnsafeUnpin for Smoother
impl UnwindSafe for Smoother
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more