Note
This guide assumes the following:
- Docker is installed and configured
- Docker prerequisites are setup and installed
Users can use the CLI application to handle all Docker functionalities
Run it with the following command
sudo chmod +x scripts/run.sh && ./scripts/run.sh
With the application, users are provided with the following options.
This repository creates and publishes a Docker container onto the GitHub Container Registry as a package. The container can be pulled with the command below.
docker pull ghcr.io/SaxionMechatronics/sarax-framework:latest
To ensure full functionality of the Docker container, we will (create) and run the container with some privileges.
- On the host machine, allow access for
xhost
from the container and setup the authorisation.
xhost local:root && XAUTH=/tmp/.docker.xauth
- Find the correct image
docker image ls
The output should be similar to this
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/SaxionMechatronics/sarax-framework latest cb4ae397281c 4 days ago 7.41GB
- Create the container with the name
sarax_container
and run it with the necessary privileges for running GUI applications.
docker run --name sarax_container --runtime nvidia --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all -it -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=$DISPLAY" \
-e "QT_X11_NO_MITSHM=1" \
-e "XAUTHORITY=$XAUTH" \
--device /dev/dri/ \
-e "WAYLAND_DISPLAY=$WAYLAND_DISPLAY" -e "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" \
-e "PULSE_SERVER=$PULSE_SERVER" \
-p 18570:18570/udp \
--privileged cb4 bash
Note
To run the Docker container with GPU acceleration on a Windows
machine with WSL2
enabled. Proceed with the following procedure.
- Find the correct image
docker image ls
The output should be similar to this
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/SaxionMechatronics/sarax-framework latest cb4ae397281c 4 days ago 7.41GB
- Run the container from image
cb4
and name itsarax_container
sudo docker run --name sarax_container -it -v /tmp/.X11-unix:/tmp/.X11-unix -v /mnt/wslg:/mnt/wslg -v /usr/lib/wsl:/usr/lib/wsl --device=/dev/dxg -e DISPLAY=$DISPLAY --device /dev/dri/card0 --device /dev/dri/renderD128 -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e PULSE_SERVER=$PULSE_SERVER --gpus all cb4 bash
- Head to the workspace and run the following bash file
cd $SARAX_WS/PX4-Autopilot && ./sarax_plus_sitl.bash
- In another terminal, run another instance of the docker container
docker exec -it sarax_container bash
- Run the
sarax
framework
roslaunch m4e_mani_base sarax_plus_sitl.launch
Below is a screenshot of the framework without QGroundControl
in the docker container
-
On the host machine, open
QGroundControl
and ensure that theVirtual Joystick
setting is enabled in theApplication Settings
-
Connect to the Comm Link by double-clicking and head back to the map view. QGroundControl should be connected to the container.
To perform a simple take-off procedure, proceed with the following commands.
- Arm the drone
- Switch to Offboard
- Set value for Takeoff to
1.5m
and press Takeoff
The Sarax GUI and simulator should look like this
Congrats, Sarax is successfully installed on the docker container.