Why is a transform not available after waitForTransform?
Hello ros-users,
I have strange issue with tf-transforms. I use laser_geometry::LaserProjection to project laser scans to point clouds, but I assume the problem is related to tf. The code-snippet is from the scan callback function.
if(!gTfListener->waitForTransform(scan->header.frame_id,
"camera",
scan->header.stamp,
ros::Duration(2.0),
ros::Duration(0.01),
&error_msg))
{
ROS_WARN("Warning 1: %s", error_msg.c_str());
return;
}
try
{
gProjector->transformLaserScanToPointCloud("camera", *scan, cloud, *gTfListener);
}catch(tf::TransformException e)
{
ROS_WARN("Warning 2: %s", e.what());
return;
}
After a few seconds of running, Warning 2 is raised on the console for like 1 out of 4 scans with this error message:
Warning 2: Lookup would require extrapolation into the future. Requested time 1412757571.359567610 but the latest data is at time 1412757571.357117891, when looking up transform from frame [laser_link] to frame [camera]
How can this happen, after waitForTransform obviously succeeded (returned true)?
Thanks in advance, Sebastian
you could try to set a very long time for the duration (the time it should wait) . My computer was slow and it solved the problem
Increasing the wait time did not change the behaviour, as waitForTransform already returned true (e.g. didn't timeout)