Launch files

Launch files can be used to start multiple nodes at once from the same script. They are usually placed inside the launch directory of the package, and files are named <file_name>.launch.<format> where the format can be either py, yaml or xml. The complete official documentation can be found here.

Python based launch files are as follows:

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package="<package_name>",
            executable="<executable_name>",
            output="screen"),
    ])

The LaunchDescription takes as input a list of nodes: that’s how multiple of them can be started.