17 #ifndef MEASUREMENT_H_
18 #define MEASUREMENT_H_
20 #include <Eigen/Dense>
21 #include <boost/shared_ptr.hpp>
32 template<
typename EKFState_T>
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 virtual void apply(shared_ptr<EKFState_T> stateWithCovariance,
45 virtual std::string
type() = 0;
54 template<
class H_type,
class Res_type,
class R_type>
57 const Eigen::MatrixBase<H_type>& H,
58 const Eigen::MatrixBase<Res_type>& residual,
59 const Eigen::MatrixBase<R_type>& R);
63 const Eigen::MatrixXd& H,
64 const Eigen::MatrixXd& residual,
65 const Eigen::MatrixXd& R);
67 template<
class H_type,
class Res_type,
class R_type>
69 shared_ptr<EKFState_T> state_old, shared_ptr<EKFState_T> state_new,
71 const Eigen::MatrixBase<H_type>& H_new,
72 const Eigen::MatrixBase<Res_type>& residual,
73 const Eigen::MatrixBase<R_type>& R);
81 template<
typename EKFState_T>
88 "Called apply() on an MSF_InvalidMeasurement object. This should never "
91 virtual std::string
type() {
107 template<
typename T,
typename RMAT_T,
typename EKFState_T>
111 const boost::shared_ptr<T const> reading) = 0;
128 this->
time = timestamp;
133 if (
R_.minCoeff() == 0.0 &&
R_.maxCoeff() == 0.0) {
136 "The measurement covariance matrix seems to be not set for the current "
137 "measurement. Please double check!");
140 for (
int i = 0; i <
R_.RowsAtCompileTime; ++i) {
141 if (
R_(i, i) == 0.0) {
144 "The measurement covariance matrix has some diagonal elements set to "
145 "zero. Please double check!");
157 template<
typename EKFState_T>
166 bool ContainsInitialSensorReadings)
169 this->
time = ros::Time::now().toSec();
177 typename EKFState_T::P_type&
get_P() {
197 template<
int INDEX,
typename T>
199 InitState.template getStateVar<INDEX>().state_ = initvalue;
200 InitState.template getStateVar<INDEX>().hasResetValue =
true;
209 InitState.template get<INDEX>().hasResetValue =
false;
229 template<
typename EKFState_T>
237 return (lhs.time_ < rhs.time_);
245 #endif // MEASUREMENT_H_