ros2_awesome

ROS 2 awesome

Schema Support for ROS 2 Launch Files

ros2_awesome provides schema definitions for ROS 2 launch files in both YAML and XML formats. These schemas enable:

in editors such as VS Code.

📌 Available Schemas

YAML Schema

https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml

XML Schema

https://ok-tmhr.github.io/ros2_awesome/schema/launch_ros.xsd

1. Using the Schema in YAML Launch Files

You can explicitly specify the schema at the top of your .launch.yaml file:

# yaml-language-server: $schema=https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml

launch:
  - arg:
      name: example

This method is portable and works in any environment. See the sample/ directory for complete examples.

2. Using the Schema in XML Launch Files

Add the schema reference inside the <launch> tag:

<launch
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="https://ok-tmhr.github.io/ros2_awesome/schema/launch_ros.xsd">

  <arg name="example"/>
</launch>

3. VS Code: Associate the Schema Automatically

If you prefer not to write $schema in every YAML file, VS Code can automatically apply the schema based on file patterns.

Open Settings (JSON) and add:

{
  "yaml.schemas": {
    "https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml": [
      "*.launch.yaml",
      "*.launch.yml"
    ]
  }
}

Now all launch YAML files will automatically use the schema.

4. VS Code Snippets for Launch Substitutions

This repository includes a snippet extension:

launch_substitution.json

It provides auto-completion for ROS 2 substitution syntax:

$(var name)
$(env FOO)
$(not value)
$(eval ...)

Substitution in Parameter Files

ROS 2 substitutions are not limited to launch files. They also work inside parameter YAML files when loaded through a launch file.

Install as a local VS Code extension

  1. Clone this repository
  2. Open command pallet (ctrl + shift + p)
  3. Run Developer: Install Extension from Location…
  4. Choose repository’s directory

VS Code treats snippet JSON files as installable local extensions.

Features

5. Sample Files

The sample/ directory contains:

These samples are the quickest way to understand how the schema behaves.

6. Project Goals

7. Contributions

Issues and PRs are welcome. Schema improvements, missing elements, or substitution patterns can be added incrementally.