22 #include "../tools/from_any_value.hpp" 27 #include <boost/foreach.hpp> 28 #define for_each BOOST_FOREACH 40 p_motion_( session->service(
"ALMotion") )
54 bool use_sensor =
true;
56 std::vector<float> al_odometry_data =
p_motion_.call<std::vector<float> >(
"getPosition",
"Torso", FRAME_WORLD, use_sensor );
59 std::vector<float> al_speed_data =
p_motion_.call<std::vector<float> >(
"getRobotVelocity" );
61 const float& odomX = al_odometry_data[0];
62 const float& odomY = al_odometry_data[1];
63 const float& odomZ = al_odometry_data[2];
64 const float& odomWX = al_odometry_data[3];
65 const float& odomWY = al_odometry_data[4];
66 const float& odomWZ = al_odometry_data[5];
68 const float& dX = al_speed_data[0];
69 const float& dY = al_speed_data[1];
70 const float& dWZ = al_speed_data[2];
74 tf_quat.
setRPY( odomWX, odomWY, odomWZ );
75 geometry_msgs::Quaternion odom_quat =
tf2::toMsg( tf_quat );
77 static nav_msgs::Odometry msg_odom;
78 msg_odom.header.frame_id =
"odom";
79 msg_odom.child_frame_id =
"base_link";
80 msg_odom.header.stamp = odom_stamp;
82 msg_odom.pose.pose.orientation = odom_quat;
83 msg_odom.pose.pose.position.x = odomX;
84 msg_odom.pose.pose.position.y = odomY;
85 msg_odom.pose.pose.position.z = odomZ;
87 msg_odom.twist.twist.linear.x = dX;
88 msg_odom.twist.twist.linear.y = dY;
89 msg_odom.twist.twist.linear.z = 0;
91 msg_odom.twist.twist.angular.x = 0;
92 msg_odom.twist.twist.angular.y = 0;
93 msg_odom.twist.twist.angular.z = dWZ;
void setRPY(const tf2Scalar &roll, const tf2Scalar &pitch, const tf2Scalar &yaw)
OdomConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session)
boost::function< void(nav_msgs::Odometry &)> Callback_t
void registerCallback(message_actions::MessageAction action, Callback_t cb)
std::map< message_actions::MessageAction, Callback_t > callbacks_
void callAll(const std::vector< message_actions::MessageAction > &actions)