pub trait ObservationModel<R, SS, OS>where
R: RealField,
SS: Dim,
OS: Dim + DimMin<OS, Output = OS>,
DefaultAllocator: Allocator<SS, SS> + Allocator<SS> + Allocator<OS, SS> + Allocator<SS, OS> + Allocator<OS, OS> + Allocator<OS>,
Matrix<R, SS, SS, Owned<R, SS, SS>>: One,{
// Required methods
fn H(&self) -> &Matrix<R, OS, SS, Owned<R, OS, SS>>;
fn HT(&self) -> &Matrix<R, SS, OS, Owned<R, SS, OS>>;
fn R(&self) -> &Matrix<R, OS, OS, Owned<R, OS, OS>>;
// Provided methods
fn predict_observation(
&self,
state: &Vector<R, SS, Owned<R, SS>>,
) -> Vector<R, OS, Owned<R, OS>> { ... }
fn update(
&self,
prior: &StateAndCovariance<R, SS>,
observation: &Vector<R, OS, Owned<R, OS>>,
covariance_method: CovarianceUpdateMethod,
) -> Result<StateAndCovariance<R, SS>, Error> { ... }
}Expand description
An observation model, potentially non-linear.
To use a non-linear observation model, the non-linear model must be
linearized (e.g. using the prior state estimate) and use this linearization
as the basis for a ObservationModel implementation. This would be done
every timestep. For an example, see
nonlinear_observation.rs.
Required Methods§
Provided Methods§
Sourcefn predict_observation(
&self,
state: &Vector<R, SS, Owned<R, SS>>,
) -> Vector<R, OS, Owned<R, OS>>
fn predict_observation( &self, state: &Vector<R, SS, Owned<R, SS>>, ) -> Vector<R, OS, Owned<R, OS>>
For a given state, predict the observation.
The default implementation implements a linear observation model, namely
y = Hx where y is the predicted observation, H is the observation
matrix, and x is the state. For a non-linear observation model, any
implementation of this trait should provide an implementation of this
method.
If an observation is not possible, this returns NaN values. (This happens, for example, when a non-linear observation model implements this trait and must be evaluated for a state for which no observation is possible.) Observations with NaN values are treated as missing observations.
Sourcefn update(
&self,
prior: &StateAndCovariance<R, SS>,
observation: &Vector<R, OS, Owned<R, OS>>,
covariance_method: CovarianceUpdateMethod,
) -> Result<StateAndCovariance<R, SS>, Error>
fn update( &self, prior: &StateAndCovariance<R, SS>, observation: &Vector<R, OS, Owned<R, OS>>, covariance_method: CovarianceUpdateMethod, ) -> Result<StateAndCovariance<R, SS>, Error>
Given prior state and observation, estimate the posterior state.
This is the update step in the Kalman filter literature.