TF Lookup would require extrapolation into the future
I would appreciate some guidance to understand what may be going on here.
I am trying to use the very nice robot_localization package to integrate GPS, IMU, Optical Flow and a few other sensors to localize a drone.
When running my configuration with sensor data coming from a recorded bag file, I get the following error from the ekf_localization_node node:
[ WARN] [1406560584.464395417, 1406223582.586091240]: Could not obtain transform from utm to nav. Error was Lookup would require extrapolation into the future. Requested time 1406223583.213000000 but the latest data is at time 1406223582.576022606, when looking up transform from frame [utm] to frame [nav]
I've been trying to understand why this is happening and I've gathered the following information:
The CPU usage is pretty low. I don't think this could be happening because of lack of processing capacity
What the code seems to be trying to do is using lookupTransform to calculate TF using the timestamp of the GPS message received
The transformation between [utm] and [nav] is being published at 50Hz. GPS messages are being published at 1Hz.
I can see GPS messages being published with timestamps matching the warning messages. I can also see TF publishing transformations matching the timestamp of "the latest data is at time ..." but also many more later messages:
-- stamp: secs: 1406223582 nsecs: 576022606 frame_id: nav child_frame_id: utm transform: translation: x: -5918718.00919 y: 1789119.24381 -- stamp: secs: 1406223582 nsecs: 596210609 frame_id: nav child_frame_id: utm transform: translation: x: -5918718.00919 y: 1789119.24381 -- stamp: secs: 1406223582 nsecs: 616362896 frame_id: nav child_frame_id: utm transform: translation: x: -5918718.00919 y: 1789119.24381 -- stamp: secs: 1406223582 nsecs: 636493509 frame_id: nav child_frame_id: utm transform: translation: x: -5918718.00919 y: 1789119.24381 -- ...
So if there are other, more recent transforms available, published by TF, why is lookupTransform complaining that the latest data is so old, when in fact there is much newer data being published?
For now, I am using the workaround of requesting the transformation for ros::Time(0) instead of the timestamp for the GPS message, but I am not sure that is the correct thing to do.
Any ideas?
Would using waitForTransform make sense for your use case?
I am going to try that out next. Thanks!