Fawkes API  Fawkes Development Version
node_thread.h
1 
2 /***************************************************************************
3  * node_thread.h - Gazebo node handle providing thread
4  *
5  * Created: Fri Aug 24 11:04:04 2012
6  * Author Bastian Klingen, Frederik Zwilling
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_GAZEBO_NODE_THREAD_H_
24 #define _PLUGINS_GAZEBO_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 <plugins/gazebo/aspect/gazebo_inifin.h>
33 #include <sys/types.h>
34 #include <utils/time/time.h>
35 
36 #include <string.h>
37 
38 namespace gazebo {
39 namespace transport {
40 class Node;
41 }
42 } // namespace gazebo
43 
46  public fawkes::LoggingAspect,
48  public fawkes::ClockAspect,
50 {
51 public:
53  virtual ~GazeboNodeThread();
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:
61  virtual void
62  run()
63  {
64  Thread::run();
65  }
66 
67 private:
68  //Node for communication to gazebo-robot-plugins
69  gazebo::transport::NodePtr gazebonode_;
70  //Node to control the gazebo world (e.g. spawn visual objects)
71  gazebo::transport::NodePtr gazebo_world_node_;
72  // Heartbeat publisher
73  gazebo::transport::PublisherPtr status_publisher_;
74  //Publisher to send Messages:
75  gazebo::transport::PublisherPtr visual_publisher_, model_publisher_, request_publisher_,
76  light_publisher_;
77 
78  fawkes::GazeboAspectIniFin gazebo_aspect_inifin_;
79 };
80 
81 #endif
Gazebo node handle thread.
Definition: node_thread.h:50
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: node_thread.h:62
GazeboNodeThread()
Constructor.
Definition: node_thread.cpp:45
virtual void loop()
Code to execute in the thread.
Definition: node_thread.cpp:98
virtual void init()
Initialize the thread.
Definition: node_thread.cpp:58
virtual ~GazeboNodeThread()
Destructor.
Definition: node_thread.cpp:53
virtual void finalize()
Finalize the thread.
Definition: node_thread.cpp:87
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
GazeboAspect initializer/finalizer.
Definition: gazebo_inifin.h:36
Thread aspect to log output.
Definition: logging.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46