Fawkes API  Fawkes Development Version
gazebo.cpp
1 
2 /***************************************************************************
3  * gazebo.cpp - Gazebo aspect for Fawkes
4  *
5  * Created: Fri Aug 24 09:24:31 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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <plugins/gazebo/aspect/gazebo.h>
25 #include <stdio.h>
26 
27 namespace fawkes {
28 #if 0 /* just to make Emacs auto-indent happy */
29 }
30 #endif
31 
32 /** @class GazeboAspect <plugins/gazebo/aspect/gazebo.h>
33  * Thread aspect to get access to a Gazebo node handle.
34  * Give this aspect to your thread to interact with the central Gazebo
35  * node handle.
36  * You can also control the simulation by sending messages
37  * via the provided publishers
38  *
39  * @ingroup Aspects
40  * @author Bastian Klingen, Frederik Zwilling
41  */
42 
43 /** @var fawkes:LockPtr<gazebo::NodeHandle> GazeboAspect::gazebonode
44  * Central Gazebo node handle. Make sure you use proper locking in your
45  * application when using the class, or chaos and havoc will come upon you.
46  */
47 
48 /** Constructor. */
50 {
51  add_aspect("GazeboAspect");
52 }
53 
54 
55 /** Virtual empty destructor. */
57 {
58 }
59 
60 
61 /** Init Gazebo aspect.
62  * This set the Gazebo node handle.
63  * It is guaranteed that this is called for an Gazebo Thread before start
64  * is called (when running regularly inside Fawkes).
65  * @param gazebonode Gazebo node handle
66  */
67 void
68 GazeboAspect::init_GazeboAspect(gazebo::transport::NodePtr gazebonode , gazebo::transport::NodePtr gazebo_world_node)
69 {
70  this->gazebonode = gazebonode;
71  this->gazebo_world_node = gazebo_world_node;
72 }
73 
74 /** Finalize Gazebo aspect.
75  * This clears the Gazebo node handle.
76  */
77 void
78 GazeboAspect::finalize_GazeboAspect()
79 {
80  gazebonode.reset();
81 }
82 
83 } // end namespace fawkes
Fawkes library namespace.
gazebo::transport::NodePtr gazebo_world_node
Gazebo Node for communication with the world (e.g.
Definition: gazebo.h:52
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:52
virtual ~GazeboAspect()
Virtual empty destructor.
Definition: gazebo.cpp:56
gazebo::transport::NodePtr gazebonode
Gazebo Node for communication with a robot.
Definition: gazebo.h:47
GazeboAspect()
Constructor.
Definition: gazebo.cpp:49