Skip to content
/ ros2_pkg_template Public template

A template repository designed for creating ROS2 packages, complete with essential CI workflow and devcontainer configuration.

License

Notifications You must be signed in to change notification settings

LCAS/ros2_pkg_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

    Then this will promote you with the following two options: image

    You may select the base image according to your targeted application. For instance, if the nodes do not require GPU processing tasks, it is preferable to use the default devcontainer as it is more lightweight.

  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, 5801],
    "portsAttributes": {
        "6080": {
            "label": "desktop"
        },
        "5801": {
            "label": "desktop opengl"
        }
    }
  2. Accessing the Desktop Interface: Open the user interface by navigating to the PORTS tab in VSCode, selecting port 6080 (or port 5801 for the CUDA-OpenGL version), 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

About

A template repository designed for creating ROS2 packages, complete with essential CI workflow and devcontainer configuration.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published