Fawkes API  Fawkes Development Version
clock_thread.h
1 /***************************************************************************
2  * clock_thread.h - Thread to publish clock to ROS
3  *
4  * Created: Sun Jul 12 16:13:07 2015
5  * Copyright 2015 Tim Niemueller
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #ifndef __PLUGINS_ROS_CLOCK_THREAD_H_
22 #define __PLUGINS_ROS_CLOCK_THREAD_H_
23 
24 #include <core/threading/thread.h>
25 #include <aspect/logging.h>
26 #include <aspect/configurable.h>
27 #include <aspect/blackboard.h>
28 #include <aspect/clock.h>
29 #include <plugins/ros/aspect/ros.h>
30 #include <ros/node_handle.h>
31 
32 namespace fawkes {
33  class TimeWait;
34 }
35 
37 : public fawkes::Thread,
38  public fawkes::LoggingAspect,
41  public fawkes::ClockAspect,
42  public fawkes::ROSAspect
43 {
44  public:
46 
47  virtual void init();
48  virtual void loop();
49  virtual void finalize();
50 
51  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
52  protected: virtual void run() { Thread::run(); }
53 
54  private:
55  void publish_clock();
56 
57 private:
58  ros::Publisher pub_;
59  bool set_local_;
60  unsigned int cfg_freq_;
61 
62  fawkes::TimeWait *time_wait_;
63 };
64 
65 #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
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: clock_thread.h:52
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread to publish clock to ROS.
Definition: clock_thread.h:36
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
Time wait utility.
Definition: wait.h:32