move_base_server_node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Magazino GmbH, Sebastian Pütz, Jorge Santos Simón
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * move_base_server_node.cpp
34  *
35  * authors:
36  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
37  * Jorge Santos Simón <santos@magazino.eu>
38  *
39  */
40 
42 #include <signal.h>
43 #include <mbf_utility/types.h>
45 
48 
49 void sigintHandler(int sig)
50 {
51  ROS_INFO_STREAM("Shutdown costmap navigation server.");
52  if(costmap_nav_srv_ptr)
53  {
54  costmap_nav_srv_ptr->stop();
55  }
56  ros::shutdown();
57 }
58 
59 int main(int argc, char **argv)
60 {
61  ros::init(argc, argv, "mbf_2d_nav_server", ros::init_options::NoSigintHandler);
62 
63  ros::NodeHandle nh;
64  ros::NodeHandle private_nh("~");
65 
66  double cache_time;
67  private_nh.param("tf_cache_time", cache_time, 10.0);
68 
69  signal(SIGINT, sigintHandler);
70 #ifdef USE_OLD_TF
71  TFPtr tf_listener_ptr(new TF(nh, ros::Duration(cache_time), true));
72 #else
73  TFPtr tf_listener_ptr(new TF(ros::Duration(cache_time)));
74  tf2_ros::TransformListener tf_listener(*tf_listener_ptr);
75 #endif
76  costmap_nav_srv_ptr = boost::make_shared<mbf_costmap_nav::CostmapNavigationServer>(tf_listener_ptr);
77  ros::spin();
78  return EXIT_SUCCESS;
79 }
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
mbf_costmap_nav::CostmapNavigationServer::Ptr costmap_nav_srv_ptr
boost::shared_ptr< mbf_costmap_nav::CostmapNavigationServer > CostmapNavigationServerPtr
bool param(const std::string &param_name, T &param_val, const T &default_val) const
#define ROS_INFO_STREAM(args)
void sigintHandler(int sig)
ROSCPP_DECL void shutdown()
int main(int argc, char **argv)


mbf_costmap_nav
Author(s): Sebastian Pütz
autogenerated on Tue Jun 18 2019 19:34:40