def generate_launch_description(): map_yaml_file = os.getenv('TEST_MAP') world = os.getenv('TEST_WORLD') bt_navigator_xml = os.path.join(get_package_share_directory('nav2_bt_navigator'), 'behavior_trees', os.getenv('BT_NAVIGATOR_XML')) bringup_dir = get_package_share_directory('nav2_bringup') params_file = os.path.join(bringup_dir, 'params', 'nav2_params.yaml') # Replace the `use_astar` setting on the params file param_substitutions = { 'planner_server.ros__parameters.GridBased.use_astar': 'False'} configured_params = RewrittenYaml( source_file=params_file, root_key='', param_rewrites=param_substitutions, convert_types=True) context = LaunchContext() new_yaml = configured_params.perform(context) return LaunchDescription([ SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), # Launch gazebo server for simulation ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_init.so', '--minimal_comms', world], output='screen'), # TODO(orduno) Launch the robot state publisher instead # using a local copy of TB3 urdf file Node( package='tf2_ros', executable='static_transform_publisher', output='screen', arguments=['0', '0', '0', '0', '0', '0', 'base_footprint', 'base_link']), Node( package='tf2_ros', executable='static_transform_publisher', output='screen', arguments=['0', '0', '0', '0', '0', '0', 'base_link', 'base_scan']), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(bringup_dir, 'launch', 'bringup_launch.py')), launch_arguments={'namespace': '', 'use_namespace': 'False', 'map': map_yaml_file, 'use_sim_time': 'True', 'params_file': new_yaml, 'bt_xml_file': bt_navigator_xml, 'autostart': 'True'}.items()), ])
def generate_launch_description(): map_yaml_file = os.getenv('TEST_MAP') world = os.getenv('TEST_WORLD') bt_navigator_xml = os.path.join(get_package_share_directory('nav2_bt_navigator'), 'behavior_trees', os.getenv('BT_NAVIGATOR_XML')) bringup_dir = get_package_share_directory('nav2_bringup') params_file = os.path.join(bringup_dir, 'params', 'nav2_params.yaml') # Replace the default parameter values for testing special features # without having multiple params_files inside the nav2 stack context = LaunchContext() param_substitutions = {} if (os.getenv('ASTAR') == 'True'): param_substitutions.update({'use_astar': 'True'}) if (os.getenv('GROOT_MONITORING') == 'True'): param_substitutions.update({'enable_groot_monitoring': 'True'}) configured_params = RewrittenYaml( source_file=params_file, root_key='', param_rewrites=param_substitutions, convert_types=True) new_yaml = configured_params.perform(context) return LaunchDescription([ SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'), # Launch gazebo server for simulation ExecuteProcess( cmd=['gzserver', '-s', 'libgazebo_ros_init.so', '--minimal_comms', world], output='screen'), # TODO(orduno) Launch the robot state publisher instead # using a local copy of TB3 urdf file Node( package='tf2_ros', executable='static_transform_publisher', output='screen', arguments=['0', '0', '0', '0', '0', '0', 'base_footprint', 'base_link']), Node( package='tf2_ros', executable='static_transform_publisher', output='screen', arguments=['0', '0', '0', '0', '0', '0', 'base_link', 'base_scan']), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(bringup_dir, 'launch', 'bringup_launch.py')), launch_arguments={'namespace': '', 'use_namespace': 'False', 'map': map_yaml_file, 'use_sim_time': 'True', 'params_file': new_yaml, 'bt_xml_file': bt_navigator_xml, 'autostart': 'True'}.items()), ])