Trait adskalman::ObservationModel
source · pub trait ObservationModel<R, SS, OS>where
R: RealField,
SS: DimName,
OS: DimName + DimMin<OS, Output = OS>,
DefaultAllocator: Allocator<R, SS, SS> + Allocator<R, SS> + Allocator<R, OS, SS> + Allocator<R, SS, OS> + Allocator<R, OS, OS> + Allocator<R, OS> + Allocator<(usize, usize), OS>,{
// Required methods
fn H(&self) -> &OMatrix<R, OS, SS>;
fn HT(&self) -> &OMatrix<R, SS, OS>;
fn R(&self) -> &OMatrix<R, OS, OS>;
// Provided methods
fn predict_observation(&self, state: &OVector<R, SS>) -> OVector<R, OS> { ... }
fn update(
&self,
prior: &StateAndCovariance<R, SS>,
observation: &OVector<R, OS>,
covariance_method: CovarianceUpdateMethod
) -> Result<StateAndCovariance<R, SS>, Error> { ... }
fn observation_matrix(&self) -> &OMatrix<R, OS, SS> { ... }
fn observation_matrix_transpose(&self) -> &OMatrix<R, SS, OS> { ... }
fn observation_noise_covariance(&self) -> &OMatrix<R, OS, OS> { ... }
fn evaluate(&self, state: &OVector<R, SS>) -> OVector<R, OS> { ... }
}
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: &OVector<R, SS>) -> OVector<R, OS>
fn predict_observation(&self, state: &OVector<R, SS>) -> OVector<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: &OVector<R, OS>,
covariance_method: CovarianceUpdateMethod
) -> Result<StateAndCovariance<R, SS>, Error>
fn update( &self, prior: &StateAndCovariance<R, SS>, observation: &OVector<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.
sourcefn observation_matrix(&self) -> &OMatrix<R, OS, SS>
👎Deprecated since 0.8.0: Please use the H function instead
fn observation_matrix(&self) -> &OMatrix<R, OS, SS>
Get the observation matrix, H
.
sourcefn observation_matrix_transpose(&self) -> &OMatrix<R, SS, OS>
👎Deprecated since 0.8.0: Please use the HT function instead
fn observation_matrix_transpose(&self) -> &OMatrix<R, SS, OS>
Get the transpose of the observation matrix, HT
.
sourcefn observation_noise_covariance(&self) -> &OMatrix<R, OS, OS>
👎Deprecated since 0.8.0: Please use the R function instead
fn observation_noise_covariance(&self) -> &OMatrix<R, OS, OS>
Get the observation noise covariance, R
.
sourcefn evaluate(&self, state: &OVector<R, SS>) -> OVector<R, OS>
👎Deprecated since 0.8.0: Please use the predict_observation function instead
fn evaluate(&self, state: &OVector<R, SS>) -> OVector<R, OS>
For a given state, predict the observation.
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.