TransformListener Question [closed]
I think that this must be some sort of silly mistake on my part but.... I'm trying to use the following code. My transform tree (verified with command line tf and rviz) has /map -> /odom -> /base_link in it. But when I try to run the following C++ I end up getting a transform error claiming:
Frame id /map does not exist! Frames (1):
The simulation in gazebo is up and running for plenty of time before I even try to run this code so I don't think it's an issue of the transforms not being published yet. Also, it's not complaining about extrapolation so I don't think it's a timestamping issue?
ros::init(argc, argv, "transform test");
ros::NodeHandle n;
tf::TransformListener tfListener;
geometry_msgs::PointStamped baseLinkPoint;
geometry_msgs::PointStamped mapPoint;
baseLinkPoint.header.frame_id = "/base_link";
baseLinkPoint.header.stamp = ros::Time::now();
baseLinkPoint.point.x = 0.0;
baseLinkPoint.point.y = 0.0;
baseLinkPoint.point.z = 0.0;
try { tfListener.transformPoint("/map", baseLinkPoint, mapPoint); }
catch (tf::TransformException ex) { ROS_ERROR("%s",ex.what()); }
Any insight is greatly appreciated!
What happens if you put the try catch in a loop with a 1 second sleep in it?
First of all, thanks so much for helping out. If I let it loop I get the same error for a while and the tree tf tree fleshes out (after the error it lists the frames) and then finally it says taht the transform because the cache is empty when looking up transform from /base_link to /map.