为了测试新的双目SLAM系统,需要带有ground truth,depth信息的dataset。但寻找后发现这类dataset不多,于是尝试搭建AirSim仿真平台,希望能自己生成一些具有深度的双目数据。


  • 型号:Thinkpad T460p
  • 显卡:GeForce 940MX
  • 系统:Ubuntu 16.04.4 LTS
  • 内核:4.13.0-36-generic
  • CUDA: 9.1



sudo apt-get remove --purge nvidia*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FCAE110B1118213C
sudo apt-get update
sudo apt-get install nvidia-384

Install and Build[2]

根据这里注册Epic Games帐号,并且关联github账号。

We use the same compiler that Unreal Engine uses, Clang 5.0, and stdlib, libc++.

sudo apt-get install build-essential mono-mcs mono-devel mono-xbuild mono-dmcs mono-reference-assemblies-4.0 libmono-system-data-datasetextensions4.0-cil libmono-system-web-extensions4.0-cil libmono-system-management4.0-cil libmono-system-xml-linq4.0-cil cmake dos2unix clang-5.0 libfreetype6-dev libgtk-3-dev libmono-microsoft-build-tasks-v4.0-4.0-cil xdg-user-dirs

sudo ln -s /usr/bin/clang-5.0 /usr/bin/clang
sudo ln -s /usr/bin/clang++-5.0 /usr/bin/clang++

clang -v
clang version 5.0.0-3~16.04.1 (tags/RELEASE_500/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version unknown


# go to the folder where you clone GitHub projects
git clone -b 4.18 https://github.com/EpicGames/UnrealEngine.git
cd UnrealEngine


# go to the folder where you clone GitHub projects
git clone https://github.com/Microsoft/AirSim.git
cd AirSim

如果遇到mono-devel : Depends: libmono-cil-dev (= 3.2.8+dfsg-4ubuntu1.1) but it is not going to be installed 错误,将源换成mirrors.163.com的就可以了。

Built-in Blocks Environment[3]

为了测试安装结果,运行自带的Blocks Environment作测试。

RunUnrealEngine/Engine/Binaries/Linux/UE4Editor, Click on Projects tab, Browse button and then navigate to AirSim/Unreal/Environments/Blocks/Blocks.uproject

If you get prompted for incompatible version and conversion, select In-place conversion which is usually under "More" options. If you get prompted for missing modules, make sure to select No so you don't exit.

Press the Play button in Unreal Editor and you will see something like in below(use F1 to see help on keys).

Blocks Environment

"Computer Vision" Mode[4]

You can use AirSim in so-called "Computer Vision" mode. In this mode, physics engine is disabled and there is no vehicle, just cameras. You can move around using keyboard (use F1 to see help on keys). You can press Record button to continuously generate images. Or you can call APIs to move cameras around and take images.

To active this mode, edit settings.json that you can find in your Documents\AirSim folder (or ~/Documents/AirSim on Linux) and make sure following values exist at root level(更多settings.json设置参考[5]):

"SettingsVersion": 1.2,
"SimMode": "ComputerVision"

设置好后,按Play button,效果如下。

Computer Vision

AirSim APIs[4]

sudo pip install msgpack-rpc-python
sudo pip install airs

在设置好Computer Vision Mode情况下,按下Play键运行仿真,然后打开一个终端(主要不要在IDE中运行,有可能会出现termios.error: (25, 'Inappropriate ioctl for device')错误),输入:

cd AirSim/PythonClient/
python cv_mode.py


Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

Press any key to set camera-0 gamble to 15-degree pitch
Press any key to get camera parameters
<instance> { u'fob': 90.0,
u'pose': <instance> { u'orientation':

Create Your Own Unreal Environment

以Modular Neighborhood Pack[6]为例。New Project > C++ > Basic Code,将项目名改为Neighborhood,注意设置no Starter Content。将包含Modular Neighborhood Pack数据的文件夹放置到Neighborhood项目文件夹的Content文件夹内。

Edit > Project Settings > Maps & Modes > Editor Startup Map设置为Demp_Map[7]

关掉,重启项目,等待场景打开后,Blueprints > Open level Blueprint,右击MatineeActor \ Event BeginPlay,选择Break Link(s),然后关掉窗口。

If the environment comes with MatineeActor, delete it to avoid any startup demo sequences. There might be other ways to remove it as well, for example, click on Blueprints button, then Level Blueprint and then look at Begin Play event in Event Graph. You might want to disconnect any connections that may be starting "matinee"[7].

Own Unreal Environment

From the File menu select New C++ class, leave default None on the type of class, click Next, leave default name MyClass, and click Create Class.

rsync -a --delete AirSim/Unreal/Plugins path/to/Project

Save Current,关闭软件。使用文本编辑器打开项目文件Neighborhood.uproject,编辑为:

"FileVersion": 3,
"EngineAssociation": "4.18",
"Category": "Samples",
"Description": "",
"Modules": [
"Name": "LandscapeMountains",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"TargetPlatforms": [
"Plugins": [
"Name": "AirSim",
"Enabled": true

重新运行Neighborhood.uproject,在World Settings > Game Mode中选择AirSimGameMode


在Multi rotor模式下[5],按play键运行场景,然后打开一个终端,输入:

cd AirSim/PythonClient/
python hello_drone.py


Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

state: <instance> { u'collision': <instance> { u'has_collided': False,
u'impact_point': <instance> { u'x_val': 0.0,







  1. https://blog.csdn.net/CSDNhuaong/article/details/79147365

  2. https://github.com/Microsoft/AirSim/blob/master/docs/build_linux.md

  3. https://github.com/Microsoft/AirSim/blob/master/docs/unreal_blocks.md

  4. https://github.com/Microsoft/AirSim/blob/master/docs/image_apis.md#computer-vision-mode-1

  5. https://github.com/Microsoft/AirSim/blob/master/docs/settings.md#simmode

  6. https://www.unrealengine.com/marketplace/modular-neighborhood-pack

  7. https://github.com/1508189250/AirSim/blob/master/docs/build.md