[][src]Struct filter::gh::GHFilter

pub struct GHFilter<T> {
    pub g: T,
    pub h: T,
    pub dt: T,
    pub xt: T,
    pub dxt: T,
    pub x_p: T,
    pub dx_p: T,
}

A g-h filter.

Example

use filter::gh::GHFilter;
use assert_approx_eq::assert_approx_eq;

let mut fgh: GHFilter<f32> = GHFilter::new(0.0, 0.0, 0.8, 0.2, 1.0);
assert_approx_eq!(0.8, fgh.update(1.0));
assert_approx_eq!(0.2, fgh.dxt);

fgh.g = 1.0;
fgh.h = 0.01;
assert_approx_eq!(2.0, fgh.update(2.0));

References

  • Labbe, "Kalman and Bayesian Filters in Python" http://rlabbe.github.io/Kalman-and-Bayesian-Filters-in-Python
  • Brookner, "Tracking and Kalman Filters Made Easy". John Wiley and Sons, 1998.

Fields

g: T

Filter g gain parameter.

h: T

Filter h gain parameter.

dt: T

Timestep (time between sample)

xt: T

State of the filter.

dxt: T

Derivative of the filter state.

x_p: T

Predicted filter state.

dx_p: T

Predicted derivative of the filter state.

Methods

impl<T: FloatCore> GHFilter<T>[src]

pub fn new(x0: T, dx0: T, g: T, h: T, dt: T) -> GHFilter<T>[src]

Returns a g-h filter with the given initialisation parameters.

Arguments

  • x0 - initial value for the filter state.
  • dx0 - initial value for the derivative of the filter state.
  • g - filter g gain parameter.
  • h - filter h gain parameter.
  • dt - time between samples.

Example

use filter::gh::GHFilter;
let fgh = GHFilter::new(0.0, 0.0, 0.2 ,0.2, 0.01);

pub fn update(&mut self, z: T) -> T[src]

Performs the g-h filter predict and update step on the given measurement z. Returns the new state of x.

pub fn vrf(&self) -> (T, T)[src]

Returns the Variance Reduction Factor (VRF) of the state variable of the filter (x) and its derivatives (dx, ddx).

pub fn vrf_prediction(&self) -> T[src]

Returns the Variance Reduction Factor of the prediction step of the filter.

References

  • Asquith, "Weight Selection in First Order Linear Filters" Report No RG-TR-69-12, U.S. Army Missle Command. Redstone Arsenal, Al. November 24, 1970.

Trait Implementations

impl<T: Debug> Debug for GHFilter<T>[src]

Auto Trait Implementations

impl<T> Sync for GHFilter<T> where
    T: Sync

impl<T> Send for GHFilter<T> where
    T: Send

impl<T> Unpin for GHFilter<T> where
    T: Unpin

impl<T> RefUnwindSafe for GHFilter<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for GHFilter<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>,