Setting up Microsoft AirSim to Simulate a Drone and Car Together

A quick guide inspired by Kshitiz Sharmas work to modify Microsoft AirSim simulator to support simulating a drone and car together (at least until they support it officially)

Ido Glanz
3 min readSep 1, 2020
A drone and car living happily ever after in a single environment

Recently, as part of a robotic-guidance project we were working on involving a drone learning to guide a human-controlled vehicle along a trajectory (an Actor-Critic RL algorithm we plan to write about soon), we were surprised to find out that while simulating several drones or several cars with Microsoft AirSim plugin is as easy as changing the settings json, setting up a drone and a car together is not yet supported.

Looking for a solution, we stumbled across Kshitiz Sharmas work, modifying some of the source file so to allow setting up a mixed environment. While he even forked his working version of the plugin, it unfortunately was running on earlier version of the official plugin and on an older version of the UnrealEngine the simulator is based on and we couldn’t get it to run.

Eventually, we ended up modifying the recent release of the AirSim plugin, closely following the original work of Kshitiz, and were able to get it up and running!

As you might imagine, as happened to us, this modification might be out-dated with future released of both the plugin (currently running on v1.3.1) and the UnrealEngine (4.25.0).

Let’s get to work!

Step 1:

Follow AirSim official guidelines to prepare the environment, download and install all the dependencies needed. Stop right after cloning AirSim

Clone but don’t install just yet

Step 2:

Clone or download this repo with the augmented source files.

Step 3:

Replace the specific original files with the augmented ones. Follow the augmented files directory hierarchy to locate the files or use the picture below — only replace the specific files in the augmented directory, not the whole directory.

Step 4:

Continue with the AiSim installation as in this link from before

From this point you can just follow the official instructions

Step 5:

The setting.json file is a configuration file usually found in Documents/Airsim and is added by the AirSim plugin during installation to preset the configuration of the vehicles/environment (this would also be the place to set up 2 drones or 2 cars if wanted).

To auto set up both a car and drone change the setting.json file to:

{
“SettingsVersion”: 1.2,
“SimMode”: “Both”,
“Vehicles”: {
“Drone1”: {
“VehicleType”: “SimpleFlight”,
“X”: 0.1, “Y”: 0, “Z”: -3, “Yaw”: 0
},
“Car1”: {
“VehicleType”: “PhysXCar”,
“X”: 0, “Y”: 0, “Z”: -1, “Yaw”: 0
}
}
}

Putting it all together

Technically we are done. But. If this is your first time running AirSim, a good way to start would be navigate to ./AirSim/Unreal/Environments/Block and run Blocks.uproject to start a block-world environment which is quite easy and nice to start your exploration with.

Make sure you change the Game Mode in the World Outliner to: AirSimGameMode before pressing Play!

There is also a demo python code in ./PythonClient/Both you can play around with and take it from there.

It took us quite a while to set it up and would not have been possible at all without Kshitiz work, so most of the credit here is his and we hope this works for you!

--

--