and then pass it inside the launch_arguments dictionary like shown below:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
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.substitutions import LaunchConfiguration
def generate_launch_description():
turtlebot3_launch = get_package_share_directory('turtlebot3_navigation2')
map_file = "~/ros2/src/multithreading_odom/map/map.yaml"
start_rviz = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(turtlebot3_launch, 'launch', 'navigation2.launch.py'),
launch_arguments = {'map_file': map_file}.items()
)
return LaunchDescription([
start_rviz,
])
In your other launch file you have to define a corresponding launch configuration: map_file = LaunchConfiguration('map_file')
It is used to store the value of the launch argument in a variables and to use it in any part of the launch description.