Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:ros2_in_docker [2019/06/12 18:10] (current)
amora created
Line 1: Line 1:
 +====== Using ROS 2 in a Docker Container ======
  
 +In this tutorial will going to configure Docker for use a container with the latest stable version of ROS 2. This configuration have these features:
 +
 +  * Launch terminals inside the container
 +  * Launch graphical applications from the container
 +  * Use your configured users inside the container
 +  * Share your home directory with the container
 +
 +===== Prerequisites =====
 +
 +We need to install xorg-xhost utility for launching graphical apps inside the container. If you use Debian as OS, you can run the next instruction:​
 +
 +  $ sudo apt install x11-xserver-utils
 +
 +===== Installing Docker =====
 +
 +For installing Docker we can follow the instructions from Docker official page. If you use Debian as OS, you can follow the next link:
 +
 +  * [[https://​docs.docker.com/​install/​linux/​docker-ce/​debian/​|Install Docker for Debian]]
 +
 +If you use another OS, follow the instructions for that OS
 +
 +===== Installing ROS 2 container =====
 +
 +After installing Docker, we have to download the latest ROS stable to use with Docker. For these, run the next instruction:​
 +
 +  $ sudo docker pull osrf/​ros:​dashing-desktop
 +
 +===== Installing helper scripts =====
 +
 +We going to use two helper scripts originally developed by Javier Peralta and modified for ROS 2, ros2create.sh and ros2term.sh. The first one configures and runs the container, and the second creates an extra terminal inside the container. You can download these scripts from {{ :​tutorials:​ros2-docker-scripts.zip | here}}.
 +
 +After downloading the helper scripts, we going to give them execution permissions and move it to a defined directory for calling customs scripts and programs.
 +
 +  $ chmod +x ros2create.sh ros2term.sh
 +  $ sudo mv ros2create.sh ros2term.sh /​usr/​local/​bin
 +
 +===== Running ROS 2 Container =====
 +
 +For running ROS 2, we first execute ros2create.sh:​
 +
 +  $ ros2create.sh
 +
 +Running this first script will bring a terminal inside the container with all the ROS 2 setup already configured. If we need another terminal inside the container, we execute ros2term.sh:​
 +
 +  $ ros2term.sh
 +
 +Execute this script as many times we need. For exiting the container, we only need to exit from every terminal.
  • tutorials/ros2_in_docker.txt
  • Last modified: 2019/06/12 18:10
  • by amora