Repository Summary

Description
Checkout URI https://github.com/picknikrobotics/ros_testing_templates.git
VCS Type git
VCS Version ros2
Last Updated 2023-11-02
Dev Status UNKNOWN
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

README

ci

development-container

The development container allows developers to sandbox repository dependencies from their host machine while allowing them to use familiar development tools.

TL;DR

Build a new development image

Note: The REPO variable is defined in .env

source .env
mkdir -p ~/.${REPO}/ccache
export UID=$(id -u) export GID=$(id -g); docker compose -f compose.dev.yml build

Start an interactive development container

docker compose -f compose.dev.yml run development

Build the repository in the container

username@development-container-dev:~/ws$ colcon build

Test

To test that your container is working with graphics

username@development-container-dev:~/ws$ colcon build
username@development-container-dev:~/ws$ source install/setup.bash
username@development-container-dev:~/ws$ ros2 launch platform_description display.launch.py

Dependencies

Repository dependencies are built into the development image. This insulates the developer from potentially conflicting dependencies on their host while preventing development from accidentally depending on host packages and configurations. This uniform development environment should also make it easier for developers to collaboratively troubleshoot issues.

Rebuilding image

As repository dependencies change, the development image will have to be rebuilt. While early on this can happen frequently, dependencies tend to change more slowly later in a project. Unless otherwise noted, it is a good habit to update your image once a sprint.

ccache

ccache allows previous builds to speed up future builds. As the container is not persistent, we need to map the cache to the host so it can be reused in subsequent instantiations of the container. On the host, create the cache directory

mkdir -p ~/.${REPO}/ccache

This will then be mapped to /home/username/.ccache in the container.

Volume mapping

While the container itself by default is not persistent, several host directories are mapped into the container including

  • repository source code
  • ssh keys
  • git configuration
  • host credentials
  • X11 connection

This allows for a more seamless development environment for

  • building source
  • in container committing with your user
  • graphical tool use

The full set of volume maps can be read in the compose file.

git

Commits can be done from directly within the container, with the same host user.

username@development-container-dev:~/ws/src$ git config --list
user.email=firstname.lastname@email.com
user.name=Firstname Lastname
core.editor=vim
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:griswaldbrooks/development-container.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main

Graphics

Running rviz from within the container should produce a graphical window on the host.

username@development-container-dev:~/ws/src$ rviz2

Rviz2

Editing

As the repository source is volume mapped into the container, it can be edited outside of the container and changes are immediately reflected inside the container. This means you can use your existing host tools (vim, atom, sublime, vs code)

File truncated at 100 lines see the full file