octomap_server_multilayer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2013, A. Hornung, University of Freiburg
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the University of Freiburg nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 
31 #include <ros/ros.h>
33 
34 #define USAGE "\nUSAGE: octomap_server_multilayer <map.bt>\n" \
35  " map.bt: inital octomap 3D map file to read\n"
36 
37 using namespace octomap_server;
38 
39 int main(int argc, char** argv){
40  ros::init(argc, argv, "octomap_server_multilayer");
41  std::string mapFilename("");
42 
43  if (argc > 2 || (argc == 2 && std::string(argv[1]) == "-h")){
44  ROS_ERROR("%s", USAGE);
45  exit(-1);
46  }
47 
48 
50  ros::spinOnce();
51 
52  if (argc == 2){
53  mapFilename = std::string(argv[1]);
54  if (!server.openFile(mapFilename)){
55  ROS_ERROR("Could not open file %s", mapFilename.c_str());
56  exit(1);
57  }
58  }
59 
60 
61 
62 
63  try{
64  ros::spin();
65  }catch(std::runtime_error& e){
66  ROS_ERROR("octomap_server_multilayer exception: %s", e.what());
67  return -1;
68  }
69 
70  return 0;
71 }
#define USAGE
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
ROSCPP_DECL void spinOnce()
#define ROS_ERROR(...)
virtual bool openFile(const std::string &filename)
int main(int argc, char **argv)


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