Build AirSim on Linux#

The current recommended and tested environment is Ubuntu 22.04 LTS. Theoretically, you can build on other distros as well, but we haven't tested it.

We've two options - you can either build inside docker containers or your host machine.

Docker#

Please see instructions here

Host machine#

Pre-build Setup#

Build Unreal Engine#

  • Make sure you are registered with Epic Games. This is required to get source code access for Unreal Engine.

  • Clone Unreal in your favorite folder and build it (this may take a while!). Note: We only support Unreal >= 4.27 at present. We recommend using 5.2.

# go to the folder where you clone GitHub projects
git clone -b 5.2 git@github.com:EpicGames/UnrealEngine.git
cd UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
make

Build AirSim#

  • Clone AirSim and build it:
# go to the folder where you clone GitHub projects
git clone https://github.com/Microsoft/AirSimExtensions.git
cd AirSimExtensions

By default AirSim uses clang 8 to build for compatibility with UE 5.2. The setup script will install the right version of cmake, llvm, and eigen.

./setup.sh
./build.sh
# use ./build.sh --debug to build in debug mode

Build Unreal Environment#

Finally, you will need an Unreal project that hosts the environment for your vehicles. AirSim comes with a built-in "Blocks Environment" which you can use, or you can create your own. Please see setting up Unreal Environment if you'd like to setup your own environment.

How to Use AirSim#

With VS Code#

  • Set up the UE_ROOT environment variable. It must be set to the target Unreal engine\'s root folder path, ex. /home/airsimuser/UnrealEngine-5.2

  • Go to Enviroments/Blocks and run generate_vscode.sh script.

  • Double click on the generated Blocks.code-worksapce file to open VS Code.

  • Open the Run and Debug panel by clicking the play button tab on the left side of the window, or by pressing CTRL+SHIFT+D.

  • Click the dropdown next to RUN AND DEBUG at the top of the panel and choose Launch BlocksEditor (Development) (Blocks). If AirSim was compiled with the --debug flag choose Launch BlocksEditor (DebugGame) (Blocks) instead.

  • Click the Play button or press F5 to start building your project in Editor mode. The project compiles, and when it finishes it opens Unreal Editor. Make sure you do not already have Unreal Editor open.

With Unreal Editor#

Once AirSim is setup:

  • Go to UnrealEngine installation folder and start Unreal by running ./Engine/Binaries/Linux/UE4Editor.
  • When Unreal Engine prompts for opening or creating project, select Browse and choose AirSim/Unreal/Environments/Blocks (or your custom Unreal project).
  • Alternatively, the project file can be passed as a commandline argument. For Blocks: ./Engine/Binaries/Linux/UE4Editor <AirSim_path>/Unreal/Environments/Blocks/Blocks.uproject
  • If you get prompts to convert project, look for More Options or Convert-In-Place option. If you get prompted to build, choose Yes. If you get prompted to disable AirSim plugin, choose No.
  • After Unreal Editor loads, press Play button.

See Using APIs and settings.json for various options available for AirSim usage.

Tip

Go to 'Edit->Editor Preferences', in the 'Search' box type 'CPU' and ensure that the 'Use Less CPU when in Background' is unchecked.

[Optional] Setup Remote Control (Multirotor Only)#

A remote control is required if you want to fly manually. See the remote control setup for more details.

Alternatively, you can use APIs for programmatic control or use the so-called Computer Vision mode to move around using the keyboard.