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 <aspect/blackboard.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/tf.h>
32 #include <config/change_handler.h>
33 #include <core/threading/thread.h>
34 
35 namespace fawkes {
36 class Time;
37 }
38 
40  public fawkes::ClockAspect,
41  public fawkes::LoggingAspect,
46 {
47 public:
49  virtual ~StaticTransformsThread();
50 
51  virtual void init();
52  virtual void loop();
53  virtual void finalize();
54 
55  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
56 protected:
57  virtual void
58  run()
59  {
60  Thread::run();
61  }
62 
63 private:
64  /** Static transform entry to publish. */
65  typedef struct
66  {
67  std::string name; /**< Transform name */
68  fawkes::tf::StampedTransform *transform; /**< Transform. */
69  } Entry;
70 
71  std::list<Entry> entries_;
72 
73  void entries_delete();
74  void entries_get_from_config();
75 
76  virtual void config_tag_changed(const char *new_tag){};
77  virtual void config_comment_changed(const fawkes::Configuration::ValueIterator *v){};
78  virtual void config_value_changed(const fawkes::Configuration::ValueIterator *v);
79  virtual void config_value_erased(const char *path){};
80 };
81 
82 #endif
Thread to regularly publish static transforms.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual ~StaticTransformsThread()
Destructor.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
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:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Interface for configuration change handling.
Iterator interface to iterate over config values.
Definition: config.h:75
Thread aspect to log output.
Definition: logging.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Thread aspect to access the transform system.
Definition: tf.h:39
Transform that contains a timestamp and frame IDs.
Definition: types.h:92
Fawkes library namespace.