Get valid frames from `tf2_ros.Buffer` based on `cache_time`
tf2_ros.Buffer
offers a cache_time
argument in both C++ and Python implementations.
However, on calling the buffer.all_frames_as_yaml()
, the frames including those outside the cache time are included. Is there a way to clear the cache periodically or to filter the "stale" frames without having to read the YAML/string for the field: most_recent_transform
and then convert it into a number (which also results in a loss of precision)?
PS: My understanding of cache_time
might be wrong, so I'll rephrase my question for clarity: How do I
- Get only frames with a TF within the
cache_time
provided to thetf2_ros.Buffer
OR - Clear the expired cache of
tf2_ros.Buffer
in Python (there's aclear
function, but like in C++, it clears the entire cache)