Skip to content

ROS / ros eco

ROS2 launch

The ROS 2 launch system is a declarative orchestration engine. You don’t run code — you describe a system: which processes should exist, how they’re configured, and how they relate to each other. The launch system then executes and supervises that description, reacting to events (start, exit, failure) at runtime.

Minimal YAML

1
2
3
4
5
6
7
8
9
launch:

- node:
    pkg: demo_nodes_cpp
    exec: talker

- node:
    pkg: demo_nodes_cpp
    exec: listener

Minimal example

minimal launch file to run ros2 node
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    ld = LaunchDescription()

    node = Node(
        package='your_package_name',
        executable='your_node_executable',
        name='your_node_name',
        output='screen'
    )

    ld.add_action(node)

    return ld
cmake copy launch to share
1
2
3
install(DIRECTORY launch/
  DESTINATION share/${PROJECT_NAME}/launch
)

ROS2 Launch system API