Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::tf::TransformListener Class Reference

Receive transforms and answer queries. More...

#include <>>

Inheritance diagram for fawkes::tf::TransformListener:

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...
 
- Public Member Functions inherited from fawkes::tf::Transformer
 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 TimeCacheget_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...
 
- Public Member Functions inherited from fawkes::BlackBoardInterfaceObserver
 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...
 
- Public Member Functions inherited from fawkes::BlackBoardInterfaceListener
 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

- Public Types inherited from fawkes::BlackBoardInterfaceListener
enum  QueueEntryType { DATA = 0, MESSAGES = 1, READER = 2, WRITER = 3 }
 Queue entry type. More...
 
typedef std::list< QueueEntryInterfaceQueue
 Queue of additions/removal of interfaces. More...
 
typedef std::map< std::string,
Interface * > 
InterfaceMap
 Map of currently active event subscriptions. More...
 
- Static Public Attributes inherited from fawkes::tf::Transformer
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...
 
- Protected Types inherited from fawkes::tf::Transformer
typedef std::unordered_map
< std::string, CompactFrameID > 
M_StringToCompactFrameID
 Map from string frame ids to CompactFrameID. More...
 
- Protected Types inherited from fawkes::BlackBoardInterfaceObserver
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...
 
- Protected Member Functions inherited from fawkes::tf::Transformer
TimeCacheget_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...
 
- Protected Member Functions inherited from fawkes::BlackBoardInterfaceObserver
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...
 
ObservedInterfaceLockMapbbio_get_observed_create () throw ()
 Get interface creation type watch list. More...
 
ObservedInterfaceLockMapbbio_get_observed_destroy () throw ()
 Get interface destriction type watch list. More...
 
- Protected Member Functions inherited from fawkes::BlackBoardInterfaceListener
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...
 
Interfacebbil_data_interface (const char *iuid) throw ()
 Get interface instance for given UID. More...
 
Interfacebbil_message_interface (const char *iuid) throw ()
 Get interface instance for given UID. More...
 
Interfacebbil_reader_interface (const char *iuid) throw ()
 Get interface instance for given UID. More...
 
Interfacebbil_writer_interface (const char *iuid) throw ()
 Get interface instance for given UID. More...
 
- Protected Attributes inherited from fawkes::tf::Transformer
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...
 
Mutexframe_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...
 

Detailed Description

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.

Author
Tim Niemueller

Definition at line 74 of file transform_listener.h.

Constructor & Destructor Documentation

fawkes::tf::TransformListener::~TransformListener ( )
virtual

Member Function Documentation

void fawkes::tf::TransformListener::bb_interface_created ( const char *  type,
const char *  id 
) throw ()
virtual

BlackBoard interface created notification.

This is called whenever an interface is created for a type that you registered for.

Parameters
typetype 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
idID 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.

void fawkes::tf::TransformListener::bb_interface_data_changed ( Interface interface) throw ()
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.

Parameters
interfaceinterface 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().

void fawkes::tf::TransformListener::bb_interface_reader_removed ( Interface interface,
unsigned int  instance_serial 
) throw ()
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.

Parameters
interfaceinterface instance that you supplied to bbil_add_reader_interface()
instance_serialthe instance serial of the reading instance that has just been removed.

Reimplemented from fawkes::BlackBoardInterfaceListener.

Definition at line 161 of file transform_listener.cpp.

void fawkes::tf::TransformListener::bb_interface_writer_removed ( Interface interface,
unsigned int  instance_serial 
) throw ()
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.

Parameters
interfaceinterface instance that you supplied to bbil_add_writer_interface()
instance_serialthe 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.

Parameters
frame_nameframe name
Returns
resolved frame name

Definition at line 123 of file transform_listener.cpp.


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