Fawkes API
Fawkes Development Version
|
Thread aspect to access the transform system. More...
#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 |
This is the transform listener which saves transforms published by other threads in the system. More... | |
tf::TransformPublisher * | tf_publisher |
This is the transform publisher which can be used to publish transforms via the blackboard. More... | |
std::map< std::string, tf::TransformPublisher * > | tf_publishers |
Map of transform publishers created through the aspect. More... | |
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 |
||
) |
Constructor.
mode | mode of operation |
frame_id | ID of frame to create publisher for, can be zero if creating of publisher is omitted or deferred. |
Definition at line 78 of file tf.cpp.
References fawkes::Aspect::add_aspect(), BOTH, BOTH_DEFER_PUBLISHER, DEFER_PUBLISHER, and ONLY_PUBLISHER.
|
virtual |
void fawkes::TransformAspect::finalize_TransformAspect | ( | ) |
Finalize transform aspect.
This deletes the transform listener and publisher.
Definition at line 227 of file tf.cpp.
References tf_listener, tf_publisher, and tf_publishers.
Referenced by fawkes::TransformAspectIniFin::finalize().
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 108 of file tf.cpp.
References BOTH, BOTH_DEFER_PUBLISHER, ONLY_LISTENER, ONLY_PUBLISHER, tf_listener, tf_publisher, and tf_publishers.
Referenced by fawkes::TransformAspectIniFin::init().
|
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. |
Definition at line 198 of file tf.cpp.
References BOTH_DEFER_PUBLISHER, DEFER_PUBLISHER, and tf_publishers.
Referenced by RosTfThread::bb_interface_reader_removed(), and StaticTransformsThread::finalize().
|
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 156 of file tf.cpp.
References BOTH_DEFER_PUBLISHER, DEFER_PUBLISHER, tf_publisher, and tf_publishers.
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 NavGraphClustersThread::blocked_edges_centroids(), ClipsTFThread::clips_context_destroyed(), MapLaserGenThread::finalize(), finalize_TransformAspect(), MongoLogTransformsThread::init(), PointCloudDBRetrieveThread::init(), PointCloudDBMergeThread::init(), ColliThread::init(), init_TransformAspect(), TfExampleThread::loop(), TabletopVisualizationThread::loop(), MapLaserGenThread::loop(), MongoLogTransformsThread::loop(), RosMoveBaseThread::loop(), LaserClusterThread::loop(), NavGraphThread::loop(), ColliThread::loop(), LaserLinesThread::loop(), KatanaActThread::loop(), TabletopObjectsThread::loop(), RosMoveBaseThread::once(), KatanaActThread::once(), and NavGraphClustersThread::robot_pose().
|
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 RobotStatePublisherThread::bb_interface_data_changed(), finalize_TransformAspect(), init_TransformAspect(), TfExampleThread::loop(), MapLaserGenThread::loop(), LocalizationSimThread::loop(), RobotinoSimThread::loop(), Bumblebee2Thread::loop(), LaserLinesThread::loop(), RobotStatePublisherThread::loop(), and tf_enable_publisher().
|
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.
Definition at line 73 of file tf.h.
Referenced by RosTfThread::bb_interface_reader_removed(), StaticTransformsThread::finalize(), finalize_TransformAspect(), init_TransformAspect(), tf_add_publisher(), and tf_enable_publisher().