Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
map_saver_server.launch.py
1 #!/usr/bin/env python3
2 
3 # Copyright (c) 2020 Samsung Research Russia
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 from launch import LaunchDescription
18 import launch_ros.actions
19 
20 
21 def generate_launch_description():
22  # Parameters
23  lifecycle_nodes = ['map_saver']
24  use_sim_time = True
25  autostart = True
26  save_map_timeout = 2.0
27  free_thresh_default = 0.25
28  occupied_thresh_default = 0.65
29 
30  # Nodes launching commands
31  start_map_saver_server_cmd = launch_ros.actions.Node(
32  package='nav2_map_server',
33  executable='map_saver_server',
34  output='screen',
35  emulate_tty=True, # https://github.com/ros2/launch/issues/188
36  parameters=[{'save_map_timeout': save_map_timeout},
37  {'free_thresh_default': free_thresh_default},
38  {'occupied_thresh_default': occupied_thresh_default}])
39 
40  start_lifecycle_manager_cmd = launch_ros.actions.Node(
41  package='nav2_lifecycle_manager',
42  executable='lifecycle_manager',
43  name='lifecycle_manager',
44  output='screen',
45  emulate_tty=True, # https://github.com/ros2/launch/issues/188
46  parameters=[{'use_sim_time': use_sim_time},
47  {'autostart': autostart},
48  {'node_names': lifecycle_nodes}])
49 
50  ld = LaunchDescription()
51 
52  ld.add_action(start_map_saver_server_cmd)
53  ld.add_action(start_lifecycle_manager_cmd)
54 
55  return ld