Skip to content

ROS2 launch

Launch system is used to start multiple nodes and configure their execution. The Python-based launch system (launch_ros) provides flexibility through Python scripts.

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