19 #ifndef POSITION_MEASUREMENTMANAGER_H
20 #define POSITION_MEASUREMENTMANAGER_H
28 #include <msf_updates/position_sensor_handler/position_sensorhandler.h>
29 #include <msf_updates/position_sensor_handler/position_measurement.h>
30 #include <msf_updates/SinglePositionSensorConfig.h>
32 namespace msf_position_sensor {
34 typedef msf_updates::SinglePositionSensorConfig
Config_T;
39 msf_updates::EKFState> {
40 typedef PositionSensorHandler<
41 msf_updates::position_measurement::PositionMeasurement,
43 friend class PositionSensorHandler<
44 msf_updates::position_measurement::PositionMeasurement,
52 ros::NodeHandle pnh = ros::NodeHandle("~/position_sensor")) {
62 ReconfigureServer::CallbackType f = boost::bind(
74 shared_ptr<msf_core::IMUHandler_ROS<msf_updates::EKFState> >
imu_handler_;
87 if ((level & msf_updates::SinglePositionSensor_INIT_FILTER)
88 && config.core_init_filter ==
true) {
90 config.core_init_filter =
false;
94 void init(
double scale)
const {
100 Eigen::Matrix<double, 3, 1>
p,
v,
b_w,
b_a, g, w_m, a_m,
p_ip, p_vc;
101 Eigen::Quaternion<double>
q;
115 double yawinit =
config_.position_yaw_init / 180 * M_PI;
116 Eigen::Quaterniond yawq(cos(yawinit / 2), 0, 0, sin(yawinit / 2));
129 if (p_vc.norm() == 0)
131 "No measurements received yet to initialize position - using [0 0 0]");
133 ros::NodeHandle pnh(
"~");
134 pnh.param(
"position_sensor/init/p_ip/x", p_ip[0], 0.0);
135 pnh.param(
"position_sensor/init/p_ip/y", p_ip[1], 0.0);
136 pnh.param(
"position_sensor/init/p_ip/z", p_ip[2], 0.0);
139 p = p_vc - q.toRotationMatrix() *
p_ip;
143 shared_ptr < msf_core::MSF_InitMeasurement<EKFState_T>
154 meas->get_w_m() = w_m;
155 meas->get_a_m() = a_m;
156 meas->time = ros::Time::now().toSec();
171 const msf_core::Vector3 npipv = msf_core::Vector3::Constant(
177 (dt * npipv.cwiseProduct(npipv)).asDiagonal();
189 Eigen::Matrix<double, EKFState_T::nErrorStatesAtCompileTime, 1>& correction)
const {
196 Eigen::Matrix<double, EKFState_T::nErrorStatesAtCompileTime, 1>& correction)
const {