#![allow(non_snake_case)]
use nalgebra as na;
use na::{allocator::Allocator, DefaultAllocator, Dim, MatrixMN, MatrixN, VectorN};
use na::{SimdRealField};
pub use crate::noise::{CorrelatedNoise};
pub use crate::estimators::ud::UDState;
#[derive(PartialEq, Clone)]
pub struct KalmanState<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
pub x: VectorN<N, D>,
pub X: MatrixN<N, D>,
}
#[derive(PartialEq, Clone)]
pub struct InformationState<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
pub i: VectorN<N, D>,
pub I: MatrixN<N, D>,
}
pub trait Estimator<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D>,
{
fn state(&self) -> Result<VectorN<N, D>, &'static str>;
}
pub trait KalmanEstimator<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
fn init(&mut self, state: &KalmanState<N, D>) -> Result<(), &'static str>;
fn kalman_state(&self) -> Result<KalmanState<N, D>, &'static str>;
}
pub trait ExtendedLinearPredictor<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>
{
fn predict(
&mut self,
x_pred: &VectorN<N, D>,
Fx: &MatrixN<N, D>,
noise: &CorrelatedNoise<N, D>,
) -> Result<(), &'static str>;
}
pub trait FunctionPredictor<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>
{
fn predict(
&mut self,
f: fn(&VectorN<N, D>) -> VectorN<N, D>,
noise: &CorrelatedNoise<N, D>) -> Result<(), &'static str>;
}
pub trait ExtendedLinearObserver<N: SimdRealField, D: Dim, ZD: Dim>
where
DefaultAllocator:
Allocator<N, ZD, D> + Allocator<N, ZD, ZD> + Allocator<N, ZD>
{
fn observe_innovation(
&mut self,
s: &VectorN<N, ZD>,
Hx: &MatrixMN<N, ZD, D>,
noise: &CorrelatedNoise<N, ZD>,
) -> Result<(), &'static str>;
}
pub trait FunctionObserver<N: SimdRealField, D: Dim, ZD: Dim>
where
DefaultAllocator: Allocator<N, ZD, ZD> + Allocator<N, D> + Allocator<N, ZD>
{
fn observe_innovation(
&mut self,
z: &VectorN<N, ZD>,
h: fn(&VectorN<N, D>) -> VectorN<N, ZD>,
h_normalize: fn(&mut VectorN<N, D>, VectorN<N, D>),
noise: &CorrelatedNoise<N, ZD>)
-> Result<(), &'static str>;
}