pub struct KF<T, A, M>where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,{
pub prev_estimate: KfEstimate<T>,
pub measurement_noise: OMatrix<f64, M, M>,
pub process_noise: Vec<SNC<A>>,
pub ekf: bool,
/* private fields */
}
Expand description
Defines both a Classical and an Extended Kalman filter (CKF and EKF) T: Type of state A: Acceleration size (for SNC) M: Measurement size (used for the sensitivity matrix)
Fields§
§prev_estimate: KfEstimate<T>
The previous estimate used in the KF computations.
measurement_noise: OMatrix<f64, M, M>
Sets the Measurement noise (usually noted R)
process_noise: Vec<SNC<A>>
A sets of process noise (usually noted Q), must be ordered chronologically
ekf: bool
Determines whether this KF should operate as a Conventional/Classical Kalman filter or an Extended Kalman Filter. Recall that one should switch to an Extended KF only once the estimate is good (i.e. after a few good measurement updates on a CKF).
Implementations§
source§impl<T, A, M> KF<T, A, M>where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, A> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
impl<T, A, M> KF<T, A, M>where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, A> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
sourcepub fn new(
initial_estimate: KfEstimate<T>,
process_noise: SNC<A>,
measurement_noise: OMatrix<f64, M, M>
) -> Self
pub fn new( initial_estimate: KfEstimate<T>, process_noise: SNC<A>, measurement_noise: OMatrix<f64, M, M> ) -> Self
Initializes this KF with an initial estimate, measurement noise, and one process noise
sourcepub fn with_sncs(
initial_estimate: KfEstimate<T>,
process_noises: Vec<SNC<A>>,
measurement_noise: OMatrix<f64, M, M>
) -> Self
pub fn with_sncs( initial_estimate: KfEstimate<T>, process_noises: Vec<SNC<A>>, measurement_noise: OMatrix<f64, M, M> ) -> Self
Initializes this KF with an initial estimate, measurement noise, and several process noise WARNING: SNCs MUST be ordered chronologically! They will be selected automatically by walking the list of SNCs backward until one can be applied!
source§impl<T, M> KF<T, U3, M>where
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + Allocator<f64, <T as State>::Size, <T as State>::Size> + Allocator<f64, U3, U3> + Allocator<f64, <T as State>::Size, U3> + Allocator<f64, U3, <T as State>::Size> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
impl<T, M> KF<T, U3, M>where
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + Allocator<f64, <T as State>::Size, <T as State>::Size> + Allocator<f64, U3, U3> + Allocator<f64, <T as State>::Size, U3> + Allocator<f64, U3, <T as State>::Size> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
sourcepub fn no_snc(
initial_estimate: KfEstimate<T>,
measurement_noise: OMatrix<f64, M, M>
) -> Self
pub fn no_snc( initial_estimate: KfEstimate<T>, measurement_noise: OMatrix<f64, M, M> ) -> Self
Initializes this KF without SNC
Trait Implementations§
source§impl<T, A, M> Clone for KF<T, A, M>where
A: DimName + Clone,
M: DimName + Clone,
T: State + Clone,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
impl<T, A, M> Clone for KF<T, A, M>where
A: DimName + Clone,
M: DimName + Clone,
T: State + Clone,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
source§impl<T, A, M> Debug for KF<T, A, M>where
A: DimName + Debug,
M: DimName + Debug,
T: State + Debug,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
impl<T, A, M> Debug for KF<T, A, M>where
A: DimName + Debug,
M: DimName + Debug,
T: State + Debug,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
source§impl<T, A, M> Filter<T, A, M> for KF<T, A, M>where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, A> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size> + Allocator<f64, Const<1>, M>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
impl<T, A, M> Filter<T, A, M> for KF<T, A, M>where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator<f64, M> + Allocator<f64, <T as State>::Size> + Allocator<f64, <T as State>::VecLength> + Allocator<f64, A> + Allocator<f64, M, M> + Allocator<f64, M, <T as State>::Size> + Allocator<f64, <T as State>::Size, M> + 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> + Allocator<usize, <T as State>::Size> + Allocator<usize, <T as State>::Size, <T as State>::Size> + Allocator<f64, Const<1>, M>,
<DefaultAllocator as Allocator<f64, <T as State>::Size>>::Buffer: Copy,
<DefaultAllocator as Allocator<f64, <T as State>::Size, <T as State>::Size>>::Buffer: Copy,
source§fn previous_estimate(&self) -> &Self::Estimate
fn previous_estimate(&self) -> &Self::Estimate
Returns the previous estimate
source§fn update_h_tilde(&mut self, h_tilde: OMatrix<f64, M, <T as State>::Size>)
fn update_h_tilde(&mut self, h_tilde: OMatrix<f64, M, <T as State>::Size>)
Update the sensitivity matrix (or “H tilde”). This function must be called prior to each
call to measurement_update
.
source§fn time_update(&mut self, nominal_state: T) -> Result<Self::Estimate, ODError>
fn time_update(&mut self, nominal_state: T) -> Result<Self::Estimate, ODError>
Computes a time update/prediction (i.e. advances the filter estimate with the updated STM).
May return a FilterError if the STM was not updated.
source§fn measurement_update(
&mut self,
nominal_state: T,
real_obs: &OVector<f64, M>,
computed_obs: &OVector<f64, M>,
resid_ratio_check: Option<f64>
) -> Result<(Self::Estimate, Residual<M>), ODError>
fn measurement_update( &mut self, nominal_state: T, real_obs: &OVector<f64, M>, computed_obs: &OVector<f64, M>, resid_ratio_check: Option<f64> ) -> Result<(Self::Estimate, Residual<M>), ODError>
Computes the measurement update with a provided real observation and computed observation.
May return a FilterError if the STM or sensitivity matrices were not updated.
source§fn set_process_noise(&mut self, snc: SNC<A>)
fn set_process_noise(&mut self, snc: SNC<A>)
Overwrites all of the process noises to the one provided
type Estimate = KfEstimate<T>
source§fn measurement_noise(&self, _epoch: Epoch) -> &OMatrix<f64, M, M>
fn measurement_noise(&self, _epoch: Epoch) -> &OMatrix<f64, M, M>
source§fn set_previous_estimate(&mut self, est: &Self::Estimate)
fn set_previous_estimate(&mut self, est: &Self::Estimate)
source§fn is_extended(&self) -> bool
fn is_extended(&self) -> bool
source§fn set_extended(&mut self, status: bool)
fn set_extended(&mut self, status: bool)
Auto Trait Implementations§
impl<T, A, M> !Freeze for KF<T, A, M>
impl<T, A, M> !RefUnwindSafe for KF<T, A, M>
impl<T, A, M> !Send for KF<T, A, M>
impl<T, A, M> !Sync for KF<T, A, M>
impl<T, A, M> !Unpin for KF<T, A, M>
impl<T, A, M> !UnwindSafe for KF<T, A, M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.