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
37namespace ros {
38class NodeHandle;
39class AsyncSpinner;
40} // namespace ros
41
48{
49public:
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() */
58protected:
59 virtual void
61 {
62 Thread::run();
63 }
64
65private:
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
ROS node handle thread.
Definition: node_thread.h:48
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: node_thread.h:60
virtual void init()
Initialize the thread.
Definition: node_thread.cpp:52
virtual void loop()
Code to execute in the thread.
ROSNodeThread()
Constructor.
Definition: node_thread.cpp:39
virtual void finalize()
Finalize the thread.
Definition: node_thread.cpp:99
virtual ~ROSNodeThread()
Destructor.
Definition: node_thread.cpp:47
Thread aspect provide a new aspect.
Thread aspect to use blocked timing.
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
Thread aspect to log output.
Definition: logging.h:33
ROSAspect initializer/finalizer.
Definition: ros_inifin.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46