Fawkes API  Fawkes Development Version
static_transforms_thread.h
1 
2 /***************************************************************************
3  * static_transform_thread.h - Static transform publisher thread
4  *
5  * Created: Tue Oct 25 16:32:04 2011
6  * Copyright 2011 Tim Niemueller [www.niemueller.de]
7  * 2014 Tobias Neumann
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
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 file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_STATIC_TRANSFORMS_STATIC_TRANSFORMS_THREAD_H_
24 #define __PLUGINS_STATIC_TRANSFORMS_STATIC_TRANSFORMS_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/clock.h>
29 #include <aspect/configurable.h>
30 #include <aspect/logging.h>
31 #include <aspect/blackboard.h>
32 #include <aspect/tf.h>
33 #include <config/change_handler.h>
34 
35 namespace fawkes {
36  class Time;
37 }
38 
40 : public fawkes::Thread,
41  public fawkes::ClockAspect,
42  public fawkes::LoggingAspect,
47 {
48  public:
50  virtual ~StaticTransformsThread();
51 
52  virtual void init();
53  virtual void loop();
54  virtual void finalize();
55 
56  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
57  protected: virtual void run() { Thread::run(); }
58 
59  private:
60  /** Static transform entry to publish. */
61  typedef struct {
62  std::string name; /**< Transform name */
63  fawkes::tf::StampedTransform *transform; /**< Transform. */
64  } Entry;
65 
66  std::list<Entry> __entries;
67 
68  void entries_delete();
69  void entries_get_from_config();
70 
71  virtual void config_tag_changed(const char *new_tag) { };
72  virtual void config_comment_changed(const fawkes::Configuration::ValueIterator *v) { };
73  virtual void config_value_changed(const fawkes::Configuration::ValueIterator *v);
74  virtual void config_value_erased(const char *path) {};
75 };
76 
77 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
virtual void run()
Stub to see name in backtrace for easier debugging.
Interface for configuration change handling.
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to access the transform system.
Definition: tf.h:42
Transform that contains a timestamp and frame IDs.
Definition: types.h:96
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
Thread to regularly publish static transforms.
Iterator interface to iterate over config values.
Definition: config.h:72