Skip to content
Snippets Groups Projects
README.md 10.65 KiB

ROS development environment

This repo contains a set of configuration files to generate docker images for development in ROS. The aim of this project is to provide a development environment that can be used in any ROS distribution. It's not intended to be used for production purposes, only development purposes, therefore some useful configurations are considered, e.g. sharing your home directory with the container.

Prerequisites

A good starting point is to follow the good practices from health robotics group and install the required packages: docker, rocker, rocker extensions, and nvidia-container-toolkit.

Summary

Docker

# First, uninstall old docker versions
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Then, install latest version of docker using apt
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# Install docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Create the docker group.
sudo groupadd docker

# Add your user to the docker group.
sudo usermod -aG docker $USER

# Refresh permissions to docker group.
newgrp docker

Rocker and Rocker extensions

# if pipx is not installed
# for 22.04 or below
python3 -m pip install --user pipx
python3 -m pipx ensurepath

# The installation of rocker is then reduced to:
pipx install git+https://github.com/osrf/rocker.git
pipx inject rocker git+https://github.com/sloretz/off-your-rocker.git
pipx inject rocker git+https://github.com/miguelprada/mp_rocker.git
pipx inject rocker git+https://github.com/anfemosa/roscker_extensions.git # WIP

Nvidia-container-toolkit

# Configure production repositories
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
# Install nvidia-container-toolkit
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

Install Development Environment

Clone the repository:

git clone git@git.code.tecnalia.com:andres.montano/development_environment.git

How to use it

Before generate a docker image

The dockerfile allows the installation of package dependencies for the workspace these could be ROS packages or python packages, installed with apt-get or pip. Packages are defined in a requirements.txt file at ws_dependencies folder, the file name is defined by the ROS_DISTRO (e.g. ./ws_dependencies/melodic_requirements.txt).

noetic_requeriments.txt file example:

# APT-GET PACKAGES
# Base
python3-catkin-tools
ipython3
python-is-python3
python3-click
python3-numpy
python3-osrf-pycommon
python3-vcstool
python3-pip
clangd
liblldb-dev
libllvm-ocaml-dev
# Neurondones
ros-noetic-libpcan
ros-noetic-moveit-ros-move-group
ros-noetic-moveit-fake-controller-manager
ros-noetic-moveit-kinematics
ros-noetic-moveit-planners-ompl
ros-noetic-moveit-ros-visualization
ros-noetic-moveit-setup-assistant
ros-noetic-ros-control
ros-noetic-ros-controllers
# PIP PACKAGES
pyk4a
# EOF

TIP To obtain the dependencies list for you workspace you can use the command rosdep check --from-paths src --ignore-src or rosdep install --reinstall --simulate --from-path src --ignore-src --skip-keys --rosdistro ${ROS_DISTRO}