Skip to content

ros-tooling/launch_frontend_py

Repository files navigation

Python frontend for ROS 2 Launch

The package launch is the implementation, the "plumbing" of the ROS 2 launch system.

XML and YAML on the other hand are frontends to launch. That is, they are the intended user-facing API. However, much of the community got hooked on Python launchfiles due to early adoption when the frontends were incomplete. With that in mind, and the extensive explicit use of exact filenames and PythonLaunchDescriptionSource, migration to these frontends is difficult for packages with downstream consumers.

Enter launch_frontend_py - this package provides a Python-language frontend to launch, with identical usage to the XML and YAML versions. It provides the same benefits of conciseness, declarative style, while allowing launchfiles to stay in Python.

Usage

The available actions and substitutions are identical to XML and YAML launchfiles, with one caveat:

Note

Some launch Actions and their attributes use reserved Python keywords, the known cases are for Action and if attribute for conditions. For all cases, an underscore _ is added at the end: for_, if_.

Here is an example launchfile with a few features:

from launch_frontend_py import arg, executable, launch


def generate_launch_description():
    return launch([
        arg(name='message', default='hello world'),
        arg(name='condition', default='True'),
        executable(cmd='echo $(var message)', output='both'),
        executable(cmd='echo hello conditional', if_='$(var condition)', output='both'),
        executable(cmd='echo hello not-condition', if_='$(not $(var condition))', output='both'),
    ])

Release Status

Distro Dev Doc Src Ubuntu x64
Rolling Build Status Build Status Build Status Build Status
Kilted Build Status Build Status Build Status Build Status
Jazzy Build Status Build Status Build Status Build Status
Humble Build Status Build Status Build Status Build Status

About

Python frontend for ROS 2 launchfiles - a la YAML/XML

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published