tf2::Buffer forgetting transforms?
I have a tf2::Buffer with cache time set to 60 seconds. I launch my node, wait for 2 seconds after connecting TransformListener to the buffer (to allow it to gather all transforms).
Then I call buffer->canTransform("base_link", "laser", scan_time, ros::Duration(0.1)), and sometimes it ends with Extrapolation exception:
Requested time 1439458371.795563147 but the earliest data is at time 1439458372.276928710
However, I'm pretty sure the transforms are published, I checked it with tf_monitor and it shows a publishing frequency of 1500 Hz between base_link and laser.
What's more, the "earliest time" for this transform grows from time to time after a few seconds (I'd expect it to only grow after 60 seconds, which is the buffer size).
The data come from a bag file played with the --clock option, and /use_sim_time is true.
How could I debug what's going on here?
Ok, I found the cause of this behavior. We subtract a small amount of time of the laser scan time, so that the first scan's time is always earlier than the first TF received at the same moment. And the waiting had no effect, because the old scans got buffered in message queue.