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 <aspect/blackboard.h>
25 #include <aspect/clock.h>
26 #include <aspect/configurable.h>
27 #include <aspect/logging.h>
28 #include <core/threading/thread.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::LoggingAspect,
40  public fawkes::ClockAspect,
41  public fawkes::ROSAspect
42 {
43 public:
45 
46  virtual void init();
47  virtual void loop();
48  virtual void finalize();
49 
50  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
51 protected:
52  virtual void
53  run()
54  {
55  Thread::run();
56  }
57 
58 private:
59  void publish_clock();
60 
61 private:
62  ros::Publisher pub_;
63  bool set_local_;
64  unsigned int cfg_freq_;
65 
66  fawkes::TimeWait *time_wait_;
67 };
68 
69 #endif
RosClockThread::RosClockThread
RosClockThread()
Constructor.
Definition: clock_thread.cpp:34
RosClockThread
Thread to publish clock to ROS.
Definition: clock_thread.h:42
fawkes::BlackBoardAspect
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
fawkes
Fawkes library namespace.
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
RosClockThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: clock_thread.h:53
fawkes::ROSAspect
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
RosClockThread::finalize
virtual void finalize()
Finalize the thread.
Definition: clock_thread.cpp:56
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::TimeWait
Time wait utility.
Definition: wait.h:33
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
RosClockThread::init
virtual void init()
Initialize the thread.
Definition: clock_thread.cpp:40
RosClockThread::loop
virtual void loop()
Code to execute in the thread.
Definition: clock_thread.cpp:85