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 <aspect/aspect_provider.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/clock.h>
29 #include <aspect/configurable.h>
30 #include <aspect/logging.h>
31 #include <core/threading/thread.h>
32 #include <core/utils/lockptr.h>
33 #include <plugins/ros/aspect/ros_inifin.h>
34 #include <sys/types.h>
35 #include <utils/time/time.h>
36 
37 namespace ros {
38 class NodeHandle;
39 class AsyncSpinner;
40 } // namespace ros
41 
44  public fawkes::LoggingAspect,
46  public fawkes::ClockAspect,
48 {
49 public:
50  ROSNodeThread();
51  virtual ~ROSNodeThread();
52 
53  virtual void init();
54  virtual void loop();
55  virtual void finalize();
56 
57  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
58 protected:
59  virtual void
60  run()
61  {
62  Thread::run();
63  }
64 
65 private:
66  bool cfg_async_spinning_;
67  unsigned int cfg_async_num_threads_;
68 
70  fawkes::ROSAspectIniFin ros_aspect_inifin_;
71 
72  ros::AsyncSpinner *async_spinner_;
73 };
74 
75 #endif
ROSNodeThread::~ROSNodeThread
virtual ~ROSNodeThread()
Destructor.
Definition: node_thread.cpp:47
ROSNodeThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: node_thread.h:60
fawkes::LockPtr< ros::NodeHandle >
ROSNodeThread::ROSNodeThread
ROSNodeThread()
Constructor.
Definition: node_thread.cpp:39
fawkes::AspectProviderAspect
Thread aspect provide a new aspect.
Definition: aspect_provider.h:36
fawkes::BlockedTimingAspect
Thread aspect to use blocked timing.
Definition: blocked_timing.h:51
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
ROSNodeThread::init
virtual void init()
Initialize the thread.
Definition: node_thread.cpp:52
ROSNodeThread
ROS node handle thread.
Definition: node_thread.h:48
fawkes::ROSAspectIniFin
ROSAspect initializer/finalizer.
Definition: ros_inifin.h:33
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
ROSNodeThread::finalize
virtual void finalize()
Finalize the thread.
Definition: node_thread.cpp:99
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
ROSNodeThread::loop
virtual void loop()
Code to execute in the thread.
Definition: node_thread.cpp:112