Skip to content

Latest commit

 

History

History
79 lines (64 loc) · 4.19 KB

README.md

File metadata and controls

79 lines (64 loc) · 4.19 KB

AirSim-Docker

This dockerfile is used to build a docker image running Ubuntu 18.04, with ROS Melodic, Unreal Engine 4.25, AirSim 1.4, and GPU support.

Docker Pre-Reqs

  1. docker installed on host (https://docs.docker.com/engine/install/ubuntu/)
  2. nvidia-docker installed on host (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-on-ubuntu-and-debian).
  3. > 120GB in directory where docker images are built. This is typically in "/", recommend to shift to "/home" or other directory with larger storage (https://www.guguweb.com/2019/02/07/how-to-move-docker-data-directory-to-another-location-on-ubuntu/)
  4. *After Steps 2 & 3, /etc/docker/daemon.json should look similar to below. Key parameters are "data-root", "runtimes", and "default-runtime".
    {
        "data-root": "/home/jonyktan/docker",
        "runtimes": {
            "nvidia": {
                "path": "nvidia-container-runtime",
                "runtimeArgs": []
            }
        },
        "default-runtime": "nvidia"
    }
    
  5. git clone https://github.com/Amigoshan/tartanair into same directory as dockerfile. Rename the git folder to "/tartanair/".
  6. Ensure docker image directory has "defaults" options or NO "nosuid" option. Check this using nano /etc/fstab.
    • Edit using "Disks". Recommended to set "Mount Options" to "defaults". See image below, above "Mount Point".

Build Docker Image

  1. cd /directory/containing/dockerfile/
  2. docker build -t <IMAGE_NAME>:<IMAGE_TAG> --build-arg GITHUB_PAT=<PAT> .

Run Docker Container from built Image

  1. xhost +local:docker && docker run --rm -it -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" -v "/path/to/your/UE_env:/workspace/UnrealProj" -e "DISPLAY=${DISPLAY}" --ipc="host" <IMAGE_NAME>:<IMAGE_TAG>

Commit Container Changes to Container as new Image

  1. Find the CONTAINER_NAME using docker container ls
  2. docker commit <CONTAINER_NAME> <IMAGE_NAME>:<IMAGE_TAG>

Launch Additional Terminal for Running Container

  1. Without GUI support
    • docker exec -it <CONTAINER_NAME> bash
  2. With GUI support
    • xhost +local:docker && docker exec -it -e "DISPLAY=${DISPLAY}" <CONTAINER_NAME> bash

Set up Unreal AirSim Project (Custom Environment)

(https://microsoft.github.io/AirSim/unreal_custenv.html)
The folder AirSim/Unreal/Plugins/ needs to be inside the Unreal project folder.

  1. In Windows Machine

    • Create new project with custom environment of choice. Copy Unreal project folder to Linux machine
  2. In Linux Machine

    • If AirSim is built on the Linux machine, copy "Plugins/" from "AirSim/Unreal/" into the Unreal project folder. (This will be done in Step 1 of "Launch Unreal Engine inside Docker Container".)

Launch Unreal Engine inside Docker Container

  1. Copy AirSim plugins to Unreal Project.
    • cp /workspace/AirSim/Unreal/Plugins/ /path/to/Unreal/Project/
      (E.g. for "/path/to/Unreal/Project/", use "/workspace/UnrealProj/".)
  2. /workspace/UnrealEngine/Engine/Binaries/Linux/UE4Editor /path/to/Unreal/Project/<PROJECT_NAME>.uproject
  3. Unreal Engine will prompt to rebuild AirSim. Click "Yes". First compile will take awhile.