#![allow(non_snake_case)]
use nalgebra::DMatrix;
pub struct FilterState {
pub x: Vec<f64>,
pub P: DMatrix<f64>,
}
pub struct UpdateResult {
pub updated: FilterState,
pub residual: Vec<f64>,
pub kalman_gain: Vec<Vec<f64>>,
pub innovation_cov: Vec<Vec<f64>>,
}
pub struct StepResult {
pub predicted: FilterState,
pub update: UpdateResult,
}
pub trait KalmanFilter {
fn predict(&mut self, dt: f64) -> FilterState;
fn update(&mut self, z: &[f64]) -> UpdateResult;
fn step(&mut self, dt: f64, z: &[f64]) -> StepResult;
fn predict_only(&mut self, dt: f64) -> FilterState;
fn state(&self) -> &[f64];
fn covariance(&self) -> &DMatrix<f64>;
fn jacobian(&self, x: &[f64], dt: f64) -> DMatrix<f64>;
}