src
octomap_server_nodelet.cpp
Go to the documentation of this file.
1
7
/*
8
* Copyright (c) 2012, Marcus Liebhardt, Yujin Robot
9
* All rights reserved.
10
*
11
* Redistribution and use in source and binary forms, with or without
12
* modification, are permitted provided that the following conditions are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above copyright
17
* notice, this list of conditions and the following disclaimer in the
18
* documentation and/or other materials provided with the distribution.
19
* * Neither the name of Yujin Robot nor the names of its
20
* contributors may be used to endorse or promote products derived from
21
* this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
* POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
37
#include <
ros/ros.h
>
38
#include <
octomap_server/OctomapServer.h
>
39
#include <
pluginlib/class_list_macros.hpp
>
40
#include <
nodelet/nodelet.h
>
41
42
43
namespace
octomap_server
44
{
45
46
class
OctomapServerNodelet
:
public
nodelet::Nodelet
47
{
48
public
:
49
virtual
void
onInit
()
50
{
51
NODELET_DEBUG
(
"Initializing octomap server nodelet ..."
);
52
ros::NodeHandle
& nh = this->
getNodeHandle
();
53
ros::NodeHandle
& private_nh = this->
getPrivateNodeHandle
();
54
server_
.reset(
new
OctomapServer
(private_nh, nh));
55
56
std::string mapFilename(
""
);
57
if
(private_nh.
getParam
(
"map_file"
, mapFilename)) {
58
if
(!
server_
->openFile(mapFilename)){
59
NODELET_WARN
(
"Could not open file %s"
, mapFilename.c_str());
60
}
61
}
62
}
63
private
:
64
boost::shared_ptr<OctomapServer>
server_
;
65
};
66
67
}
// namespace
68
69
PLUGINLIB_EXPORT_CLASS
(
octomap_server::OctomapServerNodelet
,
nodelet::Nodelet
)
nodelet::Nodelet::getNodeHandle
ros::NodeHandle & getNodeHandle() const
boost::shared_ptr
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
ros.h
NODELET_WARN
#define NODELET_WARN(...)
OctomapServer.h
octomap_server::OctomapServerNodelet::onInit
virtual void onInit()
Definition:
octomap_server_nodelet.cpp:49
nodelet::Nodelet::getPrivateNodeHandle
ros::NodeHandle & getPrivateNodeHandle() const
PLUGINLIB_EXPORT_CLASS
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
octomap_server
Definition:
OctomapServer.h:80
nodelet::Nodelet
nodelet.h
class_list_macros.hpp
octomap_server::OctomapServer
Definition:
OctomapServer.h:81
octomap_server::OctomapServerNodelet
Definition:
octomap_server_nodelet.cpp:46
octomap_server::OctomapServerNodelet::server_
boost::shared_ptr< OctomapServer > server_
Definition:
octomap_server_nodelet.cpp:64
ros::NodeHandle
NODELET_DEBUG
#define NODELET_DEBUG(...)
octomap_server
Author(s): Armin Hornung
autogenerated on Mon Jan 2 2023 03:18:15