17 from ament_index_python.packages
import get_package_share_directory
18 from launch
import LaunchDescription
19 from launch.actions
import IncludeLaunchDescription
20 from launch.launch_description_sources
import PythonLaunchDescriptionSource
21 from launch_ros.actions
import Node
25 def generate_launch_description() -> LaunchDescription:
26 nav2_bringup_dir = get_package_share_directory(
'nav2_bringup')
27 config = os.path.join(
28 get_package_share_directory(
'nav2_bringup'),
'params',
'nav2_params.yaml'
30 map_file = os.path.join(nav2_bringup_dir,
'maps',
'tb3_sandbox.yaml')
31 lifecycle_nodes = [
'map_server',
'planner_server']
32 config = RewrittenYaml(
33 source_file=config, root_key=
'', param_rewrites={},
35 'KEEPOUT_ZONE_ENABLED':
'False',
36 'SPEED_ZONE_ENABLED':
'False',
41 return LaunchDescription(
44 package=
'nav2_map_server',
45 executable=
'map_server',
49 {
'use_sim_time':
True},
50 {
'yaml_filename': map_file},
51 {
'topic_name':
'map'},
55 package=
'nav2_planner',
56 executable=
'planner_server',
57 name=
'planner_server',
63 executable=
'static_transform_publisher',
72 '--frame-id',
'base_link',
73 '--child-frame-id',
'map'
78 executable=
'static_transform_publisher',
87 '--frame-id',
'base_link',
88 '--child-frame-id',
'odom'
92 package=
'nav2_lifecycle_manager',
93 executable=
'lifecycle_manager',
94 name=
'lifecycle_manager',
97 {
'use_sim_time':
True},
99 {
'node_names': lifecycle_nodes},
102 IncludeLaunchDescription(
103 PythonLaunchDescriptionSource(
104 os.path.join(nav2_bringup_dir,
'launch',
'rviz_launch.py')
106 launch_arguments={
'namespace':
''}.items(),