|
EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
|
The square-root information filter: a KalmanFilter whose state is a SqrtInfoGaussianParams, the data array \( [\,R \;\; r\,] \) about a reference (decisions.md [gaussian-forms]). More...
#include <EmrysFilter/Filters/SqrtInfoFilter.h>
Public Types | |
| using | Base |
| the filter this is | |
| Public Types inherited from Emrys::KalmanFilter< Component_, Model_, Method_, Recursion_, Upkeep_ > | |
| using | Scalar = typename Params<Component_>::Scalar |
| the scalar type | |
| using | SpaceType = typename Params<Component_>::SpaceType |
| the state space | |
| using | ModelType = Model_ |
| the process model | |
| using | MethodType = Method_ |
| the prediction method | |
| using | StateType = Params<Component_> |
| the state the filter owns | |
| using | RecursionType = Recursion_ |
| the steps it runs (see Recursion) | |
Public Member Functions | |
| SqrtInfoFilter (Model_ model, SqrtInfoGaussianParams< Space_, Scalar_ > state, MethodFor< Model_, Method_ > method={}, std::type_identity_t< Upkeep_ > upkeep={}) | |
| A filter with process model model, initial state state, and prediction method method; a fixed-step model carries its own, so there is none to give. | |
| SqrtInfoFilter (Model_ model, SqrtInfoGaussianParams< Space_, Scalar_ > state, std::type_identity_t< Upkeep_ > upkeep) | |
| A filter with process model model, initial state state, the default prediction method, and upkeep upkeep, which maintain() runs. | |
| Public Member Functions inherited from Emrys::KalmanFilter< Component_, Model_, Method_, Recursion_, Upkeep_ > | |
| KalmanFilter (Model_ model, Params< Component_ > state, MethodFor< Model_, Method_ > method={}, std::type_identity_t< Upkeep_ > upkeep={}) | |
| A filter with process model model, initial state state, prediction method method, and upkeep upkeep, which maintain() runs; a fixed-step model carries its own method, so there is none to give. | |
| KalmanFilter (Model_ model, Params< Component_ > state, std::type_identity_t< Upkeep_ > upkeep) | |
| A filter with process model model, initial state state, the default prediction method, and upkeep upkeep, which maintain() runs. | |
| KalmanFilter (Recursion_ recursion, StateType state, std::type_identity_t< Upkeep_ > upkeep={}) | |
| A filter that runs recursion, the library's or one of the user's own (see Recursion), on the initial state state, whose space the recursion's model must partition, with upkeep upkeep, which maintain() runs. | |
| StateType const & | state () const |
| StateType & | state () |
| void | setState (StateType state) |
| Replaces the state estimate, as when reinitializing, with one whose space the process model's writes partition, as the constructor's must. | |
| RecursionType const & | recursion () const |
| Model_ const & | model () const |
| Model_ & | model () |
| Method_ const & | method () const |
| template<typename... Inputs> requires (!isFixedStep<Model_>) | |
| 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, with inputs passed to its model as in Emrys::predict(): an uncertain input carries its uncertainty through the dynamics, and anything else is known. | |
|
template<typename... Inputs> requires (isFixedStep<Model_> && !internal::leadsWithSteps<Inputs...>) | |
| auto | predict (Inputs const &... inputs) |
| Moves the state forward by the fixed-step model's step, with inputs passed as in Emrys::predict(), returning as predict(dt, inputs...) does. | |
| template<typename... Inputs> requires isFixedStep<Model_> | |
| auto | predict (Steps steps, Inputs const &... inputs) |
| Moves the state forward by steps of the fixed-step model, as that many calls of predict(inputs...) do, with inputs at every step. | |
| template<typename... Inputs> requires (!isFixedStep<Model_> && !IsForm) | |
| PredictedJoint< SpaceType, Scalar > | predictJoint (TimeStep< Scalar > auto const &dt, Inputs const &... inputs) |
| Moves the state forward as predict(dt, inputs...) does. | |
| template<typename... Inputs> requires (isFixedStep<Model_> && !IsForm && !internal::leadsWithSteps<Inputs...>) | |
| PredictedJoint< SpaceType, Scalar > | predictJoint (Inputs const &... inputs) |
| Moves the state forward as predict(inputs...) does with a fixed-step model. | |
| template<Measurement M, typename Policy = reductions::Collapse> requires (!internal::isLinearizedAbout<Policy>) | |
| auto | update (M const &measurement, Policy const &policy={}) |
| Conditions the state on measurement, by the measurement's own method, and reduces the branches to the new state with policy, a ReductionPolicy to the component (Collapse, Select, or a Gate). | |
| template<Measurement M, typename Reference, typename Policy = reductions::Collapse> | |
| auto | update (M const &measurement, LinearizedAbout< Reference > const &about, Policy const &policy={}) |
| Conditions the state on measurement as update(measurement, policy) does, with the measurement linearized about about, a point or a distribution (see linearizedAbout()), rather than at the state (decisions.md [linearization-reference]): a shadow filter's update about another filter's state, which with predict(dt, about) runs the shadow's whole step about it. | |
| template<Measurement M, typename Policy, typename Result> requires (!internal::isLinearizedAbout<Policy>) | |
| std::expected< void, GaussianError > | update (M const &measurement, Policy const &policy, Result &result) |
As update(measurement, policy), but into result, the update inside the std::expected that update() returns, whose storage is reused: with the same result at every step, an update under mixture noise, whose branches are a run-time count, allocates nothing once the result has held as many (see Allocation). | |
| template<Measurement M, typename Reference, typename Policy, typename Result> | |
| std::expected< void, GaussianError > | update (M const &measurement, LinearizedAbout< Reference > const &about, Policy const &policy, Result &result) |
| As update(measurement, about, policy), but into result, as update(measurement, policy, result) fills it. | |
The square-root information filter: a KalmanFilter whose state is a SqrtInfoGaussianParams, the data array \( [\,R \;\; r\,] \) about a reference (decisions.md [gaussian-forms]).
The filter of Bierman (1977), with the update as given in Ke et al. (2024), §II. The update stacks the whitened rows of the measurement's statistical linearization [covariance-update-forms] under the data array and triangularizes, which never forms a precision or a covariance; the residual it leaves is the innovation's NIS. Whitening needs $ S_0 $ positive definite, and the update returns GaussianError::NotPositiveDefinite where it is not [innovation-cholesky]. Under Linearized the prediction runs the time update through the inverse of the step's Jacobian, so it starts from a state with no information at all ( \( R = 0 \)), where InfoFilter cannot predict, and fails instead on a singular Jacobian; a sigma-point prediction, and a sigma-point update, go through the moments and return GaussianError::Singular while the state has no information in some direction. Each step returns a std::expected. Measurement noise has one component and the policy is Collapse; there is no predictJoint().
It is the KalmanFilter it names with nothing added, as a derived class rather than an alias so that its arguments deduce on every compiler [filters-and-recursions]: SqrtInfoFilter filter{model, toSqrtInfo(initial).value()}.
| Space_ | the state space (see Spaces) |
| Model_ | the process model, a ProcessModel or a FixedStepModel |
| Method_ | the prediction method; a FixedStepModel's own |
| Scalar_ | scalar type, double by default |
| Upkeep_ | the upkeep maintain() runs on the state (see Upkeep), upkeep::None unless given one; RepairCovariance does not apply to this form |
| using Emrys::SqrtInfoFilter< Space_, Model_, Method_, Scalar_, Upkeep_ >::Base |
the filter this is
|
inline |
A filter with process model model, initial state state, and prediction method method; a fixed-step model carries its own, so there is none to give.
Declared rather than inherited so that only the deduction guide below deduces the filter's arguments.