Skip to content

Latest commit

 

History

History
125 lines (101 loc) · 4.36 KB

Sarax with Docker.md

File metadata and controls

125 lines (101 loc) · 4.36 KB

Sarax on Docker container

Note

Prerequisites

This guide assumes the following:

  1. Docker is installed and configured
  2. Docker prerequisites are setup and installed

Installation

Option 1: Using the CLI Application

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. Docker Config

Option 2: Manual Installation

Pulling the container from GHCR

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

Running the container

To ensure full functionality of the Docker container, we will (create) and run the container with some privileges.

  1. On the host machine, allow access for xhost from the container and setup the authorisation.
xhost local:root && XAUTH=/tmp/.docker.xauth
  1. 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
  1. 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

Running on WSL2

To run the Docker container with GPU acceleration on a Windows machine with WSL2 enabled. Proceed with the following procedure.

Docker Desktop

  1. 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
  1. Run the container from image cb4 and name it sarax_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

Running Sarax on Docker Container

  1. Head to the workspace and run the following bash file
cd $SARAX_WS/PX4-Autopilot && ./sarax_plus_sitl.bash
  1. In another terminal, run another instance of the docker container
docker exec -it sarax_container bash
  1. 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 Sarax Preview

  1. On the host machine, open QGroundControl and ensure that the Virtual Joystick setting is enabled in the Application Settings Joystick

  2. Create a new Comm Link in Application Settings -> Comm Link New Comm Link

  3. Connect to the Comm Link by double-clicking and head back to the map view. QGroundControl should be connected to the container. QGround Connected

Getting started with Sarax GUI

To perform a simple take-off procedure, proceed with the following commands.

  1. Arm the drone
  2. Switch to Offboard
  3. Set value for Takeoff to 1.5m and press Takeoff

The Sarax GUI and simulator should look like this Takeoff Preview

Congrats, Sarax is successfully installed on the docker container.