/ros2_playground

Primary LanguageDockerfileApache License 2.0Apache-2.0

ROS2 Package Template

This repository serves as a template for creating ROS2 packages, equipped with a comprehensive CI workflow and devcontainer configuration.

Development Environment Setup

To begin development in a containerized environment:

  1. Use this repo as a template: The best way to work with this repo is to use it as a template for your ROS package development, to do so, in the top right corner select Use this template:

    2024-04-24

    Then in the next step specify the owner and the package name as shown below:

    template

  2. Open in Visual Studio Code: Open the cloned repository in VSCode. VSCode will prompt you to "Reopen in Container." Alternatively, you can use the command palette (Ctrl+Shift+P) and search for the "reopen in container" command.

    Reopen in Container

  3. Container Setup: Once reopened in the container, VSCode will initiate the building process and pull all necessary dependencies. You can monitor the building log within VSCode.

    Devcontainer Log

  4. Verify Container Environment: After the build completes, VSCode will connect to the container. You can verify that you are within the container environment.

    In Container

Devcontainer Features

The devcontainer includes a light desktop interface. To utilize this feature:

  1. Configuration: Add the following features to the devcontainer configuration:

    "features": {
        "ghcr.io/LCAS/devcontainer-features/desktop-lite:1": {}
    },
    "forwardPorts": [6080],
    "portsAttributes": {
        "6080": {
            "label": "desktop"
        }
    }
  2. Accessing the Desktop Interface: Open the user interface by navigating to the PORTS tab in VSCode, selecting port 6080, and opening it in the browser.

    Open in Browser

  3. Connecting to the Interface: Click on "Connect" and use the password vscode to access the desktop interface.

    NoVNC

Enjoy Development!

By leveraging this setup, you can develop on a remote machine with a lightweight desktop interface. Magic! Furthermore, this template package provides very nice ROS2 functionality like syntax highlight and template code generation.

All ROS2 packages should go into the src/ folder. Create them with ros2 pkg create....

The devcontainer tries to install all dependencies of the workspace automatically as much as possible, and also tries to build the workspace when it is created, to speed up later colcon builds.

References

  1. ros2-teaching-ws
  2. Get Started with Dev Containers in VS Code