Let's assume I am working on a localization algorithm and need to publish the transformation between "map" frame and "odom" frame. I already know he robot's location in "map" coordinates is PM, and its location in "odom" coordinates is PO, if I publish a transformation using "map" as parent frame, and "odom" as the child frame, then this transformation should be PO-PM or PM-PO?
Update: Below is my code, is it correct?
tf::StampedTransform tf_map_to odom
// set up parent and child frames
tf_map_to_odom.frame_id_ = string("map");
tf_map_to_odom.child_frame_id_ = string("odom");
// set up publish rate
//ros::Rate loop_rate(100);
// main loop
tf_map_to_odom.stamp_ = ros::Time::now();
tf_map_to_odom.setOrigin(tf::Vector3(
point_in_map.x - odom.pose.pose.position.x,
point_in_map.y - odom.pose.pose.position.y,
0));
tf::Quaternion q;
q.setRPY(0, 0, point_in_map.orientation);
tf::Quaternion qq;
quaternionMsgToTF(ddom.pose.pose.orientation, qq);
q = q * qq.inverse();
tf_map_to_odom.setRotation(q);
// broadcast transform
_tf_br.sendTransform(tf_map_to_odom);
Originally posted by AutoCar on ROS Answers with karma: 102 on 2018-11-28
Post score: 0