00001 /* 00002 * Copyright 2018, Magazino GmbH, Sebastian Pütz, Jorge Santos Simón 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above 00012 * copyright notice, this list of conditions and the following 00013 * disclaimer in the documentation and/or other materials provided 00014 * with the distribution. 00015 * 00016 * 3. Neither the name of the copyright holder nor the names of its 00017 * contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00024 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00025 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00026 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00028 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00029 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00030 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00031 * POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 * move_base_server_node.cpp 00034 * 00035 * authors: 00036 * Sebastian Pütz <spuetz@uni-osnabrueck.de> 00037 * Jorge Santos Simón <santos@magazino.eu> 00038 * 00039 */ 00040 00041 #include "mbf_costmap_nav/costmap_navigation_server.h" 00042 #include <signal.h> 00043 #include <mbf_utility/types.h> 00044 #include <tf2_ros/transform_listener.h> 00045 00046 typedef boost::shared_ptr<mbf_costmap_nav::CostmapNavigationServer> CostmapNavigationServerPtr; 00047 mbf_costmap_nav::CostmapNavigationServer::Ptr costmap_nav_srv_ptr; 00048 00049 void sigintHandler(int sig) 00050 { 00051 ROS_INFO_STREAM("Shutdown costmap navigation server."); 00052 if(costmap_nav_srv_ptr) 00053 { 00054 costmap_nav_srv_ptr->stop(); 00055 } 00056 ros::shutdown(); 00057 } 00058 00059 int main(int argc, char **argv) 00060 { 00061 ros::init(argc, argv, "mbf_2d_nav_server", ros::init_options::NoSigintHandler); 00062 00063 ros::NodeHandle nh; 00064 ros::NodeHandle private_nh("~"); 00065 00066 double cache_time; 00067 private_nh.param("tf_cache_time", cache_time, 10.0); 00068 00069 signal(SIGINT, sigintHandler); 00070 #ifdef USE_OLD_TF 00071 TFPtr tf_listener_ptr(new TF(nh, ros::Duration(cache_time), true)); 00072 #else 00073 TFPtr tf_listener_ptr(new TF(ros::Duration(cache_time))); 00074 tf2_ros::TransformListener tf_listener(*tf_listener_ptr); 00075 #endif 00076 costmap_nav_srv_ptr = boost::make_shared<mbf_costmap_nav::CostmapNavigationServer>(tf_listener_ptr); 00077 ros::spin(); 00078 return EXIT_SUCCESS; 00079 }