Skip to content

BunteStadt/docker_ros2_base_package

Repository files navigation

base_docker_ros2_package

Base repo to create a ros2 package with basic setup taken care of. Using compose

This Repo is base to create a ros2 package inside Docker.

Overview:

The dockerfile defines the Docker container. It is initialized by a compose file, or docker build.

The Dockerfile installes ros2 humble and sets up the concon_ws and overlay_ws. We normally work inside the overlay_ws\src\ to create our packages.

The compose.yaml file is used by docker compose up. It initializes the container build based on the Dockerfile and starts the container with the parameters provided.
As last step it executes a entrypoint script from the \entrypoint_scripts folder. These normally launch the ros2 nodes.

ROS2 Package Development:

Clone Repo to local machine. Start it with docker compose up. Make sure the compose.yaml mounts the host \src to the container \sr for direct sync to source code. This allows to work inside the container and "save" the work in the host source code. (The host source code is used when building the container the next time and anything don inside the container would otherwise be lost.)
Use VSCode - Attach to Container to enter the container.

In the terminal move to overlay_ws\src\ and create a new package with:

ros2 pkg create my_package \
  --node-name my_node \
  --build-type "ament_python" \
  --maintainer-email "[email protected]" \
  --maintainer-name "Name"

Depending on the package task, modify the compose.yaml to for example map ports etc.

About

Docker based ros2 package development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published