22 #include "../tools/from_any_value.hpp" 33 #include <boost/foreach.hpp> 34 #define for_each BOOST_FOREACH 43 p_memory_(session->service(
"ALMemory"))
46 msg_imu_.header.frame_id =
"base_link";
48 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AngleX/Sensor/Value");
49 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value");
50 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AngleZ/Sensor/Value");
51 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/GyroscopeX/Sensor/Value");
52 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/GyroscopeY/Sensor/Value");
53 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/GyroscopeZ/Sensor/Value");
54 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AccelerometerX/Sensor/Value");
55 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AccelerometerY/Sensor/Value");
56 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensor/AccelerometerZ/Sensor/Value");
59 msg_imu_.header.frame_id =
"base_footprint";
61 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AngleX/Sensor/Value");
62 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AngleY/Sensor/Value");
63 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AngleZ/Sensor/Value");
64 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/GyroscopeX/Sensor/Value");
65 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/GyroscopeY/Sensor/Value");
66 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/GyroscopeZ/Sensor/Value");
67 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AccelerometerX/Sensor/Value");
68 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AccelerometerY/Sensor/Value");
69 data_names_list_.push_back(
"Device/SubDeviceList/InertialSensorBase/AccelerometerZ/Sensor/Value");
91 std::vector<float> memData;
95 }
catch (
const std::exception& e) {
96 std::cerr <<
"Exception caught in ImuConverter: " << e.what() << std::endl;
107 tf_quat.
setRPY( memData[1], memData[2], memData[3] );
115 msg_imu_.angular_velocity.x = memData[4];
116 msg_imu_.angular_velocity.y = memData[5];
117 msg_imu_.angular_velocity.z = memData[6];
119 msg_imu_.linear_acceleration.x = memData[7];
120 msg_imu_.linear_acceleration.y = memData[8];
121 msg_imu_.linear_acceleration.z = memData[9];
124 msg_imu_.orientation_covariance[0] = -1;
125 msg_imu_.angular_velocity_covariance[0] = -1;
126 msg_imu_.linear_acceleration_covariance[0] = -1;
void setRPY(const tf2Scalar &roll, const tf2Scalar &pitch, const tf2Scalar &yaw)
boost::function< void(sensor_msgs::Imu &) > Callback_t
sensor_msgs::Imu msg_imu_
virtual void callAll(const std::vector< message_actions::MessageAction > &actions)
ImuConverter(const std::string &name, const IMU::Location &location, const float &frequency, const qi::SessionPtr &session)
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
std::map< message_actions::MessageAction, Callback_t > callbacks_
std::vector< std::string > data_names_list_