17 #ifndef POSE_PRESSURE_MEASUREMENTMANAGER_H
18 #define POSE_PRESSURE_MEASUREMENTMANAGER_H
25 #include <msf_updates/pose_sensor_handler/pose_sensorhandler.h>
26 #include <msf_updates/pressure_sensor_handler/pressure_sensorhandler.h>
27 #include <msf_updates/pose_sensor_handler/pose_measurement.h>
28 #include <msf_updates/PosePressureSensorConfig.h>
29 #include <msf_updates/SinglePoseSensorConfig.h>
31 namespace msf_pose_pressure_sensor {
33 typedef msf_updates::PosePressureSensorConfig
Config_T;
38 msf_updates::EKFState> {
39 typedef msf_pose_sensor::PoseSensorHandler<
41 friend class msf_pose_sensor::PoseSensorHandler<
49 ros::NodeHandle pnh = ros::NodeHandle("~/pose_pressure_sensor")) {
53 bool distortmeasurement =
false;
59 new msf_pressure_sensor::PressureSensorHandler(*
this,
"",
64 ReconfigureServer::CallbackType f = boost::bind(
77 shared_ptr<msf_core::IMUHandler_ROS<msf_updates::EKFState> >
imu_handler_;
90 if ((level & msf_updates::SinglePoseSensor_INIT_FILTER)
91 && config.core_init_filter ==
true) {
92 init(config.pose_initial_scale);
93 config.core_init_filter =
false;
96 if ((level & msf_updates::SinglePoseSensor_SET_HEIGHT)
97 && config.core_set_height ==
true) {
98 Eigen::Matrix<double, 3, 1>
p =
pose_handler_->getPositionMeasurement();
101 "No measurements received yet to initialize position. Height init not allowed.");
104 double scale = p[2] / config.core_height;
106 config.core_set_height =
false;
111 config.pose_noise_meas_q);
116 void init(
double scale)
const {
118 Eigen::Matrix<double, 3, 1>
p,
v,
b_w,
b_a, g, w_m, a_m,
p_ic, p_vc;
119 Eigen::Quaternion<double>
q,
q_wv,
q_ic, q_vc;
120 Eigen::Matrix<double, 1, 1>
b_p;
145 if (p_vc.norm() == 0)
147 "No measurements received yet to initialize position - using [0 0 0]");
150 "No measurements received yet to initialize attitude - using [1 0 0 0]");
152 ros::NodeHandle pnh(
"~");
153 pnh.param(
"pose_sensor/init/p_ic/x", p_ic[0], 0.0);
154 pnh.param(
"pose_sensor/init/p_ic/y", p_ic[1], 0.0);
155 pnh.param(
"pose_sensor/init/p_ic/z", p_ic[2], 0.0);
157 pnh.param(
"pose_sensor/init/q_ic/w", q_ic.w(), 1.0);
158 pnh.param(
"pose_sensor/init/q_ic/x", q_ic.x(), 0.0);
159 pnh.param(
"pose_sensor/init/q_ic/y", q_ic.y(), 0.0);
160 pnh.param(
"pose_sensor/init/q_ic/z", q_ic.z(), 0.0);
167 q = (q_ic * q_vc.conjugate() *
q_wv).conjugate();
170 p = q_wv.conjugate().toRotationMatrix() * p_vc / scale
171 - q.toRotationMatrix() *
p_ic;
175 shared_ptr < msf_core::MSF_InitMeasurement<EKFState_T>
184 > (Eigen::Matrix<double, 1, 1>::Constant(scale));
191 meas->get_w_m() = w_m;
192 meas->get_a_m() = a_m;
193 meas->time = ros::Time::now().toSec();
203 Eigen::Matrix<double, 1, 1> scale;
212 const msf_core::Vector3 nqwvv = msf_core::Vector3::Constant(
214 const msf_core::Vector3 nqicv = msf_core::Vector3::Constant(
216 const msf_core::Vector3 npicv = msf_core::Vector3::Constant(
218 const msf_core::Vector1 n_L = msf_core::Vector1::Constant(
220 const msf_core::Vector1 nb_p = msf_core::Vector1::Constant(
228 (dt * nqwvv.cwiseProduct(nqwvv)).asDiagonal();
230 (dt * nqicv.cwiseProduct(nqicv)).asDiagonal();
232 (dt * npicv.cwiseProduct(npicv)).asDiagonal();
244 Eigen::Matrix<double, EKFState_T::nErrorStatesAtCompileTime, 1>& correction)
const {
251 Eigen::Matrix<double, EKFState_T::nErrorStatesAtCompileTime, 1>& correction)
const {
260 <<
". Correcting to 0.1");
261 Eigen::Matrix<double, 1, 1> L_;