$search
00001 /****************************************************************************** 00002 * \file 00003 * $Id: servernode.cpp 834 2012-05-23 16:36:59Z spanel $ 00004 * 00005 * Modified by dcgm-robotics@FIT group. 00006 * 00007 * Author: Vit Stancl (stancl@fit.vutbr.cz) 00008 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00009 * Date: dd.mm.2011 00010 * 00011 * This code is derived from the OctoMap server provided by A. Hornung. 00012 * Please, see the original comments below. 00013 */ 00014 00053 #include <ros/ros.h> 00054 #include <srs_env_model/but_server/but_server.h> 00055 00056 #define USAGE "\nUSAGE: octomap_server <map.bt>\n" \ 00057 " map.bt: octomap 3D map file to read\n" 00058 00059 int main(int argc, char** argv){ 00060 ros::init(argc, argv, "but_env_model"); 00061 std::string mapFilename(""); 00062 00063 if (argc > 2 || (argc == 2 && std::string(argv[1]) == "-h")){ 00064 ROS_ERROR("%s", USAGE); 00065 exit(-1); 00066 } 00067 00068 std::cerr << "Number of octomap server parameters: " << argc << std::endl; 00069 00070 00071 if (argc == 2) 00072 { 00073 std::cerr << "Trying to load input octomap file: " << argv[1] << std::endl; 00074 mapFilename = std::string(argv[1]); 00075 } 00076 try{ 00077 // Run server 00078 srs_env_model::CButServer ms(mapFilename); 00079 ros::Rate loop_rate(10); 00080 00081 int count = 0; 00082 00083 while (ros::ok()) 00084 { 00085 ros::spinOnce(); 00086 00087 loop_rate.sleep(); 00088 ++count; 00089 } 00090 }catch(std::runtime_error& e){ 00091 ROS_ERROR("octomap_server exception: %s", e.what()); 00092 return -1; 00093 } 00094 00095 00096 return 0; 00097 }