Nav2 Navigation Stack - kilted  kilted
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() -> LaunchDescription:
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=[
37  {'save_map_timeout': save_map_timeout},
38  {'free_thresh_default': free_thresh_default},
39  {'occupied_thresh_default': occupied_thresh_default},
40  ],
41  )
42 
43  start_lifecycle_manager_cmd = launch_ros.actions.Node(
44  package='nav2_lifecycle_manager',
45  executable='lifecycle_manager',
46  name='lifecycle_manager',
47  output='screen',
48  emulate_tty=True, # https://github.com/ros2/launch/issues/188
49  parameters=[
50  {'use_sim_time': use_sim_time},
51  {'autostart': autostart},
52  {'node_names': lifecycle_nodes},
53  ],
54  )
55 
56  ld = LaunchDescription()
57 
58  ld.add_action(start_map_saver_server_cmd)
59  ld.add_action(start_lifecycle_manager_cmd)
60 
61  return ld