Ask Your Question

Why is a transform not available after waitForTransform?

asked 2014-10-08 04:09:49 -0500

Sebastian Kasperski gravatar image

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.

    ROS_WARN("Warning 1: %s", error_msg.c_str());
    gProjector->transformLaserScanToPointCloud("camera", *scan, cloud, *gTfListener);
}catch(tf::TransformException e)
    ROS_WARN("Warning 2: %s", e.what());

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

edit retag flag offensive close merge delete


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

GuillaumeB gravatar image GuillaumeB  ( 2014-10-08 05:16:47 -0500 )edit

Increasing the wait time did not change the behaviour, as waitForTransform already returned true (e.g. didn't timeout)

Sebastian Kasperski gravatar image Sebastian Kasperski  ( 2014-10-08 07:43:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-08 07:40:20 -0500

Sebastian Kasperski gravatar image

updated 2014-10-08 07:41:38 -0500

My assumption about tf was wrong, the solution was indeed related to laser_geometry. As described here, the Projector uses start and end time of the scan and therefore asks for a timestamp in the future.

So to wait long enough, the call to waitForTransform should be:

        scan->header.stamp + ros::Duration().fromSec(scan->ranges.size()*scan->time_increment),
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-08 04:09:49 -0500

Seen: 343 times

Last updated: Oct 08 '14