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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
extern crate hyperdual;
extern crate rand;
extern crate rand_distr;
extern crate serde;
use crate::dimensions::allocator::Allocator;
use crate::dimensions::{DefaultAllocator, DimName, MatrixMN, VectorN};
pub use crate::dynamics::{Dynamics, NyxError};
use crate::time::Epoch;
use crate::{State, TimeTagged};
use crate::io::{CovarFormat, EpochFormat};
pub mod kalman;
pub mod ranging;
pub mod estimate;
pub mod residual;
pub mod ui;
pub mod snc;
pub trait Filter<T, A, M>
where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M>
+ Allocator<f64, <T as State>::Size>
+ Allocator<f64, A>
+ Allocator<f64, M, M>
+ Allocator<f64, M, <T as State>::Size>
+ Allocator<f64, <T as State>::Size, <T as State>::Size>
+ Allocator<f64, A, A>
+ Allocator<f64, <T as State>::Size, A>
+ Allocator<f64, A, <T as State>::Size>,
{
type Estimate: estimate::Estimate<T>;
fn previous_estimate(&self) -> &Self::Estimate;
fn set_previous_estimate(&mut self, est: &Self::Estimate);
fn update_stm(&mut self, new_stm: MatrixMN<f64, <T as State>::Size, <T as State>::Size>);
fn update_h_tilde(&mut self, h_tilde: MatrixMN<f64, M, <T as State>::Size>);
fn time_update(&mut self, nominal_state: T) -> Result<Self::Estimate, NyxError>;
fn measurement_update(
&mut self,
nominal_state: T,
real_obs: &VectorN<f64, M>,
computed_obs: &VectorN<f64, M>,
) -> Result<(Self::Estimate, residual::Residual<M>), NyxError>;
fn is_extended(&self) -> bool;
fn set_extended(&mut self, status: bool);
fn set_process_noise(&mut self, snc: snc::SNC<A>);
}
pub trait Measurement: TimeTagged
where
Self: Sized,
DefaultAllocator: Allocator<f64, Self::MeasurementSize>
+ Allocator<f64, Self::MeasurementSize, Self::StateSize>,
{
type StateSize: DimName;
type MeasurementSize: DimName;
fn observation(&self) -> VectorN<f64, Self::MeasurementSize>
where
DefaultAllocator: Allocator<f64, Self::MeasurementSize>;
fn sensitivity(&self) -> MatrixMN<f64, Self::MeasurementSize, Self::StateSize>
where
DefaultAllocator: Allocator<f64, Self::StateSize, Self::MeasurementSize>;
fn visible(&self) -> bool;
}
pub trait MeasurementDevice<MsrIn, Msr>
where
Self: Sized,
Msr: Measurement,
DefaultAllocator: Allocator<f64, Msr::StateSize>
+ Allocator<f64, Msr::MeasurementSize>
+ Allocator<f64, Msr::MeasurementSize, Msr::StateSize>,
{
fn measure(&self, input: &MsrIn) -> Option<Msr>;
}
pub trait EstimateFrom<O: State>
where
Self: State,
DefaultAllocator: Allocator<f64, <O as State>::Size>
+ Allocator<f64, <O as State>::Size, <O as State>::Size>
+ Allocator<f64, Self::Size>
+ Allocator<f64, Self::Size, Self::Size>,
{
fn extract(from: &O) -> Self;
fn add_dev(to: &O, dev: VectorN<f64, Self::Size>) -> O;
}