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 <core/threading/thread.h>
27 #include <aspect/logging.h>
28 #include <aspect/configurable.h>
29 #include <aspect/clock.h>
30 #include <aspect/blocked_timing.h>
31 #include <aspect/aspect_provider.h>
32 #include <plugins/gazebo/aspect/gazebo_inifin.h>
33 #include <utils/time/time.h>
34 #include <string.h>
35 
36 #include <sys/types.h>
37 
38 namespace gazebo {
39  namespace transport {
40  class Node;
41  }
42 }
43 
45 : public fawkes::Thread,
47  public fawkes::LoggingAspect,
49  public fawkes::ClockAspect,
51 {
52  public:
54  virtual ~GazeboNodeThread();
55 
56  virtual void init();
57  virtual void loop();
58  virtual void finalize();
59 
60  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
61  protected: virtual void run() { Thread::run(); }
62 
63  private:
64  //Node for communication to gazebo-robot-plugins
65  gazebo::transport::NodePtr __gazebonode;
66  //Node to control the gazebo world (e.g. spawn visual objects)
67  gazebo::transport::NodePtr __gazebo_world_node;
68  //Publisher to send Messages:
69  gazebo::transport::PublisherPtr __visual_publisher, __model_publisher, __request_publisher, __light_publisher;
70 
71  fawkes::GazeboAspectIniFin __gazebo_aspect_inifin;
72 
73  //channel of a specified robot for the gazebo node communication
74  std::string robot_channel, world_name;
75 };
76 
77 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Definition: gps.h:30
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: node_thread.h:61
Gazebo node handle thread.
Definition: node_thread.h:44
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to use blocked timing.
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
GazeboAspect initializer/finalizer.
Definition: gazebo_inifin.h:38