ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
first of all, thank you for answering.
i did try it all you said even before posting the question.
still haven't found any solution to my problem with reading that tf. Tf with command tf tf_echo /map /odom looks alright: "Traslation: (-0.336 , 0.318, 0.000)" , and still I can't get it right.
lets add things up on my question:
rosbag play --clock basic_localization_stage.bag is command I start the .bag
rosrun gmapping slam_gmapping scan:=base_scan
rosparam set /use_sim_time true in CLI
then start my node to read tf
and this is what i get: "Lookup would require extrapolation into the past. Requested the time 38.9583
but the earliest data is at time 39.1473, when looking up transform
from frame /map to /odom"
I place new code to it: (now it has waiting for tf, and still wrong one)
tf::TransformListener listener;
ros::Rate rate(1.0);
while (nh.ok()){
tf::StampedTransform tfTransform;
try{
ros::Time now = ros::Time::now();
listener.waitForTransform("/odom", "/map",
now, ros::Duration(5.0));
listener.lookupTransform("/odom", "/map",
now, tfTransform);
}
catch(tf::TransformException &exception) {
ROS_ERROR("%s", exception.what());
}
ROS_INFO("%f %f %f", tfTransform.getOrigin().x(), tfTransform.getOrigin().y(), tfTransform.getOrigin().z());
rate.sleep();
}