20 template<
typename EKFState_T>
23 : sensorID_(sensorID),
24 isabsolute_(isabsoluteMeasurement),
28 template<
typename EKFState_T>
29 template<
class H_type,
class Res_type,
class R_type>
32 const Eigen::MatrixBase<H_type>& H_delayed,
33 const Eigen::MatrixBase<Res_type> & res_delayed,
34 const Eigen::MatrixBase<R_type>& R_delayed) {
36 EIGEN_STATIC_ASSERT_FIXED_SIZE (H_type);
37 EIGEN_STATIC_ASSERT_FIXED_SIZE (R_type);
41 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime, 1> correction_;
44 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime,
45 R_type::RowsAtCompileTime> K;
48 S = H_delayed * P * H_delayed.transpose() + R_delayed;
49 K = P * H_delayed.transpose() * S.inverse();
51 correction_ = K * res_delayed;
54 P = KH * P * KH.transpose() + K * R_delayed * K.transpose();
57 P = 0.5 * (P + P.transpose());
62 template<
typename EKFState_T>
65 const Eigen::MatrixXd& H_delayed,
const Eigen::MatrixXd & res_delayed,
66 const Eigen::MatrixXd& R_delayed) {
70 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime, 1> correction_;
78 S = H_delayed * P * H_delayed.transpose() + R_delayed;
79 K = P * H_delayed.transpose() * S.inverse();
81 correction_ = K * res_delayed;
84 P = KH * P * KH.transpose() + K * R_delayed * K.transpose();
87 P = 0.5 * (P + P.transpose());
92 template<
typename EKFState_T>
93 template<
class H_type,
class Res_type,
class R_type>
95 shared_ptr<EKFState_T> state_old, shared_ptr<EKFState_T> state_new,
97 const Eigen::MatrixBase<H_type>& H_new,
98 const Eigen::MatrixBase<Res_type> & res,
99 const Eigen::MatrixBase<R_type>& R) {
101 EIGEN_STATIC_ASSERT_FIXED_SIZE (H_type);
102 EIGEN_STATIC_ASSERT_FIXED_SIZE (R_type);
106 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime, 1> correction_;
113 Eigen::Matrix<double, Pdim, Pdim> F_accum;
121 Eigen::Matrix<double, 2 * Pdim, 2 * Pdim> P_SC;
122 P_SC.template block<Pdim, Pdim>(0, 0) = state_old->P;
124 P_SC.template block<Pdim, Pdim>(0, Pdim) = state_old->P * F_accum.transpose();
125 P_SC.template block<Pdim, Pdim>(Pdim, 0) = F_accum * state_old->P;
126 P_SC.template block<Pdim, Pdim>(Pdim, Pdim) = state_new->P;
131 Eigen::Matrix<double, H_type::RowsAtCompileTime, H_type::ColsAtCompileTime * 2> H_SC;
133 H_SC.template block<H_type::RowsAtCompileTime, H_type::ColsAtCompileTime>(0,
136 H_SC.template block<H_type::RowsAtCompileTime, H_type::ColsAtCompileTime>(
137 0, H_type::ColsAtCompileTime) = H_new;
140 S_SC = H_SC * P_SC * H_SC.transpose() + R;
143 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime * 2,
144 R_type::RowsAtCompileTime> K_SC;
145 K_SC = P_SC * H_SC.transpose() * S_SC.inverse();
147 Eigen::Matrix<double, MSF_Core<EKFState_T>::nErrorStatesAtCompileTime,
148 R_type::RowsAtCompileTime> K;
150 .template block<MSF_Core<EKFState_T>::nErrorStatesAtCompileTime,
151 R_type::RowsAtCompileTime>(
154 correction_ = K * res;
157 P = P - K * S_SC * K.transpose();
161 state_new->P = 0.5 * (state_new->P + state_new->P.transpose());
166 template<
typename EKFState_T>
171 stateWithCovariance->time = this->time;
173 boost::fusion::for_each(stateWithCovariance->statevars,
176 if (!(InitState.P.minCoeff() == 0 && InitState.P.maxCoeff() == 0)) {
177 stateWithCovariance->P = InitState.P;
181 "Using simulated core plus fixed diag initial error state covariance.");
184 if (ContainsInitialSensorReadings_) {
185 stateWithCovariance->a_m = InitState.a_m;
186 stateWithCovariance->w_m = InitState.w_m;
188 stateWithCovariance->a_m.setZero();
189 stateWithCovariance->w_m.setZero();
192 core.
usercalc().publishStateInitial(stateWithCovariance);