octomap_server_nodelet.cpp
Go to the documentation of this file.
00001 
00007 /*
00008  * Copyright (c) 2012, Marcus Liebhardt, Yujin Robot
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions are met:
00013  *
00014  *     * Redistributions of source code must retain the above copyright
00015  *       notice, this list of conditions and the following disclaimer.
00016  *     * Redistributions in binary form must reproduce the above copyright
00017  *       notice, this list of conditions and the following disclaimer in the
00018  *       documentation and/or other materials provided with the distribution.
00019  *     * Neither the name of Yujin Robot nor the names of its
00020  *       contributors may be used to endorse or promote products derived from
00021  *       this software without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  * POSSIBILITY OF SUCH DAMAGE.
00034  */
00035 
00036 
00037 #include <ros/ros.h>
00038 #include <octomap_server/OctomapServer.h>
00039 #include <pluginlib/class_list_macros.h>
00040 #include <nodelet/nodelet.h>
00041 
00042 
00043 namespace octomap_server
00044 {
00045 
00046 class OctomapServerNodelet : public nodelet::Nodelet
00047 {
00048 public:
00049   virtual void onInit()
00050   {
00051     NODELET_DEBUG("Initializing octomap server nodelet ...");
00052     ros::NodeHandle& private_nh = this->getPrivateNodeHandle();
00053     server_.reset(new OctomapServer(private_nh));
00054 
00055     std::string mapFilename("");
00056     if (private_nh.getParam("map_file", mapFilename)) {
00057       if (!server_->openFile(mapFilename)){
00058         NODELET_WARN("Could not open file %s", mapFilename.c_str());
00059       }
00060     }
00061   }
00062 private:
00063   boost::shared_ptr<OctomapServer> server_;
00064 };
00065 
00066 } // namespace
00067 
00068 PLUGINLIB_DECLARE_CLASS(octomap_server, OctomapServerNodelet, octomap_server::OctomapServerNodelet, nodelet::Nodelet);


octomap_server
Author(s): Armin Hornung
autogenerated on Sat Jun 8 2019 19:23:48