GithubHelp home page GithubHelp logo

caj2 / ros2_docker Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 11 KB

ROS2 in Docker template

License: Apache License 2.0

Shell 25.26% Dockerfile 74.74%
containers docker docker-compose ros ros2 template

ros2_docker's Introduction

ROS2 Docker

This repository is intended as a template for getting ROS2 running in a Docker container with full support for containerized development using the Development Containers spec.

Launch

Launching the codebase is done through docker compose:

docker compose -f compose.launch.yaml up <service>

The launch services are defined at the top of compose.launch.yaml. All new services should extend the overlay service in compose.base.yaml. The overlay image contains all code in src/, but must be rebuilt to copy any new changes:

docker compose -f compose.launch.yaml build [service]

Dependencies

If additional dependencies are needed in addition to the code in src/, add them to the dependencies.repos file and rebuild. Dependencies are managed using vcstool, which is a common ROS tool to import external repositories into the workspace.

Development

Development containers have been defined in compose.dev.yaml that includes dev tools and a friendly environment. Configuration for VSCode and the devcontainer spec are included with useful extensions and settings. Changes in the dev container are synced back to the host folder.

  1. Install the Dev Containers extension. More Info
  2. Click the bottom left corner icon in the editor.
  3. Choose either Open Folder in Container or Reopen in Container if you already have the repository folder open.

For other editors, refer to editor documentation on Dev Containers.

Attaching to the container: To run commands in the container from an external terminal, run ./attach.sh while in the repository folder.

Using Foxglove Studio: The dev configuration can launch a foxglove_bridge sidecar. Uncomment the service in compose.dev.yaml to enable. Start Foxglove Studio on the host and connect to ws://localhost:8765 (the default).

Docker Configuration

The configuration consists of three docker compose files:

  1. compose.base.yaml: Contains base services for running the repository in ROS2
  2. compose.launch.yaml: Contains launch services that extend the base services. These definitions are intended for production environments.
  3. compose.dev.yaml: Contains development services built on the base services. These are run by the .devcontainer configuration. The dev container provides additional development packages and tools, a non-root user with sudo access, and volumes to sync code changes between the container and the host.

The compose.base.yaml consists of three container definitions:

  1. base: Contains core ROS2 packages and dependencies
  2. overlay: Contains ROS2 packages from this repository
  3. dev: Contains extra tools for development

For production environments, only base and overlay are deployed, containing the minimum set of packages necessary for running on a robot.

Networking in ROS2 should work automatically between any running containers and the host. This makes it easy to run additional ROS2 packages such as visualization tools on the host. However, ensure that you are using the Cyclone DDS middleware on the host for communicating with Docker services through ROS2.

Acknowledgements

These resources helped define much of the basics in this template:

An Updated Guide to Docker and ROS 2 - Robotic Sea Bass

VSCode, Docker, and ROS2 - Allison Thackston

panther-docker - Husarion

ros2_docker's People

Contributors

caj2 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.