EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ > Class Template Reference

A process model over one fixed time step, with the work that depends only on the step done once. More...

#include <EmrysFilter/Models/ProcessModel.h>

Public Types

using Scalar = Scalar_
 the scalar type
using SpaceType = Space_
 the state space
using ModelType = Model_
 the process model taken over the step
using MethodType = Method_
 the prediction method
using MatrixType = typename Moments<Space_, Scalar_>::MatrixType
 \( F \) and \( Q \), over differences

Public Member Functions

 FixedStepModel (Model_ model, Space_ const &space, TimeStep< Scalar_ > auto const &dt, Method_ method={})
 model taken over the step dt in space, predicting by method.
template<TimeStep< Scalar_ > Time>
 FixedStepModel (UnboundFixedStep< Model_, Method_, Time > const &step)
 step bound to the space Space_, which is fixed-size and so has one instance: how a filter given fixedStep(model, dt) makes its model.
Model_ const & model () const
Method_ const & method () const
Scalar_ timeStep () const
MatrixType const & noise () const
MatrixType const & transition () const
MatrixType const & noiseRoot () const
std::optional< MatrixType > const & transitionInverse () const
template<typename Derived>
requires ReadsOnlyState
Moments< Space_, typenameDerived::Scalar >::VectorType propagate (Space_ const &space, Eigen::MatrixBase< Derived > const &x) const
bool partitions (Space_ const &space) const

Static Public Member Functions

template<typename Space>
static consteval internal::StaticPartition staticPartition ()

Static Public Attributes

static constexpr bool ReadsOnlyState = internal::readsOnlyState<Model_, Space_>()
 whether the model reads blocks of the state alone, so a step needs no input of the call
static constexpr bool CachesTransition
 Whether the model caches the transition: under Linearized, for a model that is affine in everything it reads, returns its Jacobian, and reads no input of the call, so that the Jacobian of its step is the same at every state.

Detailed Description

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
class Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >

A process model over one fixed time step, with the work that depends only on the step done once.

Model_, a ProcessModel, is taken over the step dt, by Method_, in Space_. The process noise \( Q \) is computed at construction. Under the Linearized method the transition \( F \) is too, when the model is affine in everything it reads, returns its Jacobian, and reads no input of the call, as the built-in models are. Otherwise, and under the other methods, which depend on the state, the model caches only \( Q \).

Its predictions take no time step: predict(prior, model, args...), and a filter that owns one has predict(args...) in place of predict(dt, args...). The model carries the prediction method, so a filter that owns one takes its method from it. The model doesn't change after construction; to change its step or its parameters, assign a new one.

A filter given fixedStep(model, dt) makes the one over its state's space, so the space is named by the state alone:

auto filter = KalmanFilter{fixedStep(ConstantVelocity<Position, Velocity>{0.1}, 0.01), initial};
filter.predict();
A Kalman filter: a Gaussian state and the KalmanRecursion that predicts it through a process model an...
Definition KalmanFilter.h:561
auto predict(TimeStep< Scalar > auto const &dt, Inputs const &... inputs)
Moves the state forward by dt, any TimeStep (see Time steps), through the process model,...
Definition KalmanFilter.h:681
UnboundFixedStep< Model, Method, Time > fixedStep(Model model, Time dt, Method method={})
Definition ProcessModel.h:3736
Kinematic< Scalar, Position, Velocity > ConstantVelocity
Constant velocity (white-noise acceleration): position moves by velocity times .
Definition ProcessModel.h:1152

Built directly, FixedStepModel{model, space, dt}, it gives its cached matrices to read.

With \( F \) and \( Q \) fixed, an affine model's prediction is the time-invariant case of Kalman (1960): \( \mu' = F \mu \) and \( P' = F P F^T + Q \).

Template Parameters
Space_the state space (see Spaces)
Model_the process model, which writes every block of the space
Method_the prediction method, Linearized by default
Scalar_scalar type of the cached matrices, double by default
See also
fixedStep(), UnboundFixedStep, processModel(), isFixedStep, Models

Constructor & Destructor Documentation

◆ FixedStepModel() [1/2]

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::FixedStepModel ( Model_ model,
Space_ const & space,
TimeStep< Scalar_ > auto const & dt,
Method_ method = {} )
inline

model taken over the step dt in space, predicting by method.

The step is any TimeStep, converted once to Scalar_ (see Time steps).

◆ FixedStepModel() [2/2]

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
template<TimeStep< Scalar_ > Time>
Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::FixedStepModel ( UnboundFixedStep< Model_, Method_, Time > const & step)
inline

step bound to the space Space_, which is fixed-size and so has one instance: how a filter given fixedStep(model, dt) makes its model.

Implicit, so that a filter's constructor takes the step where its deduction guide names this type.

Member Function Documentation

◆ method()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
Method_ const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::method ( ) const
inlinenodiscard
Returns
the prediction method

◆ model()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
Model_ const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::model ( ) const
inlinenodiscard
Returns
the process model taken over the step

◆ noise()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
MatrixType const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::noise ( ) const
inlinenodiscard
Returns
the process noise \( Q \) over the step, over the space's differences

◆ noiseRoot()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
MatrixType const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::noiseRoot ( ) const
inlinenodiscard
Returns
a factor \( G \) of the noise, \( G G^T = Q \), computed once (see internal::defaultRoot()): what the square-root forms add the noise through, so a fixed step factorizes it once rather than on every prediction

◆ partitions()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
bool Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::partitions ( Space_ const & space) const
inlinenodiscard
Returns
whether the model writes every coordinate of space once and its matrices fit it

◆ propagate()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
template<typename Derived>
requires ReadsOnlyState
Moments< Space_, typenameDerived::Scalar >::VectorType Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::propagate ( Space_ const & space,
Eigen::MatrixBase< Derived > const & x ) const
inlinenodiscard
Returns
the state x in space moved forward by the step, for a model that reads blocks of the state alone. Not normalized. With inputs of the call, Emrys::propagate() over model() and timeStep().

◆ staticPartition()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
template<typename Space>
consteval internal::StaticPartition Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::staticPartition ( )
inlinestaticnodiscardconsteval
Returns
what the process model's types say about whether it writes every coordinate of Space once, as its staticPartition()

◆ timeStep()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
Scalar_ Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::timeStep ( ) const
inlinenodiscard
Returns
the time step \( \Delta t \), in the filter's scalar (see Time steps)

◆ transition()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
MatrixType const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::transition ( ) const
inlinenodiscard
Returns
the transition \( F \) over the step, over the space's differences

◆ transitionInverse()

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
std::optional< MatrixType > const & Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::transitionInverse ( ) const
inlinenodiscard
Returns
the inverse of the transition, computed once, or nothing if the transition is singular: what the square-root information form predicts through

Member Data Documentation

◆ CachesTransition

template<Space Space_, typename Model_, typename Method_ = methods::Linearized, RealScalar Scalar_ = double>
bool Emrys::FixedStepModel< Space_, Model_, Method_, Scalar_ >::CachesTransition
staticconstexpr
Initial value:
= std::is_same_v<Method_, methods::Linearized> && ReadsOnlyState
&& internal::returnsStepJacobianIn<Model_, Space_, Scalar_>
&& internal::affineInEverything<Model_>()
static constexpr bool ReadsOnlyState
whether the model reads blocks of the state alone, so a step needs no input of the call
Definition ProcessModel.h:3545

Whether the model caches the transition: under Linearized, for a model that is affine in everything it reads, returns its Jacobian, and reads no input of the call, so that the Jacobian of its step is the same at every state.


The documentation for this class was generated from the following file: