Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
planning_benchmark_bringup.py
1 # Copyright (c) 2022 Samsung Research America
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import os
16 
17 from launch import LaunchDescription
18 from launch.actions import IncludeLaunchDescription
19 from launch.launch_description_sources import PythonLaunchDescriptionSource
20 from launch_ros.actions import Node
21 from ament_index_python.packages import get_package_share_directory
22 
23 def generate_launch_description():
24  nav2_bringup_dir = get_package_share_directory('nav2_bringup')
25  config = os.path.join(get_package_share_directory('nav2_bringup'), 'params', 'nav2_params.yaml')
26  map_file = os.path.join(nav2_bringup_dir, 'maps', 'turtlebot3_world.yaml')
27  lifecycle_nodes = ['map_server', 'planner_server']
28 
29  return LaunchDescription([
30  Node(
31  package='nav2_map_server',
32  executable='map_server',
33  name='map_server',
34  output='screen',
35  parameters=[{'use_sim_time': True},
36  {'yaml_filename': map_file},
37  {'topic_name': "map"}]),
38 
39  Node(
40  package='nav2_planner',
41  executable='planner_server',
42  name='planner_server',
43  output='screen',
44  parameters=[config]),
45 
46  Node(
47  package = 'tf2_ros',
48  executable = 'static_transform_publisher',
49  output = 'screen',
50  arguments = ["0", "0", "0", "0", "0", "0", "base_link", "map"]),
51 
52  Node(
53  package = 'tf2_ros',
54  executable = 'static_transform_publisher',
55  output = 'screen',
56  arguments = ["0", "0", "0", "0", "0", "0", "base_link", "odom"]),
57 
58  Node(
59  package='nav2_lifecycle_manager',
60  executable='lifecycle_manager',
61  name='lifecycle_manager',
62  output='screen',
63  parameters=[{'use_sim_time': True},
64  {'autostart': True},
65  {'node_names': lifecycle_nodes}]),
66 
67  IncludeLaunchDescription(
68  PythonLaunchDescriptionSource(
69  os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')),
70  launch_arguments={'namespace': '',
71  'use_namespace': 'False'}.items())
72 
73  ])