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>
40 #include <nodelet/nodelet.h>
41 
42 
43 namespace octomap_server
44 {
45 
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:
65 };
66 
67 } // namespace
68 
#define NODELET_WARN(...)
PLUGINLIB_EXPORT_CLASS(BAGReader, nodelet::Nodelet)
ros::NodeHandle & getPrivateNodeHandle() const
boost::shared_ptr< OctomapServer > server_
ros::NodeHandle & getNodeHandle() const
bool getParam(const std::string &key, std::string &s) const
#define NODELET_DEBUG(...)


octomap_server
Author(s): Armin Hornung
autogenerated on Tue Jan 26 2021 03:27:07