52 #ifndef __LIBS_TF_BUFFER_CORE_H_ 53 #define __LIBS_TF_BUFFER_CORE_H_ 56 #include <tf/transform_storage.h> 58 #include <utils/time/time.h> 65 #include <unordered_map> 74 class TimeCacheInterface;
75 typedef std::shared_ptr<TimeCacheInterface> TimeCacheInterfacePtr;
81 CONNECTIVITY_ERROR = 2,
82 EXTRAPOLATION_ERROR = 3,
83 INVALID_ARGUMENT_ERROR = 4,
115 static const int DEFAULT_CACHE_TIME = 10;
116 static const uint32_t MAX_GRAPH_DEPTH = 1000UL;
119 BufferCore(
float cache_time = DEFAULT_CACHE_TIME);
125 const std::string & authority,
126 bool is_static =
false);
130 void lookup_transform(
const std::string& target_frame,
131 const std::string& source_frame,
135 void lookup_transform(
const std::string& target_frame,
137 const std::string& source_frame,
139 const std::string& fixed_frame,
142 bool can_transform(
const std::string& target_frame,
const std::string& source_frame,
143 const fawkes::Time& time, std::string* error_msg = NULL)
const;
145 bool can_transform(
const std::string& target_frame,
const fawkes::Time& target_time,
146 const std::string& source_frame,
const fawkes::Time& source_time,
147 const std::string& fixed_frame, std::string* error_msg = NULL)
const;
149 std::string all_frames_as_YAML(
double current_time)
const;
150 std::string all_frames_as_YAML()
const;
151 std::string all_frames_as_string()
const;
161 std::string all_frames_as_string_no_lock()
const;
191 TimeCacheInterfacePtr get_frame(CompactFrameID c_frame_id)
const;
193 TimeCacheInterfacePtr allocate_frame(CompactFrameID cfid,
bool is_static);
196 bool warn_frame_id(
const char* function_name_arg,
const std::string& frame_id)
const;
197 CompactFrameID validate_frame_id(
const char* function_name_arg,
const std::string& frame_id)
const;
200 CompactFrameID lookup_frame_number(
const std::string& frameid_str)
const;
203 CompactFrameID lookup_or_insert_frame_number(
const std::string& frameid_str);
206 const std::string& lookup_frame_string(CompactFrameID frame_id_num)
const;
208 void create_connectivity_error_string(CompactFrameID source_frame, CompactFrameID target_frame, std::string* out)
const;
210 int get_latest_common_time(CompactFrameID target_frame, CompactFrameID source_frame,
214 int walk_to_top_parent(F& f,
fawkes::Time time, CompactFrameID target_id, CompactFrameID source_id, std::string* error_string)
const;
217 int walk_to_top_parent(F& f,
fawkes::Time time, CompactFrameID target_id, CompactFrameID source_id, std::string* error_string, std::vector<CompactFrameID> *frame_chain)
const;
219 bool can_transform_internal(CompactFrameID target_id, CompactFrameID source_id,
220 const fawkes::Time& time, std::string* error_msg)
const;
221 bool can_transform_no_lock(CompactFrameID target_id, CompactFrameID source_id,
222 const fawkes::Time& time, std::string* error_msg)
const;
std::vector< TimeCacheInterfacePtr > V_TimeCacheInterface
Vector data type for frame caches.
Fawkes library namespace.
float get_cache_length()
Get the duration over which this transformer will cache.
V_TimeCacheInterface frames_
The pointers to potential frames that the tree can be made of.
A class for handling time.
std::map< CompactFrameID, std::string > frame_authority_
A map to lookup the most recent authority for a given frame.
A Class which provides coordinate transforms between any two frames in a system.
std::unordered_map< std::string, CompactFrameID > M_StringToCompactFrameID
A map from string frame ids to CompactFrameID.
std::mutex frame_mutex_
A mutex to protect testing and allocating new frames on the above vector.
M_StringToCompactFrameID frameIDs_
Mapping from frame string IDs to compact IDs.
float cache_time_
How long to cache transform history.
std::vector< std::string > frameIDs_reverse
A map from CompactFrameID frame_id_numbers to string for debugging and output.