1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#![allow(non_snake_case)]
use nalgebra as na;
use na::{allocator::Allocator, DefaultAllocator, Dim, OMatrix, OVector};
use na::{SimdRealField};
use crate::noise::CorrelatedNoise;
#[derive(PartialEq, Clone)]
pub struct KalmanState<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
pub x: OVector<N, D>,
pub X: OMatrix<N, D, D>,
}
#[derive(PartialEq, Clone)]
pub struct InformationState<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D>,
{
pub i: OVector<N, D>,
pub I: OMatrix<N, D, D>,
}
pub trait Estimator<N: SimdRealField, D: Dim>
where
DefaultAllocator: Allocator<N, D>,
{
fn state(&self) -> Result<OVector<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: &OVector<N, D>,
Fx: &OMatrix<N, D, 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: &OVector<N, ZD>,
Hx: &OMatrix<N, ZD, D>,
noise: &CorrelatedNoise<N, ZD>,
) -> Result<(), &'static str>;
}