import os from pathlib import Path from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource from launch_ros.actions import Node from ament_index_python import get_package_share_directory def generate_launch_description(): slam_params = os.path.join( str(Path(__file__).absolute().parent.parent), # <-- Replace with your package name 'config', 'slam.yml' ) slam_toolbox = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory('slam_toolbox'),'launch','online_async_launch.py' )]), launch_arguments={ 'use_sim_time': 'true', 'slam_params_file': slam_params}.items() ) return LaunchDescription([ slam_toolbox ])