Fawkes API Fawkes Development Version
tf.h
1
2/***************************************************************************
3 * tf.h - Transform aspect for Fawkes
4 *
5 * Created: Tue Oct 25 21:33:21 2011
6 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. A runtime exception applies to
13 * this software (see LICENSE.GPL_WRE file mentioned below for details).
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21 */
22
23#ifndef _ASPECT_TF_H_
24#define _ASPECT_TF_H_
25
26#ifndef HAVE_TF
27# error TF not available. Forgot to add CFLAGS_TF?
28#endif
29
30#include <aspect/aspect.h>
31#include <tf/transform_publisher.h>
32#include <tf/transformer.h>
33
34namespace fawkes {
35
36class BlackBoard;
37
38class TransformAspect : public virtual Aspect
39{
40public:
41 /** Enumeration describing the desired mode of operation. */
42 typedef enum {
43 ONLY_LISTENER, ///< only create a transform listener
44 ONLY_PUBLISHER, ///< only create a transform publisher
45 DEFER_PUBLISHER, /**< Create neither listener or publisher, but allow late
46 * enabling of a publisher using tf_enable_publisher() or tf_add_publisher() in init().
47 * Note that this requires to pass a valid (unique) tf_bb_iface_id
48 * to the constructor. */
49 BOTH, ///< create both, transform listener and publisher
50 BOTH_DEFER_PUBLISHER /**< create transform listener but defer creation of publisher,
51 * cf. DEFER_PUBLISHER mode documentation above for details. */
53
54 TransformAspect(Mode mode = ONLY_LISTENER, const char *frame_id = 0);
55 virtual ~TransformAspect();
56
57 void init_TransformAspect(BlackBoard * blackboard,
58 tf::Transformer *transformer,
59 const char * thread_name);
61
62protected: // methods
63 void tf_enable_publisher(const char *frame_id = 0);
64 void tf_add_publisher(const char *frame_id_format, ...);
65
66protected: // members
69
70 std::map<std::string, tf::TransformPublisher *> tf_publishers;
71
72private:
73 Mode tf_aspect_mode_;
74 char * tf_aspect_frame_id_;
75 BlackBoard *tf_aspect_blackboard_;
76};
77
78} // end namespace fawkes
79
80#endif
Fawkes aspect base class.
Definition: aspect.h:32
The BlackBoard abstract class.
Definition: blackboard.h:46
Thread aspect to access the transform system.
Definition: tf.h:39
Mode
Enumeration describing the desired mode of operation.
Definition: tf.h:42
@ ONLY_LISTENER
only create a transform listener
Definition: tf.h:43
@ ONLY_PUBLISHER
only create a transform publisher
Definition: tf.h:44
@ BOTH
create both, transform listener and publisher
Definition: tf.h:49
@ BOTH_DEFER_PUBLISHER
create transform listener but defer creation of publisher, cf.
Definition: tf.h:50
@ DEFER_PUBLISHER
Create neither listener or publisher, but allow late enabling of a publisher using tf_enable_publishe...
Definition: tf.h:45
void tf_enable_publisher(const char *frame_id=0)
Late enabling of publisher.
Definition: tf.cpp:145
tf::TransformPublisher * tf_publisher
This is the transform publisher which can be used to publish transforms via the blackboard.
Definition: tf.h:68
void init_TransformAspect(BlackBoard *blackboard, tf::Transformer *transformer, const char *thread_name)
Init transform aspect.
Definition: tf.cpp:101
std::map< std::string, tf::TransformPublisher * > tf_publishers
Map of transform publishers created through the aspect.
Definition: tf.h:70
TransformAspect(Mode mode=ONLY_LISTENER, const char *frame_id=0)
Constructor.
Definition: tf.cpp:74
virtual ~TransformAspect()
Virtual empty destructor.
Definition: tf.cpp:88
void tf_add_publisher(const char *frame_id_format,...)
Late add of publisher.
Definition: tf.cpp:186
tf::Transformer * tf_listener
This is the transform listener which saves transforms published by other threads in the system.
Definition: tf.h:67
void finalize_TransformAspect()
Finalize transform aspect.
Definition: tf.cpp:214
Utility class to send transforms.
Coordinate transforms between any two frames in a system.
Definition: transformer.h:65
Fawkes library namespace.