ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hey have u published clock while playing bag file using --clock parameter?? Also try tf_echo for getting transformation between map and odom. Once u plat bag file just run following command in new terminal

rosrun tf tf_echo /map /odom

If u get correct tf then there is a bug in ur code but if this command is also publishing same tf as u have mentioned in ur question then there is a problem with the way you are playing bag file.

PS: U have used %d in ur ROS_INFO command..change it to %f.

Hey have u published clock while playing bag file using --clock parameter?? Also try tf_echo for getting transformation between map and odom. Once u plat bag file just run following command in new terminal

rosrun tf tf_echo /map /odom

If u get correct tf then there is a bug in ur code but if this command is also publishing same tf as u have mentioned in ur question then there is a problem with the way you are playing bag file.

PS: U have used %d in ur ROS_INFO command..change it to %f.

Try using this code: tf::StampedTransform transform; try{

listener.waitForTransform("map", "/robot1/odom",ros::Time(0), ros::Duration(0.1)); listener.lookupTransform("map", "/robot1/odom", ros::Time(0), transform); } catch (tf::TransformException ex){ ROS_ERROR("Error looking up transformation\n%s",ex.what()); return; }

This works fine for me..