17 #ifndef SPHERICAL_POSITION_MEASUREMENTMANAGER_H
18 #define SPHERICAL_POSITION_MEASUREMENTMANAGER_H
25 #include <msf_updates/spherical_position_sensor/spherical_sensorhandler.h>
26 #include <msf_updates/spherical_position_sensor/spherical_measurement.h>
27 #include <msf_updates/SphericalPositionSensorConfig.h>
29 namespace msf_spherical_position {
31 typedef msf_updates::SphericalPositionSensorConfig
Config_T;
36 msf_updates::EKFState> {
40 friend class DistanceSensorHandler<DistanceMeasurement,
SensorManager> ;
47 ros::NodeHandle pnh = ros::NodeHandle(
"~/spherical_position_sensor")) {
84 if ((level & msf_updates::SphericalPositionSensor_INIT_FILTER)
85 && config.core_init_filter ==
true) {
87 config.core_init_filter =
false;
91 void init(
double scale)
const {
93 ROS_WARN_STREAM(
"Init scale is " << scale <<
" correcting to 1.");
97 Eigen::Matrix<double, 3, 1>
p,
v,
b_w,
b_a, g, w_m, a_m,
p_ip, p_vc;
98 Eigen::Quaternion<double>
q;
112 double yawinit =
config_.yaw_init / 180 * M_PI;
113 Eigen::Quaterniond yawq(cos(yawinit / 2), 0, 0, sin(yawinit / 2));
124 p_vc(0, 0) = distance(0) * sin(angles(0)) * cos(angles(1));
125 p_vc(1, 0) = distance(0) * sin(angles(0)) * sin(angles(1));
126 p_vc(2, 0) = distance(0) * cos(angles(0));
129 "initial measurement pos:[" << p_vc.transpose()<<
"] orientation: "
133 if( p_vc.norm() == 0)
134 ROS_WARN_STREAM(
"No measurements received yet to initialize position - using [0 0 0]");
136 ros::NodeHandle pnh(
"~");
137 pnh.param(
"position_sensor/init/p_ip/x", p_ip[0], 0.0);
138 pnh.param(
"position_sensor/init/p_ip/y", p_ip[1], 0.0);
139 pnh.param(
"position_sensor/init/p_ip/z", p_ip[2], 0.0);
142 p = p_vc - q.toRotationMatrix() *
p_ip;
145 boost::shared_ptr < msf_core::MSF_InitMeasurement<EKFState_T>
156 meas->get_w_m() = w_m;
157 meas->get_a_m() = a_m;
158 meas->time = ros::Time::now().toSec();
173 const msf_core::Vector3 npipv = msf_core::Vector3::Constant(
178 (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 {