33 x = Eigen::MatrixXd::Zero(n, 1);
36 P = Eigen::MatrixXd::Zero(n, n);
39 Phi = Eigen::MatrixXd::Zero(n, n);
42 Q = Eigen::MatrixXd::Zero(n, n);
45 z = Eigen::MatrixXd::Zero(m, 1);
48 H = Eigen::MatrixXd::Zero(m, n);
51 R = Eigen::MatrixXd::Zero(m, m);
54 S = Eigen::MatrixXd::Zero(m, m);
57 K = Eigen::MatrixXd::Zero(n, m);
60 I = Eigen::MatrixXd::Identity(n, n);
115 S =
H *
P *
H.transpose() +
R;
118 K =
P *
H.transpose() *
S.inverse();
135 K =
P *
H.transpose() * (
H *
P *
H.transpose() +
R).inverse();
144 P = (I -
K *
H) *
P * (I -
K *
H).transpose() +
K *
R *
K.transpose();
154 return Eigen::MatrixXd::Identity(F.rows(), F.cols()) + F * tau_s;
194template<
typename Derived>
198 typename Derived::PlainObject Phi;
200 if constexpr (Derived::RowsAtCompileTime == Eigen::Dynamic)
202 Phi = Eigen::MatrixBase<Derived>::Identity(F.rows(), F.cols());
206 Phi = Eigen::MatrixBase<Derived>::Identity();
210 for (
size_t i = 1; i <= order; i++)
212 typename Derived::PlainObject Fpower = F;
215 for (
size_t j = 1; j < i; j++)
222 Phi += (Fpower * std::pow(tau_s, i)) / math::factorial(i);
234template<
typename Derived>
238 return (F * tau_s).exp();
Derived::PlainObject transitionMatrix_Phi_exp(const Eigen::MatrixBase< Derived > &F, typename Derived::Scalar tau_s)
Calculates the state transition matrix ๐ฝ using the exponential matrix.
Definition KalmanFilter.hpp:235
Derived::PlainObject transitionMatrix_Phi_Taylor(const Eigen::MatrixBase< Derived > &F, double tau_s, size_t order)
Calculates the state transition matrix ๐ฝ limited to specified order in ๐
๐โ
Definition KalmanFilter.hpp:195
Generalized Kalman Filter class.
Definition KalmanFilter.hpp:25
void correctWithMeasurementInnovation()
Do a Measurement Update with a Measurement Innovation ๐น๐ณ
Definition KalmanFilter.hpp:132
KalmanFilter(int n, int m)
Constructor.
Definition KalmanFilter.hpp:30
Eigen::MatrixXd K
๐ Kalman gain matrix
Definition KalmanFilter.hpp:182
Eigen::MatrixXd x
xฬ State vector
Definition KalmanFilter.hpp:158
KalmanFilter()=delete
Default constructor.
void predict()
Do a Time Update.
Definition KalmanFilter.hpp:100
Eigen::MatrixXd z
๐ณ Measurement vector
Definition KalmanFilter.hpp:170
Eigen::MatrixXd P
๐ Error covariance matrix
Definition KalmanFilter.hpp:161
void setZero()
Sets all Vectors and matrices to 0.
Definition KalmanFilter.hpp:67
Eigen::MatrixXd R
๐ = ๐ธ{๐ฐโ๐ฐโแต} Measurement noise covariance matrix
Definition KalmanFilter.hpp:176
Eigen::MatrixXd Q
๐ System/Process noise covariance matrix
Definition KalmanFilter.hpp:167
static Eigen::MatrixXd transitionMatrix(const Eigen::MatrixXd &F, double tau_s)
Updates the state transition matrix ๐ฝ limited to first order in ๐
๐โ
Definition KalmanFilter.hpp:151
Eigen::MatrixXd Phi
๐ฝ State transition matrix
Definition KalmanFilter.hpp:164
Eigen::MatrixXd H
๐ Measurement sensitivity Matrix
Definition KalmanFilter.hpp:173
Eigen::MatrixXd S
๐ฆ Measurement prediction covariance matrix
Definition KalmanFilter.hpp:179
void correct()
Do a Measurement Update with a Measurement ๐ณ
Definition KalmanFilter.hpp:113