Skip to main content

EkfModel

Trait EkfModel 

Source
pub trait EkfModel<const N: usize, const M: usize> {
    // Required methods
    fn f(&self, x: &[f32; N], dt: f32, out: &mut [f32; N]);
    fn h(&self, x: &[f32; N], out: &mut [f32; M]);
    fn jacobian_f(&self, x: &[f32; N], dt: f32, out: &mut [[f32; N]; N]);
    fn jacobian_h(&self, x: &[f32; N], out: &mut [[f32; N]; M]);

    // Provided methods
    fn f_with_input<const U: usize>(
        &self,
        x: &[f32; N],
        u: &[f32; U],
        dt: f32,
        out: &mut [f32; N],
    ) { ... }
    fn jacobian_f_with_input<const U: usize>(
        &self,
        x: &[f32; N],
        u: &[f32; U],
        dt: f32,
        out: &mut [[f32; N]; N],
    ) { ... }
    fn h_with_input<const U: usize>(
        &self,
        x: &[f32; N],
        u: &[f32; U],
        out: &mut [f32; M],
    ) { ... }
    fn jacobian_h_with_input<const U: usize>(
        &self,
        x: &[f32; N],
        u: &[f32; U],
        out: &mut [[f32; N]; M],
    ) { ... }
}
Expand description

User-supplied nonlinear process and measurement model for an EKF (static dispatch).

Required Methods§

Source

fn f(&self, x: &[f32; N], dt: f32, out: &mut [f32; N])

Process model: out = f(x, dt).

Source

fn h(&self, x: &[f32; N], out: &mut [f32; M])

Measurement model: out = h(x).

Source

fn jacobian_f(&self, x: &[f32; N], dt: f32, out: &mut [[f32; N]; N])

Process Jacobian F = ∂f/∂x evaluated at x.

Source

fn jacobian_h(&self, x: &[f32; N], out: &mut [[f32; N]; M])

Measurement Jacobian H = ∂h/∂x evaluated at x (M×N).

Provided Methods§

Source

fn f_with_input<const U: usize>( &self, x: &[f32; N], u: &[f32; U], dt: f32, out: &mut [f32; N], )

Process model with an explicit exogenous input u (a control input, measured disturbance, or anything else that drives f but isn’t part of the state): out = f(x, u, dt).

Default: ignores u and defers to EkfModel::f, so models that don’t need an input compile unchanged.

Source

fn jacobian_f_with_input<const U: usize>( &self, x: &[f32; N], u: &[f32; U], dt: f32, out: &mut [[f32; N]; N], )

Process Jacobian for EkfModel::f_with_input, F = ∂f/∂x evaluated at (x, u).

Default: defers to EkfModel::jacobian_f, which is exact whenever u enters f affinely (so it doesn’t change the derivative with respect to x).

Source

fn h_with_input<const U: usize>( &self, x: &[f32; N], u: &[f32; U], out: &mut [f32; M], )

Measurement model with an explicit exogenous input u (e.g. a measured current used for an IR-drop correction that isn’t part of the state): out = h(x, u).

Default: ignores u and defers to EkfModel::h.

Source

fn jacobian_h_with_input<const U: usize>( &self, x: &[f32; N], u: &[f32; U], out: &mut [[f32; N]; M], )

Measurement Jacobian for EkfModel::h_with_input, H = ∂h/∂x evaluated at (x, u).

Default: defers to EkfModel::jacobian_h, which is exact whenever u enters h affinely.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§