Fawkes API  Fawkes Development Version
node_thread.h
1 
2 /***************************************************************************
3  * node_thread.h - ROS node handle providing thread
4  *
5  * Created: Thu May 05 18:35:12 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
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_ROS_NODE_THREAD_H_
24 #define __PLUGINS_ROS_NODE_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <core/utils/lockptr.h>
28 #include <aspect/logging.h>
29 #include <aspect/configurable.h>
30 #include <aspect/clock.h>
31 #include <aspect/blocked_timing.h>
32 #include <aspect/aspect_provider.h>
33 #include <plugins/ros/aspect/ros_inifin.h>
34 #include <utils/time/time.h>
35 
36 #include <sys/types.h>
37 
38 namespace ros {
39  class NodeHandle;
40  class AsyncSpinner;
41 }
42 
44 : public fawkes::Thread,
46  public fawkes::LoggingAspect,
48  public fawkes::ClockAspect,
50 {
51  public:
52  ROSNodeThread();
53  virtual ~ROSNodeThread();
54 
55  virtual void init();
56  virtual void loop();
57  virtual void finalize();
58 
59  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
60  protected: virtual void run() { Thread::run(); }
61 
62  private:
63  bool cfg_async_spinning_;
64  unsigned int cfg_async_num_threads_;
65 
67  fawkes::ROSAspectIniFin ros_aspect_inifin_;
68 
69  ros::AsyncSpinner *async_spinner_;
70 };
71 
72 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: node_thread.h:60
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to use blocked timing.
ROS node handle thread.
Definition: node_thread.h:43
ROSAspect initializer/finalizer.
Definition: ros_inifin.h:35
Definition: act_thread.h:37
Thread aspect to log output.
Definition: logging.h:35
Thread aspect provide a new aspect.
Thread aspect to access configuration data.
Definition: configurable.h:35