src
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
41
#include "
mbf_costmap_nav/costmap_navigation_server.h
"
42
#include <signal.h>
43
#include <
mbf_utility/types.h
>
44
#include <
tf2_ros/transform_listener.h
>
45
46
typedef
boost::shared_ptr<mbf_costmap_nav::CostmapNavigationServer>
CostmapNavigationServerPtr
;
47
mbf_costmap_nav::CostmapNavigationServer::Ptr
costmap_nav_srv_ptr
;
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
79
// explicitly call destructor here, otherwise costmap_nav_srv_ptr will be
80
// destructed after tearing down internally allocated static variables
81
costmap_nav_srv_ptr
.reset();
82
return
EXIT_SUCCESS;
83
}
CostmapNavigationServerPtr
boost::shared_ptr< mbf_costmap_nav::CostmapNavigationServer > CostmapNavigationServerPtr
Definition:
move_base_server_node.cpp:46
boost::shared_ptr
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros::shutdown
ROSCPP_DECL void shutdown()
costmap_navigation_server.h
tf2_ros::TransformListener
sigintHandler
void sigintHandler(int sig)
Definition:
move_base_server_node.cpp:49
main
int main(int argc, char **argv)
Definition:
move_base_server_node.cpp:59
costmap_nav_srv_ptr
mbf_costmap_nav::CostmapNavigationServer::Ptr costmap_nav_srv_ptr
Definition:
move_base_server_node.cpp:47
ROS_INFO_STREAM
#define ROS_INFO_STREAM(args)
transform_listener.h
tf::TransformListener
ros::NodeHandle::param
T param(const std::string ¶m_name, const T &default_val) const
ros::spin
ROSCPP_DECL void spin()
types.h
ros::Duration
ros::init_options::NoSigintHandler
NoSigintHandler
ros::NodeHandle
mbf_costmap_nav
Author(s): Sebastian Pütz
autogenerated on Wed Mar 2 2022 00:33:55