Fawkes API
Fawkes Development Version
|
#include <>>
Public Types | |
enum | Mode { ONLY_LISTENER, ONLY_PUBLISHER, DEFER_PUBLISHER, BOTH, BOTH_DEFER_PUBLISHER } |
Enumeration describing the desired mode of operation. More... | |
Public Member Functions | |
TransformAspect (Mode mode=ONLY_LISTENER, const char *frame_id=0) | |
Constructor. More... | |
virtual | ~TransformAspect () |
Virtual empty destructor. More... | |
void | init_TransformAspect (BlackBoard *blackboard, tf::Transformer *transformer, const char *thread_name) |
Init transform aspect. More... | |
void | finalize_TransformAspect () |
Finalize transform aspect. More... | |
![]() | |
const std::list< const char * > & | get_aspects () const |
Get list of aspect names attached to a aspected thread. More... | |
Protected Member Functions | |
void | tf_enable_publisher (const char *frame_id=0) |
Late enabling of publisher. More... | |
void | tf_add_publisher (const char *frame_id_format,...) |
Late add of publisher. More... | |
![]() | |
void | add_aspect (const char *name) |
Add an aspect to a thread. More... | |
Protected Attributes | |
tf::Transformer * | tf_listener |
tf::TransformPublisher * | tf_publisher |
std::map< std::string, tf::TransformPublisher * > | tf_publishers |
Thread aspect to access the transform system.
Give this aspect to your thread to gain access to the transform library. Depending on the parameters to the ctor only the listener or additionaly the publisher is created. It is guaranteed that if used properly from within plugins that the blackboard member has been initialized properly.
Enumeration describing the desired mode of operation.
Enumerator | |
---|---|
ONLY_LISTENER | only create a transform listener |
ONLY_PUBLISHER | only create a transform publisher |
DEFER_PUBLISHER | Create neither listener or publisher, but allow late enabling of a publisher using tf_enable_publisher() or tf_add_publisher() in init(). Note that this requires to pass a valid (unique) tf_bb_iface_id to the constructor. |
BOTH | create both, transform listener and publisher |
BOTH_DEFER_PUBLISHER | create transform listener but defer creation of publisher, cf. DEFER_PUBLISHER mode documentation above for details. |
fawkes::TransformAspect::TransformAspect | ( | Mode | mode = ONLY_LISTENER , |
const char * | frame_id = 0 |
||
) |
|
virtual |
void fawkes::TransformAspect::finalize_TransformAspect | ( | ) |
void fawkes::TransformAspect::init_TransformAspect | ( | BlackBoard * | blackboard, |
tf::Transformer * | transformer, | ||
const char * | thread_name | ||
) |
Init transform aspect.
This creates the listener and potentially publisher.
blackboard | blackboard used to create listener and/or publisher. |
transformer | system-wide shared transformer to pass to threads |
thread_name | name of thread opening publishers |
Definition at line 105 of file tf.cpp.
References BOTH.
|
protected |
Late add of publisher.
If and only if the TransformAspect has been initialized in DEFER_PUBLISHER or BOTH_DEFER_PUBLISHER mode additional transform publishers can be added using this method. It will create a new transform publisher with the given interface ID.
This method is intended to be used if it is unclear at construction time whether the publisher will be needed or not.
Exception | thrown if the TransformAspect is not initialized in DEFER_PUBLISHER or BOTH_DEFER_PUBLISHER mode. |
frame_id_format | format string of interface ID to create. See man printf for accepted patterns. If string starts with / is taken as is, otherwise "/tf/" is prepended to interface ID implicitly. |
|
protected |
Late enabling of publisher.
If and only if the TransformAspect has been initialized in DEFER_PUBLISHER or BOTH_DEFER_PUBLISHER mode the transform publisher can be enabled using this method. It will create a new transform publisher with the interface ID given as constructor parameter.
This method is intended to be used if it is unclear at construction time whether the publisher will be needed or not.
frame_id | Frame ID to use for publisher. This can only be passed if the frame_id passed to the constructor was null. |
Exception | thrown if the TransformAspect is not initialized in DEFER_PUBLISHER or BOTH_DEFER_PUBLISHER mode. |
Definition at line 149 of file tf.cpp.
Referenced by MapLaserGenThread::init(), and RobotinoSimThread::init().
|
protected |
This is the transform listener which saves transforms published by other threads in the system.
Definition at line 70 of file tf.h.
Referenced by MongoLogTransformsThread::init(), PointCloudDBRetrieveThread::init(), PointCloudDBMergeThread::init(), RobotMemoryThread::init(), ColliThread::init(), TfExampleThread::loop(), TabletopVisualizationThread::loop(), MongoLogTransformsThread::loop(), MapLaserGenThread::loop(), RosMoveBaseThread::loop(), NavGraphThread::loop(), ColliThread::loop(), KatanaActThread::loop(), and TabletopObjectsThread::loop().
|
protected |
This is the transform publisher which can be used to publish transforms via the blackboard. It is only created if the constructor taking the blackboard interface ID parameter is used!
Definition at line 71 of file tf.h.
Referenced by TfExampleThread::loop(), LocalizationSimThread::loop(), MapLaserGenThread::loop(), and Bumblebee2Thread::loop().
|
protected |
Map of transform publishers created through the aspect.
The maps key is the blackboard interface ID passed to either the constructor or tf_add_publisher(). The ID is used as passed, i.e., not with the /tf/ prefix which might be added by the TransformPublisher. The singular tf_publisher is also added to the map.