Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
tf2::TimeCache Class Reference

A class to keep a sorted linked list in time This builds and maintains a list of timestamped data. And provides lookup functions to get data out as a function of time. More...

#include <time_cache.h>

Inheritance diagram for tf2::TimeCache:
Inheritance graph
[legend]

Public Member Functions

virtual void clearList ()
 Clear the list of stored values. More...
 
virtual bool getData (ros::Time time, TransformStorage &data_out, std::string *error_str=0)
 Virtual methods. More...
 
virtual P_TimeAndFrameID getLatestTimeAndParent ()
 Get the latest time stored in this cache, and the parent associated with it. Returns parent = 0 if no data. More...
 
virtual ros::Time getLatestTimestamp ()
 Get the latest timestamp cached. More...
 
virtual unsigned int getListLength ()
 Debugging information methods. More...
 
virtual ros::Time getOldestTimestamp ()
 Get the oldest timestamp cached. More...
 
virtual CompactFrameID getParent (ros::Time time, std::string *error_str)
 Retrieve the parent at a specific time. More...
 
virtual bool insertData (const TransformStorage &new_data, std::string *error_str=0)
 Insert data into the cache. More...
 
 TimeCache (ros::Duration max_storage_time=ros::Duration().fromNSec(DEFAULT_MAX_STORAGE_TIME))
 

Static Public Attributes

static const int64_t DEFAULT_MAX_STORAGE_TIME = 10ULL * 1000000000LL
 default value of 10 seconds storage More...
 
static const unsigned int MAX_LENGTH_LINKED_LIST = 1000000
 Maximum length of linked list, to make sure not to be able to use unlimited memory. More...
 
static const int MIN_INTERPOLATION_DISTANCE = 5
 Number of nano-seconds to not interpolate below. More...
 

Private Types

typedef std::deque< TransformStorageL_TransformStorage
 

Private Member Functions

uint8_t findClosest (TransformStorage *&one, TransformStorage *&two, ros::Time target_time, std::string *error_str)
 A helper function for getData. More...
 
void interpolate (const TransformStorage &one, const TransformStorage &two, ros::Time time, TransformStorage &output)
 
void pruneList ()
 

Private Attributes

ros::Duration max_storage_time_
 
L_TransformStorage storage_
 

Detailed Description

A class to keep a sorted linked list in time This builds and maintains a list of timestamped data. And provides lookup functions to get data out as a function of time.

Definition at line 92 of file time_cache.h.

Member Typedef Documentation

◆ L_TransformStorage

Definition at line 117 of file time_cache.h.

Constructor & Destructor Documentation

◆ TimeCache()

tf2::TimeCache::TimeCache ( ros::Duration  max_storage_time = ros::Duration().fromNSec(DEFAULT_MAX_STORAGE_TIME))

Definition at line 59 of file cache.cpp.

Member Function Documentation

◆ clearList()

void tf2::TimeCache::clearList ( )
virtual

Clear the list of stored values.

Implements tf2::TimeCacheInterface.

Definition at line 295 of file cache.cpp.

◆ findClosest()

uint8_t tf2::TimeCache::findClosest ( TransformStorage *&  one,
TransformStorage *&  two,
ros::Time  target_time,
std::string *  error_str 
)
inlineprivate

A helper function for getData.

Definition at line 111 of file cache.cpp.

◆ getData()

bool tf2::TimeCache::getData ( ros::Time  time,
TransformStorage data_out,
std::string *  error_str = 0 
)
virtual

Virtual methods.

Implements tf2::TimeCacheInterface.

Definition at line 208 of file cache.cpp.

◆ getLatestTimeAndParent()

P_TimeAndFrameID tf2::TimeCache::getLatestTimeAndParent ( )
virtual

Get the latest time stored in this cache, and the parent associated with it. Returns parent = 0 if no data.

Implements tf2::TimeCacheInterface.

Definition at line 305 of file cache.cpp.

◆ getLatestTimestamp()

ros::Time tf2::TimeCache::getLatestTimestamp ( )
virtual

Get the latest timestamp cached.

Implements tf2::TimeCacheInterface.

Definition at line 316 of file cache.cpp.

◆ getListLength()

unsigned int tf2::TimeCache::getListLength ( )
virtual

Debugging information methods.

Implements tf2::TimeCacheInterface.

Definition at line 300 of file cache.cpp.

◆ getOldestTimestamp()

ros::Time tf2::TimeCache::getOldestTimestamp ( )
virtual

Get the oldest timestamp cached.

Implements tf2::TimeCacheInterface.

Definition at line 322 of file cache.cpp.

◆ getParent()

CompactFrameID tf2::TimeCache::getParent ( ros::Time  time,
std::string *  error_str 
)
virtual

Retrieve the parent at a specific time.

Implements tf2::TimeCacheInterface.

Definition at line 241 of file cache.cpp.

◆ insertData()

bool tf2::TimeCache::insertData ( const TransformStorage new_data,
std::string *  error_str = 0 
)
virtual

Insert data into the cache.

Implements tf2::TimeCacheInterface.

Definition at line 255 of file cache.cpp.

◆ interpolate()

void tf2::TimeCache::interpolate ( const TransformStorage one,
const TransformStorage two,
ros::Time  time,
TransformStorage output 
)
inlineprivate

Definition at line 186 of file cache.cpp.

◆ pruneList()

void tf2::TimeCache::pruneList ( )
private

Definition at line 328 of file cache.cpp.

Member Data Documentation

◆ DEFAULT_MAX_STORAGE_TIME

const int64_t tf2::TimeCache::DEFAULT_MAX_STORAGE_TIME = 10ULL * 1000000000LL
static

default value of 10 seconds storage

Definition at line 97 of file time_cache.h.

◆ MAX_LENGTH_LINKED_LIST

const unsigned int tf2::TimeCache::MAX_LENGTH_LINKED_LIST = 1000000
static

Maximum length of linked list, to make sure not to be able to use unlimited memory.

Definition at line 96 of file time_cache.h.

◆ max_storage_time_

ros::Duration tf2::TimeCache::max_storage_time_
private

Definition at line 120 of file time_cache.h.

◆ MIN_INTERPOLATION_DISTANCE

const int tf2::TimeCache::MIN_INTERPOLATION_DISTANCE = 5
static

Number of nano-seconds to not interpolate below.

Definition at line 95 of file time_cache.h.

◆ storage_

L_TransformStorage tf2::TimeCache::storage_
private

Definition at line 118 of file time_cache.h.


The documentation for this class was generated from the following files:


tf2
Author(s): Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Sun Feb 4 2024 03:18:11