Fawkes API
Fawkes Development Version
|
Read transforms from MongoDB and answer queries. More...
#include "mongodb_tf_transformer.h"
Public Member Functions | |
MongoDBTransformer (mongo::DBClientBase *mongodb_client, std::string database_name, bool ensure_index=true) | |
Constructor. More... | |
virtual | ~MongoDBTransformer () |
Destructor. More... | |
void | restore (fawkes::Time &start, fawkes::Time &end) |
Restore transforms from database. More... | |
void | restore (fawkes::Time &start, fawkes::Time &end, fawkes::Time &new_start) |
Restore transforms from database. More... | |
void | restore (long long start_msec, long long end_msec, long long new_start_msec=0) |
Restore transforms from database. More... | |
![]() | |
Transformer (float cache_time_sec=BufferCore::DEFAULT_CACHE_TIME) | |
Constructor. More... | |
virtual | ~Transformer (void) |
Destructor. More... | |
void | set_enabled (bool enabled) |
Set enabled status of transformer. More... | |
bool | is_enabled () const |
Check if transformer is enabled. More... | |
float | get_cache_time () const |
Get cache time. More... | |
void | lock () |
Lock transformer. More... | |
bool | try_lock () |
Try to acquire lock. More... | |
void | unlock () |
Unlock. More... | |
bool | frame_exists (const std::string &frame_id_str) const |
Check if frame exists. More... | |
TimeCacheInterfacePtr | get_frame_cache (const std::string &frame_id) const |
Get cache for specific frame. More... | |
std::vector< TimeCacheInterfacePtr > | get_frame_caches () const |
Get all currently existing caches. More... | |
std::vector< std::string > | get_frame_id_mappings () const |
Get mappings from frame ID to names. More... | |
void | lookup_transform (const std::string &target_frame, const std::string &source_frame, const fawkes::Time &time, StampedTransform &transform) const |
Lookup transform. More... | |
void | lookup_transform (const std::string &target_frame, const fawkes::Time &target_time, const std::string &source_frame, const fawkes::Time &source_time, const std::string &fixed_frame, StampedTransform &transform) const |
Lookup transform assuming a fixed frame. More... | |
void | lookup_transform (const std::string &target_frame, const std::string &source_frame, StampedTransform &transform) const |
Lookup transform at latest common time. More... | |
bool | can_transform (const std::string &target_frame, const std::string &source_frame, const fawkes::Time &time, std::string *error_msg=NULL) const |
Test if a transform is possible. More... | |
bool | can_transform (const std::string &target_frame, const fawkes::Time &target_time, const std::string &source_frame, const fawkes::Time &source_time, const std::string &fixed_frame, std::string *error_msg=NULL) const |
Test if a transform is possible. More... | |
void | transform_quaternion (const std::string &target_frame, const Stamped< Quaternion > &stamped_in, Stamped< Quaternion > &stamped_out) const |
Transform a stamped Quaternion into the target frame. More... | |
void | transform_vector (const std::string &target_frame, const Stamped< Vector3 > &stamped_in, Stamped< Vector3 > &stamped_out) const |
Transform a stamped vector into the target frame. More... | |
void | transform_point (const std::string &target_frame, const Stamped< Point > &stamped_in, Stamped< Point > &stamped_out) const |
Transform a stamped point into the target frame. More... | |
void | transform_pose (const std::string &target_frame, const Stamped< Pose > &stamped_in, Stamped< Pose > &stamped_out) const |
Transform a stamped pose into the target frame. More... | |
bool | transform_origin (const std::string &source_frame, const std::string &target_frame, Stamped< Pose > &stamped_out, const fawkes::Time time=fawkes::Time(0, 0)) const |
Transform ident pose from one frame to another. More... | |
void | transform_quaternion (const std::string &target_frame, const fawkes::Time &target_time, const Stamped< Quaternion > &stamped_in, const std::string &fixed_frame, Stamped< Quaternion > &stamped_out) const |
Transform a stamped Quaternion into the target frame assuming a fixed frame. More... | |
void | transform_vector (const std::string &target_frame, const fawkes::Time &target_time, const Stamped< Vector3 > &stamped_in, const std::string &fixed_frame, Stamped< Vector3 > &stamped_out) const |
Transform a stamped vector into the target frame assuming a fixed frame. More... | |
void | transform_point (const std::string &target_frame, const fawkes::Time &target_time, const Stamped< Point > &stamped_in, const std::string &fixed_frame, Stamped< Point > &stamped_out) const |
Transform a stamped point into the target frame assuming a fixed frame. More... | |
void | transform_pose (const std::string &target_frame, const fawkes::Time &target_time, const Stamped< Pose > &stamped_in, const std::string &fixed_frame, Stamped< Pose > &stamped_out) const |
Transform a stamped pose into the target frame assuming a fixed frame. More... | |
std::string | all_frames_as_dot (bool print_time, fawkes::Time *time=0) const |
Get DOT graph of all frames. More... | |
![]() | |
BufferCore (float cache_time=DEFAULT_CACHE_TIME) | |
assuming the tree has a loop More... | |
void | clear () |
Clear all data. More... | |
bool | set_transform (const StampedTransform &transform, const std::string &authority, bool is_static=false) |
Add transform information to the tf data structure. More... | |
void | lookup_transform (const std::string &target_frame, const std::string &source_frame, const fawkes::Time &time, StampedTransform &transform) const |
Lookup transform. More... | |
void | lookup_transform (const std::string &target_frame, const fawkes::Time &target_time, const std::string &source_frame, const fawkes::Time &source_time, const std::string &fixed_frame, StampedTransform &transform) const |
Lookup transform assuming a fixed frame. More... | |
bool | can_transform (const std::string &target_frame, const std::string &source_frame, const fawkes::Time &time, std::string *error_msg=NULL) const |
Test if a transform is possible. More... | |
bool | can_transform (const std::string &target_frame, const fawkes::Time &target_time, const std::string &source_frame, const fawkes::Time &source_time, const std::string &fixed_frame, std::string *error_msg=NULL) const |
Test if a transform is possible. More... | |
std::string | all_frames_as_YAML (double current_time) const |
A way to see what frames have been cached in yaml format Useful for debugging tools. More... | |
std::string | all_frames_as_YAML () const |
Get latest frames as YAML. More... | |
std::string | all_frames_as_string () const |
A way to see what frames have been cached. More... | |
float | get_cache_length () |
Get the duration over which this transformer will cache. More... | |
Additional Inherited Members | |
![]() | |
static const int | DEFAULT_CACHE_TIME = 10 |
The default amount of time to cache data in seconds. More... | |
static const uint32_t | MAX_GRAPH_DEPTH = 1000UL |
Maximum number of times to recurse before. More... | |
![]() | |
typedef std::vector< TimeCacheInterfacePtr > | V_TimeCacheInterface |
Vector data type for frame caches. More... | |
typedef std::unordered_map< std::string, CompactFrameID > | M_StringToCompactFrameID |
A map from string frame ids to CompactFrameID. More... | |
![]() | |
std::string | all_frames_as_string_no_lock () const |
A way to see what frames have been cached. More... | |
TimeCacheInterfacePtr | get_frame (CompactFrameID c_frame_id) const |
Accessor to get frame cache. More... | |
TimeCacheInterfacePtr | allocate_frame (CompactFrameID cfid, bool is_static) |
Allocate a new frame cache. More... | |
bool | warn_frame_id (const char *function_name_arg, const std::string &frame_id) const |
Warn if an illegal frame_id was passed. More... | |
CompactFrameID | validate_frame_id (const char *function_name_arg, const std::string &frame_id) const |
Check if frame ID is valid and return compact ID. More... | |
CompactFrameID | lookup_frame_number (const std::string &frameid_str) const |
String to number for frame lookup with dynamic allocation of new frames. More... | |
CompactFrameID | lookup_or_insert_frame_number (const std::string &frameid_str) |
String to number for frame lookup with dynamic allocation of new frames. More... | |
const std::string & | lookup_frame_string (CompactFrameID frame_id_num) const |
Number to string frame lookup may throw LookupException if number invalid. More... | |
void | create_connectivity_error_string (CompactFrameID source_frame, CompactFrameID target_frame, std::string *out) const |
Create error string. More... | |
int | get_latest_common_time (CompactFrameID target_frame, CompactFrameID source_frame, fawkes::Time &time, std::string *error_string) const |
Get latest common time of two frames. More... | |
template<typename F > | |
int | walk_to_top_parent (F &f, fawkes::Time time, CompactFrameID target_id, CompactFrameID source_id, std::string *error_string) const |
Traverse transform tree: walk from frame to top-parent of both. More... | |
template<typename F > | |
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 |
Traverse transform tree: walk from frame to top-parent of both. More... | |
bool | can_transform_internal (CompactFrameID target_id, CompactFrameID source_id, const fawkes::Time &time, std::string *error_msg) const |
Test if a transform is possible. More... | |
bool | can_transform_no_lock (CompactFrameID target_id, CompactFrameID source_id, const fawkes::Time &time, std::string *error_msg) const |
Test if a transform is possible. More... | |
![]() | |
V_TimeCacheInterface | frames_ |
The pointers to potential frames that the tree can be made of. More... | |
std::mutex | frame_mutex_ |
A mutex to protect testing and allocating new frames on the above vector. More... | |
M_StringToCompactFrameID | frameIDs_ |
Mapping from frame string IDs to compact IDs. More... | |
std::vector< std::string > | frameIDs_reverse |
A map from CompactFrameID frame_id_numbers to string for debugging and output. More... | |
std::map< CompactFrameID, std::string > | frame_authority_ |
A map to lookup the most recent authority for a given frame. More... | |
float | cache_time_ |
How long to cache transform history. More... | |
Read transforms from MongoDB and answer queries.
Definition at line 39 of file mongodb_tf_transformer.h.
fawkes::tf::MongoDBTransformer::MongoDBTransformer | ( | mongo::DBClientBase * | mongodb_client, |
std::string | database_name, | ||
bool | ensure_index = true |
||
) |
Constructor.
mongodb_client | MongoDB database client |
database_name | name of database to restore transforms from |
ensure_index | if true ensures that the required index on timestamps exists |
Definition at line 50 of file mongodb_tf_transformer.cpp.
|
virtual |
Destructor.
Definition at line 70 of file mongodb_tf_transformer.cpp.
|
inline |
Restore transforms from database.
start | start time of range to restore |
end | end time of range to restore |
Definition at line 51 of file mongodb_tf_transformer.h.
Referenced by PointCloudDBMergePipeline< pcl::PointXYZ >::merge(), restore(), and PointCloudDBRetrievePipeline< pcl::PointXYZ >::retrieve().
void fawkes::tf::MongoDBTransformer::restore | ( | fawkes::Time & | start, |
fawkes::Time & | end, | ||
fawkes::Time & | new_start | ||
) |
Restore transforms from database.
start | start time of range to restore |
end | end time of range to restore |
new_start | the new start time to which the transform times will be reset, i.e. from the transforms time stamp the start time is subtracted and new_start is added. |
Definition at line 82 of file mongodb_tf_transformer.cpp.
References fawkes::Time::in_msec(), restore(), and fawkes::tf::BufferCore::set_transform().
void fawkes::tf::MongoDBTransformer::restore | ( | long long | start_msec, |
long long | end_msec, | ||
long long | new_start_msec = 0 |
||
) |
Restore transforms from database.
start_msec | start time of range to restore since the epoch in msec |
end_msec | end time of range to restore since the epoch in msec |
new_start_msec | the new start time since the epoch in msec to which the transform times will be reset, i.e. from the transforms time stamp the start time is subtracted and new_start is added. |
Definition at line 124 of file mongodb_tf_transformer.cpp.
References fawkes::tf::BufferCore::cache_time_.