Skip to main content

StateEstimation::KalmanFilterT

StateEstimation::KalmanFilterT

Fixed-size Kalman filter for tests and high-assurance contexts. More…

#include <KalmanFilterT.hpp>

Inherits from StateEstimation::IFilter

Public Types

Name
using Eigen::Matrix< double, StateDim, 1 > StateVec
using Eigen::Matrix< double, StateDim, StateDim > StateMat
using Eigen::Matrix< double, MeasDim, 1 > MeasVec
using Eigen::Matrix< double, MeasDim, StateDim > MeasMat
using Eigen::Matrix< double, MeasDim, MeasDim > MeasCov

Public Functions

Name
KalmanFilterT(StateMat const & F, MeasMat const & H, StateMat const & Q, MeasCov const & R, ContractPolicy policy =ContractPolicy::Throw)
virtual void initialize(FilterState const & initial_state) override
Initializes the filter with an initial state.
virtual FilterState predict() override
Predicts the next state based on the internal motion model.
virtual FilterState update(FilterState const & predicted_state, Measurement const & measurement) override
Updates (corrects) the filter’s state based on a new measurement.
virtual FilterState update(FilterState const & predicted_state, Measurement const & measurement, double noise_scale_factor) override
Updates the filter’s state with scaled measurement noise.
virtual std::vector< FilterState > smooth(std::vector< FilterState > const & forward_states) override
Performs Rauch-Tung-Striebel (RTS) smoothing on a sequence of states.
virtual FilterState getState() const override
Gets the current state of the filter.
virtual std::unique_ptr< IFilter > clone() const override
Clones the filter object.

Additional inherited members

Public Functions inherited from StateEstimation::IFilter

Name
virtual ~IFilter() =default

Detailed Description

template <int StateDim,
int MeasDim>
class StateEstimation::KalmanFilterT;

Fixed-size Kalman filter for tests and high-assurance contexts.

Provides compile-time sized state and measurement dimensions to catch shape errors early while conforming to the dynamic [IFilter](/api_generated/Classes/classStateEstimation_1_1IFilter.md) API.

Public Types Documentation

using StateVec

using StateEstimation::KalmanFilterT< StateDim, MeasDim >::StateVec =  Eigen::Matrix<double, StateDim, 1>;

using StateMat

using StateEstimation::KalmanFilterT< StateDim, MeasDim >::StateMat =  Eigen::Matrix<double, StateDim, StateDim>;

using MeasVec

using StateEstimation::KalmanFilterT< StateDim, MeasDim >::MeasVec =  Eigen::Matrix<double, MeasDim, 1>;

using MeasMat

using StateEstimation::KalmanFilterT< StateDim, MeasDim >::MeasMat =  Eigen::Matrix<double, MeasDim, StateDim>;

using MeasCov

using StateEstimation::KalmanFilterT< StateDim, MeasDim >::MeasCov =  Eigen::Matrix<double, MeasDim, MeasDim>;

Public Functions Documentation

function KalmanFilterT

inline KalmanFilterT(
    StateMat const & F,
    MeasMat const & H,
    StateMat const & Q,
    MeasCov const & R,
    ContractPolicy policy =ContractPolicy::Throw
)

function initialize

inline virtual void initialize(
    FilterState const & initial_state
) override

Initializes the filter with an initial state.

Parameters:

  • initial_state The starting state (mean and covariance) of the object to be tracked.

Reimplements: StateEstimation::IFilter::initialize

function predict

inline virtual FilterState predict() override

Predicts the next state based on the internal motion model.

Return: The predicted state (prior estimate).

Reimplements: StateEstimation::IFilter::predict

function update

inline virtual FilterState update(
    FilterState const & predicted_state,
    Measurement const & measurement
) override

Updates (corrects) the filter’s state based on a new measurement.

Parameters:

  • predicted_state The state predicted by the most recent call to [predict()](/api_generated/Classes/classStateEstimation_1_1KalmanFilterT.md#function-predict).
  • measurement The new observation, converted into a feature vector.

Return: The updated (corrected) state (posterior estimate).

Reimplements: StateEstimation::IFilter::update

function update

inline virtual FilterState update(
    FilterState const & predicted_state,
    Measurement const & measurement,
    double noise_scale_factor
) override

Updates the filter’s state with scaled measurement noise.

Parameters:

  • predicted_state The state predicted by the most recent call to [predict()](/api_generated/Classes/classStateEstimation_1_1KalmanFilterT.md#function-predict).
  • measurement The new observation, converted into a feature vector.
  • noise_scale_factor Factor to scale the measurement noise matrix R.

Return: The updated (corrected) state (posterior estimate).

Reimplements: StateEstimation::IFilter::update

function smooth

inline virtual std::vector< FilterState > smooth(
    std::vector< FilterState > const & forward_states
) override

Performs Rauch-Tung-Striebel (RTS) smoothing on a sequence of states.

Parameters:

  • forward_states A vector of state estimates from the forward pass, ordered chronologically. This should include both predicted and updated states as required by the RTS algorithm.

Return: A vector of smoothed FilterState objects, one for each corresponding input state.

Reimplements: StateEstimation::IFilter::smooth

This method takes a history of states from a forward Kalman filter pass and recursively computes a more accurate, smoothed estimate for the entire sequence.

function getState

inline virtual FilterState getState() const override

Gets the current state of the filter.

Return: The current state (posterior estimate).

Reimplements: StateEstimation::IFilter::getState

function clone

inline virtual std::unique_ptr< IFilter > clone() const override

Clones the filter object.

Return: A std::unique_ptr to a new instance of the filter with the same configuration.

Reimplements: StateEstimation::IFilter::clone

This is essential for the Tracker, which will hold a “prototype” filter and clone it for each new group that needs to be tracked.


Updated on 2026-11-13 at 20:25:41 +0000