Fawkes API
Fawkes Development Version
|
Receive transforms and answer queries. More...
#include <>>
Public Member Functions | |
TransformListener (BlackBoard *bb) | |
Constructor. More... | |
virtual | ~TransformListener () |
Destructor. More... | |
std::string | resolve (const std::string &frame_name) |
Resolve transform name. More... | |
virtual void | bb_interface_created (const char *type, const char *id) throw () |
BlackBoard interface created notification. More... | |
virtual void | bb_interface_data_changed (Interface *interface) throw () |
BlackBoard data changed notification. More... | |
virtual void | bb_interface_writer_removed (Interface *interface, unsigned int instance_serial) throw () |
A writing instance has been closed for a watched interface. More... | |
virtual void | bb_interface_reader_removed (Interface *interface, unsigned int instance_serial) throw () |
A reading instance has been closed for a watched interface. More... | |
![]() | |
Transformer (float cache_time_sec=10.0) | |
Constructor. More... | |
virtual | ~Transformer (void) |
Destructor. More... | |
void | clear () |
Clear cached transforms. More... | |
bool | set_transform (const StampedTransform &transform, const std::string &authority="default_authority") |
Set a transform. More... | |
bool | frame_exists (const std::string &frame_id_str) const |
Check if frame exists. 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 std::string &source_frame, StampedTransform &transform) const |
Lookup transform at latest common time. 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) 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) const |
Test if a transform is possible. More... | |
const TimeCache * | get_frame_cache (const std::string &frame_id) const |
An accessor to get access to the frame cache. More... | |
void | set_enabled (bool enabled) |
Set transformer enabled or disabled. More... | |
bool | is_enabled () const |
Check if transformer is enabled. More... | |
int | get_latest_common_time (const std::string &source_frame, const std::string &target_frame, fawkes::Time &time, std::string *error_string=0) const |
Get latest common time of two frames. 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... | |
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... | |
![]() | |
BlackBoardInterfaceObserver () | |
Empty constructor. More... | |
virtual | ~BlackBoardInterfaceObserver () |
Destructor. More... | |
virtual void | bb_interface_destroyed (const char *type, const char *id) throw () |
BlackBoard interface destroyed notification. More... | |
![]() | |
BlackBoardInterfaceListener (const char *name_format,...) | |
Constructor. More... | |
virtual | ~BlackBoardInterfaceListener () |
Destructor. More... | |
const char * | bbil_name () const |
Get BBIL name. More... | |
virtual bool | bb_interface_message_received (Interface *interface, Message *message) throw () |
BlackBoard message received notification. More... | |
virtual void | bb_interface_writer_added (Interface *interface, unsigned int instance_serial) throw () |
A writing instance has been opened for a watched interface. More... | |
virtual void | bb_interface_reader_added (Interface *interface, unsigned int instance_serial) throw () |
A reading instance has been opened for a watched interface. More... | |
Additional Inherited Members | |
![]() | |
enum | QueueEntryType { DATA = 0, MESSAGES = 1, READER = 2, WRITER = 3 } |
Queue entry type. More... | |
typedef std::list< QueueEntry > | InterfaceQueue |
Queue of additions/removal of interfaces. More... | |
typedef std::map< std::string, Interface * > | InterfaceMap |
Map of currently active event subscriptions. More... | |
![]() | |
static const unsigned int | MAX_GRAPH_DEPTH = 100UL |
Maximum number of times to recurse before assuming the tree has a loop. More... | |
static const float | DEFAULT_MAX_EXTRAPOLATION_DISTANCE = 0.f |
The default amount of time to extrapolate. More... | |
![]() | |
typedef std::unordered_map < std::string, CompactFrameID > | M_StringToCompactFrameID |
Map from string frame ids to CompactFrameID. More... | |
![]() | |
typedef LockMap< std::string, std::list< std::string > > | ObservedInterfaceLockMap |
Type for lockable interface type hash sets. More... | |
typedef ObservedInterfaceLockMap::iterator | ObservedInterfaceLockMapIterator |
Type for iterator of lockable interface type hash sets. More... | |
![]() | |
TimeCache * | get_frame (unsigned int frame_number) const |
An accessor to get a frame. More... | |
CompactFrameID | lookup_frame_number (const std::string &frameid_str) const |
String to number for frame lookup. 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... | |
std::string | lookup_frame_string (unsigned int frame_id_num) const |
Get frame ID given its number. More... | |
![]() | |
void | bbio_add_observed_create (const char *type_pattern, const char *id_pattern="*") throw () |
Add interface creation type to watch list. More... | |
void | bbio_add_observed_destroy (const char *type_pattern, const char *id_pattern="*") throw () |
Add interface destruction type to watch list. More... | |
ObservedInterfaceLockMap * | bbio_get_observed_create () throw () |
Get interface creation type watch list. More... | |
ObservedInterfaceLockMap * | bbio_get_observed_destroy () throw () |
Get interface destriction type watch list. More... | |
![]() | |
void | bbil_add_data_interface (Interface *interface) |
Add an interface to the data modification watch list. More... | |
void | bbil_add_message_interface (Interface *interface) |
Add an interface to the message received watch list. More... | |
void | bbil_add_reader_interface (Interface *interface) |
Add an interface to the reader addition/removal watch list. More... | |
void | bbil_add_writer_interface (Interface *interface) |
Add an interface to the writer addition/removal watch list. More... | |
void | bbil_remove_data_interface (Interface *interface) |
Remove an interface to the data modification watch list. More... | |
void | bbil_remove_message_interface (Interface *interface) |
Remove an interface to the message received watch list. More... | |
void | bbil_remove_reader_interface (Interface *interface) |
Remove an interface to the reader addition/removal watch list. More... | |
void | bbil_remove_writer_interface (Interface *interface) |
Remove an interface to the writer addition/removal watch list. More... | |
Interface * | bbil_data_interface (const char *iuid) throw () |
Get interface instance for given UID. More... | |
Interface * | bbil_message_interface (const char *iuid) throw () |
Get interface instance for given UID. More... | |
Interface * | bbil_reader_interface (const char *iuid) throw () |
Get interface instance for given UID. More... | |
Interface * | bbil_writer_interface (const char *iuid) throw () |
Get interface instance for given UID. More... | |
![]() | |
bool | enabled_ |
Flag to mark the transformer as disabled. More... | |
M_StringToCompactFrameID | frameIDs_ |
Map from frame IDs to frame numbers. More... | |
std::vector< std::string > | frameIDs_reverse |
Map from CompactFrameID frame_id_numbers to string for debugging and output. More... | |
std::map< CompactFrameID, std::string > | frame_authority_ |
Map to lookup the most recent authority for a given frame. More... | |
std::vector< TimeCache * > | frames_ |
The pointers to potential frames that the tree can be made of. More... | |
Mutex * | frame_mutex_ |
A mutex to protect testing and allocating new frames on the above vector. More... | |
float | cache_time_ |
How long to cache transform history. More... | |
float | max_extrapolation_distance_ |
whether or not to allow extrapolation More... | |
std::string | tf_prefix_ |
transform prefix to apply as necessary More... | |
bool | fall_back_to_wall_time_ |
Set to true to allow falling back to wall time. More... | |
Receive transforms and answer queries.
This class connects to the blackboard and listens to all interfaces publishing transforms. It opens all interfaces of type TransformInterface with a TF prefix. The data is internally cached. Queries are then resolved based on the received information.
Definition at line 74 of file transform_listener.h.
fawkes::tf::TransformListener::TransformListener | ( | BlackBoard * | bb | ) |
Constructor.
bb | blackboard to listen to |
Definition at line 80 of file transform_listener.cpp.
References fawkes::BlackBoardInterfaceListener::bbil_add_data_interface(), fawkes::BlackBoardInterfaceObserver::bbio_add_observed_create(), fawkes::BlackBoard::open_multiple_for_reading(), fawkes::BlackBoard::register_listener(), fawkes::BlackBoard::register_observer(), and fawkes::tf::Transformer::set_enabled().
|
virtual |
Destructor.
Definition at line 103 of file transform_listener.cpp.
References fawkes::BlackBoard::close(), fawkes::BlackBoard::unregister_listener(), and fawkes::BlackBoard::unregister_observer().
|
virtual |
BlackBoard interface created notification.
This is called whenever an interface is created for a type that you registered for.
type | type of the interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call |
id | ID of the newly created interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call |
Reimplemented from fawkes::BlackBoardInterfaceObserver.
Definition at line 129 of file transform_listener.cpp.
|
virtual |
BlackBoard data changed notification.
This is called whenever the data in an interface that you registered for is modified. This happens if a writer calls the Interface::write() method.
interface | interface instance that you supplied to bbil_add_data_interface() |
Reimplemented from fawkes::BlackBoardInterfaceListener.
Definition at line 193 of file transform_listener.cpp.
References fawkes::TransformInterface::child_frame(), fawkes::TransformInterface::frame(), fawkes::Interface::read(), fawkes::TransformInterface::rotation(), fawkes::Interface::timestamp(), and fawkes::TransformInterface::translation().
|
virtual |
A reading instance has been closed for a watched interface.
This is called whenever a reading instance of an interface you are watching is closed.
interface | interface instance that you supplied to bbil_add_reader_interface() |
instance_serial | the instance serial of the reading instance that has just been removed. |
Reimplemented from fawkes::BlackBoardInterfaceListener.
Definition at line 161 of file transform_listener.cpp.
|
virtual |
A writing instance has been closed for a watched interface.
This is called whenever a writing instance of an interface you are watching is closed.
interface | interface instance that you supplied to bbil_add_writer_interface() |
instance_serial | the instance serial of the writing instance that has just been removed. |
Reimplemented from fawkes::BlackBoardInterfaceListener.
Definition at line 152 of file transform_listener.cpp.
std::string fawkes::tf::TransformListener::resolve | ( | const std::string & | frame_name | ) |
Resolve transform name.
frame_name | frame name |
Definition at line 123 of file transform_listener.cpp.