# Revision history [back]

The standard transform listener has a finite buffer size after which it 'forgets' earlier transforms so you won't be able to look them up any more.

You can create a transform listener with a very long duration of buffer like this:

ros::Duration tfCacheDuration;
tfCacheDuration = tfCacheDuration.fromSec(600);   // ten minute tf buffer!
tfListener = new tf::TransformListener(tfCacheDuration);


You can then use this to lookup transforms further in the past, as long as your bag file contains transforms for that time. I've never tried to see how long you can make this buffer, you could try hours and see what happens.

Hope this helps.

The standard transform listener has a finite buffer size after which it 'forgets' earlier transforms so you won't be able to look them up any more.

You can create a transform listener with a very long duration of buffer like this:

ros::Duration tfCacheDuration;
tfCacheDuration = tfCacheDuration.fromSec(600);   // ten minute tf buffer!
tfListener = new tf::TransformListener(tfCacheDuration);


You can then use this to lookup transforms further in the past, as long as your bag file contains transforms for that time. I've never tried to see how long you can make this buffer, you could try hours and see what happens.

Hope this helps.

EDIT :

The TransformListener object contains a buffer of transforms which begins to fill up once the object has been created. Because of this the object needs to have been instantiated for a short period of time before it can lookup any transforms at all and it cannot lookup transforms before the time at which it was created.

In your case you'll want to create a single TransformListener when you're node starts and continue to use that same object the whole time your node is running. This way the largest possible buffer of transforms can be built up.