ROS 2 Lyrical lab 06 ยท 75 min

Launch and parameters

Start a repeatable robot system and load reviewed limits from YAML.

Before you start

  • At least two working nodes
  • A package with launch and config directories

Files you will touch

  • src/robot_bringup/launch/system.launch.py
  • src/robot_bringup/config/limits.yaml

Step 1

Set up

status_node:
  ros__parameters:
    max_speed: 0.25
    publish_rate: 10.0

Step 2

Create the file

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(package='robot_basics', executable='status_node',
             parameters=['config/limits.yaml'], output='screen')
    ])

Step 3

Build, run and inspect

ros2 launch robot_bringup system.launch.py
ros2 param get /status_node max_speed
ros2 param set /status_node max_speed 0.2

Proof that it works

  • The launch file starts every declared node
  • max_speed loads as 0.25
  • Runtime changes are accepted only inside the node's declared safe range

Recovery notes

  • Install launch and config directories from CMakeLists.txt.
  • Declare every parameter before reading it and validate safety-critical changes in an on-set callback.
ROS 2 launch tutorials