Fawkes API
Fawkes Development Version
ros.cpp
1
2
/***************************************************************************
3
* ros.cpp - ROS aspect for Fawkes
4
*
5
* Created: Thu May 05 15:53:31 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. 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/ros/aspect/ros.h>
25
#include <ros/node_handle.h>
26
27
namespace
fawkes
{
28
29
/** @class ROSAspect <plugins/ros/aspect/ros.h>
30
* Thread aspect to get access to a ROS node handle.
31
* Give this aspect to your thread to interact with the central ROS
32
* node handle.
33
*
34
* @ingroup Aspects
35
* @author Tim Niemueller
36
*/
37
38
/** @var fawkes:LockPtr<ros::NodeHandle> ROSAspect::rosnode
39
* Central ROS node handle. Make sure you use proper locking in your
40
* application when using the class, or chaos and havoc will come upon you.
41
*/
42
43
/** Constructor. */
44
ROSAspect::ROSAspect
()
45
{
46
add_aspect
(
"ROSAspect"
);
47
}
48
49
/** Virtual empty destructor. */
50
ROSAspect::~ROSAspect
()
51
{
52
}
53
54
/** Init ROS aspect.
55
* This set the ROS node handle.
56
* It is guaranteed that this is called for an ROS Thread before start
57
* is called (when running regularly inside Fawkes).
58
* @param rosnode ROS node handle
59
*/
60
void
61
ROSAspect::init_ROSAspect(
LockPtr<ros::NodeHandle>
rosnode)
62
{
63
this->rosnode =
rosnode
;
64
}
65
66
/** Finalize ROS aspect.
67
* This clears the ROS node handle.
68
*/
69
void
70
ROSAspect::finalize_ROSAspect()
71
{
72
rosnode
.
clear
();
73
}
74
75
}
// end namespace fawkes
fawkes::Aspect::add_aspect
void add_aspect(const char *name)
Add an aspect to a thread.
Definition:
aspect.cpp:53
fawkes::LockPtr< ros::NodeHandle >
fawkes::ROSAspect::rosnode
LockPtr< ros::NodeHandle > rosnode
Definition:
ros.h:46
fawkes::ROSAspect::~ROSAspect
virtual ~ROSAspect()
Virtual empty destructor.
Definition:
ros.cpp:54
fawkes
fawkes::LockPtr::clear
void clear()
Set underlying instance to 0, decrementing reference count of existing instance appropriately.
Definition:
lockptr.h:503
fawkes::ROSAspect::ROSAspect
ROSAspect()
Constructor.
Definition:
ros.cpp:48
src
plugins
ros
aspect
ros.cpp
Generated by
1.8.16