Ask Your Question

Revision history [back]

Hi Jeffrey,

To use parameter "param_name" here an example launch file:

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration,

from launch_ros.actions import Node

def generate_launch_description():
    declared_arguments = []
    declared_arguments.append(DeclareLaunchArgument(
        'param_name', default_value='param_default_value',
        description='Description about praram_name parameter.'))

    param_name = LaunchConfiguration('param_name')

    my_node = Node(
        package='controller_manager',
        executable='ros2_control_node',
        parameters=[{'param_name': param_name}],
        output={
             'stdout': 'screen',
             'stderr': 'screen',
         },
    )

    return LaunchDescription(
        declared_arguments +
        [
            my_node,
        ])

As far as I know, there is no possibility to get the "param_value" in the launch file other than using substitutions.