import os from launch_ros.actions import Node from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration def generate_launch_description(): # Package Paths nav2_bringup_dir = get_package_share_directory('nav2_bringup') # Launch Arguments use_sim_time = LaunchConfiguration('use_sim_time', default='true') params_file = LaunchConfiguration('params_file', default=os.path.join( NAME_OF_YOUR_PKG, 'params', 'nav2_params.yaml')) return LaunchDescription([ DeclareLaunchArgument( 'use_sim_time', default_value='true', description='Use simulation clock if true'), DeclareLaunchArgument( 'params_file', default_value=params_file, description='Full path to param file to load'), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'navigation_launch.py') ), launch_arguments={ 'use_sim_time': use_sim_time, 'params_file': params_file, 'autostart': 'false' }.items(), ), Node( package='NAME_OF_YOUR_PKG', executable='follow_route', name='follow_route', parameters=[{ 'use_sim_time': True }], output='screen' ), ])