-
Notifications
You must be signed in to change notification settings - Fork 2
driving_swarm_docker
This repository is for getting started quicker and developing more easily for Driving Swarm.
It utilises docker
to deploy (multiple) instances of ROS-environments, both for development (with a virtualized desktop) and for running simulations e.g. on a server for faster performance.
- Install
docker
- Advanced: Clone the repo (using git) for using advanced setup or developing your own image
-
Advanced: For using
docker-compose
you will have to install it (on the subsystem) - GPU-Support: Have a somewhat recent version of Mesa, or, if using nvidia's proprietary driver, see here
- Use either the quick method or the method using docker-compose
- Install the Windows Subsystem for Linux 2 (WSL2
- Install docker on WSL2
- Replace the
$PWD
in the command with%cd%
- Following the default steps, you can just access your dev-environment with your browser
- Install
nvidia-docker
and replace thedocker run
-command withnvidia-docker run --gpus all
- (Windows) you have to follow this guide and then use docker from within WSL2 (untested)
In general the supplied Docker images / Dockerfiles either create a virtualized workspace (clone and then build) or mount a directory (commonly ./workspace
) into the container.
Mounting the workspace has the advantage of being able to make local changes (without a running docker container) and e.g. change a *.repos
-file to include different repositories before executing.
The most important helper script when working in the containers is the setup-workspace.sh
(or sewo
) script that downloads all dependencies and builds the project workspace.
This repository includes several dockerfiles for different use-cases:
- Image ready for use:
-
development
- for developing for Driving Swarm by accessing a virtualised desktop and the Theia code editor
-
- Additionally, images for building upon:
-
base
- for base packages and environment setup including GPU-support, based on the official ROS-image -
turtlebot
- for providing specific turtlebot3-packages and the latest gazebo-version, based onturtlebot:slim
-
turtlebot:slim
- for providing specific turtlebot3-packages without gazebo, based onbase
-
There are some important folders and files in the container's virtual filesystem:
-
/home/docker/workspace
contains all your project files. -
/home/docker/.ssh
contains the SSH keys needed for e.g. Git. -
/home/docker/workspace/*.repos
are the VCS repo files for your project dependencies. -
/home/docker/workspace/src/*/.workspacerc
gets executed on eachsetup-workspace.sh
call (and thus also on container start), and can be used to for example symlink the .repos file or install dependencies.
This will get the pre-built development-image from https://hub.docker.com
.
Run the following command to start the development container with the directory ./workspace
mounted as ~/workspace
:
docker run --name ros-development -d -h ros-development \
--device=/dev/dri \
-p 127.0.0.1:1800:1800 \
-p 127.0.0.1:1900:1900 \
-p 127.0.0.1:5900:5900 \
-v "$PWD/workspace:/home/docker/workspace" \
ovgudrivingswarm/development
- To stop the container, run
docker stop ros-development
- To restart it, run
docker start ros-development
- To remove it completely, stop it and then run
docker rm ros-development
.
You can now access Theia (an IDE-like code editor) with your browser at http://127.0.0.1:1900 and a virtual desktop environment at http://127.0.0.1:1800/?autoconnect=true&bell=false&resize=scale&show_dot=true.
You can also use any VNC client like Remmina at 127.0.0.1:5900
to connect to the virtual desktop.
For using more advanced options (via the docker-compose.yml
-file) or deploying containers on a server, you should use docker-compose
To start a docker-container named image
:
mkdir my-awesome-project && cd my-awesome-project
wget https://raw.githubusercontent.com/ovgu-FINken/driving_swarm_docker/master/docker-compose.standalone.yml -O docker-compose.yml
docker-compose up
- Add
-d
in the last line to start and detach - To access a shell in a running container, you can use
docker-compose exec rosdev bash
For development
you can access Theia (an IDE-like code editor) with your browser at http://127.0.0.1:1900.
and a virtual desktop environment at http://127.0.0.1:1800/?autoconnect=true&bell=false&resize=scale&show_dot=true.
You can also use any VNC client like Remmina at 127.0.0.1:5900
to connect to the virtual desktop.
Manually building will take quite an amount of time (it is necessary for developing your own dockerfiles however).
To build a specific image (using docker-compose under the hood) use:
git clone [email protected]:ovgu-FINken/driving_swarm_docker.git
cd driving_swarm_docker
make build-<base|turtlebot-slim|turtlebot|development>
If you want to customise images (add new packages by default etc.) or e. g. add new tools to be launched with `development` you will have to develop your own image.
Developing your own image includes writing your own dockerfile:
- For a general overview look here
- For best practices here
- You can build upon the provided dockerfiles with
FROM ovgudrivingswarm/image:latest
, for an overview of images look above
Entrypoint scripts are most commonly used for setting up environment variables etc. and the executing a script, supplied as an argument.
We provide several (entrypoint-) shell-scripts which are used in the repo's dockerfiles / for using in your dockerfiles:
-
/entrypoint.sh
inbase/
- An entrypoint script for setting up GPU-support, ssh-keys and the ros-environment -
/usr/local/bin/setup-workspace.sh
inbase/
- An entrypoint script for cloning the workspace from*.repos
-files (or creating a default file) in the workspace, then installing dependencies and building it -
/usr/local/bin/setup-desktop.sh
indevelopment/
- The script for starting
- High CPU-load (with e.g. gazebo)
- To test if you have GPU-support enabled and working, try running
glxheads
to check your renderer-string - If it says
llvmpipe
, GPU-support is not working (if it saysIntel
/AMD
/Nvidia
, it works)
- To test if you have GPU-support enabled and working, try running
-
Did not test nvidia-GPU-support on WSL2 yet
-
Nothing else yet 😅