This repository contains the Dockerfiles to build the Docker image for the DRIMS2 summer school, a set of scripts to start the container and check the installation, and an example node to process camera data.
To use ROS, you will need Docker. This allows you to avoid being tied to a specific Ubuntu version to satisfy the ROS-Ubuntu compatibility.
- First, install Docker by following the official Docker tutorial: Install Docker on Ubuntu
- Test the installation by running the hello-world container:
docker run hello-world
- If you get a permission denied error, add your user to the Docker group:
sudo usermod -aG docker $USER
- Then reboot and try running the hello-world container again.
Once Docker is properly installed, you can get the Docker image for the DRIMS2 summer school:
- Clone the repository
- Run the script
setup.sh
this will add the udev rules for the Luxonis camera and add the drims2 group to your system. Once the script runs succesfully reboot the system. - Run the check script:
./check.sh
- The script will automatically download the latest Docker image and start the container, checking that all requirements are satisfied and external folders are mounted properly.
- If no errors are printed on the terminal, you are ready for the DRIMS2 summer school.
The drims_ws folder and the bag folder are mounted inside the docker container and are used for code development. All your code will go inside the drims_ws/src folder, where you can already find example nodes. To run your node you will have to start the container and compile the environment, to do so:
- Run the script
start.sh
- Then move inside the workspace directory
cd drims_ws
- Compile the environment
catkin_make
Now that you have your node compiled you can run them. Since you have only one terminal inside docker you can use tmux
to create multiple terminals and run all the required commands. For a guide of all basic tmux commands you can reference the Tmux Cheat Sheet
An alternative solution is to open new terminals and connect to the running container. To do so make sure you have started the container with start.sh
, then in a new terminal run connect.sh
, the new terminal is now running inside the container. While you can only run the start.sh
once, because you can only have one running container named drims2
, you can use the connect.sh
script as many time as you want, since you are connecting to a running container.
The check.sh
script is a simple script that starts the container and performs a set of checks on the environment. Other scripts and source code are provided:
start.sh
: Starts the container in interactive mode- The
docker
folder contains the Dockerfile to build the DRIMS2 image and a script to build the image for multiple architectures using Buildx. - The
drims_ws
folder is the workspace used to develop new code, mounted on/drims_ws
inside the Docker container. It contains an example node that acquires data from a camera and performs basic image processing. - The bags folder is a suppoprt folder to allow bags recordings and see provided data inside the docker container. It is mounted in your home, under /home/drims/bags in the docker container.
ROS can work inside docker on Windows and MacOS. Unfortunatly USB and network interfaces are not properly mapped from outside the docker container to inside the container. Therefore if you are not running an Ubuntu system you will require a virtual machine.
- Follow the instructions on the Ubuntu website to configure Virtualbox
- Once your Ubuntu Virtualbox is running, follow the above steps, like if you were using Ubuntu:
- install docker
- clone the repository
- run the check script
- Once you have created the ubuntu virtualbox and installed all the required software you might want to enable bridged network to comunicate with other devices on the same network. To do so go to Settings->Network and select Bridged Network on the drop-down meny for you network interface
- When you will start using real cameras for algorithm testing you will also want to enable the usb ports. To do so follow the Luxonis Camera guide
To write your code you can use nano/vim directly inside docker. If you want to use any ide, they usually provide plugins to connect to a running docker container. For VS-code:
- Install the Dev Containers plugin
- Click on the green
><
icon in the bottom-left corner of the VS Code window to open the Remote - Containers menu - Select
Remote-Containers: Attach to Running Container...
- A list of running containers will appear. Select the container you want to connect to.
- VS Code will then attach to the selected container and open a new VS Code window connected to that container.
- You can also install the c++ and ros extensions of vs code to have autocomplete and errors hilights
Docker is primarily designed to be used from the terminal, which means it doesn't natively support graphical user interfaces (GUIs). However, when working with ROS, Gazebo, and MoveIt, having a GUI can be very helpful.
The easiest but least secure method is to grant permission to all local users, including root, to connect to the X server. This can be done by running the following command before starting your Docker container:
xhost +local:root
This method is not recommended as it opens up your X server to any local user, which can be a significant security risk.
A safer option is to allow only the current user to connect to the X server. You can do this by running:
xhost +si:localuser:$(whoami)
This command limits access to the X server to your current user only, making it a more secure alternative.
If you don't want to manually run the xhost command every time you open a terminal, you can automate it by adding the command to your .bashrc file. This way, the command will run automatically whenever you start a new terminal session. To do this, run the following command once:
echo "xhost +si:localuser:$(whoami) > /dev/null 2>&1" >> ~/.bashrc
This will add the safer xhost command to your .bashrc file, ensuring it runs without displaying any output in your terminal.