docs/code_structure.md
Majority of the code is located in AirLib. This is a self-contained library that you should be able to compile with any C++11 compiler.
AirLib consists of the following components:
Apart from these, all common utilities are defined in common/ subfolder. One important file here is AirSimSettings.hpp which should be modified if any new fields are to be added in settings.json.
AirSim supports different firmwares for Multirotor such as its own SimpleFlight, PX4 and ArduPilot, files for communicating with each firmware are placed in their respective subfolders in multirotor/firmwares.
The vehicle-specific APIs are defined in the api/ subfolder, along-with required structs. The AirLib/src/ contains .cpp files with implementations of various mehtods defined in the .hpp files. For e.g. MultirotorApiBase.cpp contains the base implementation of the multirotor APIs, which can also be overridden in the specific firmware files if required.
This is the only portion of project which is dependent on Unreal engine. We have kept it isolated so we can implement simulator for other platforms as well, as has been done for Unity. The Unreal code takes advantage of its UObject based classes including Blueprints. The Source/ folder contains the C++ files, while the Content/ folder has the blueprints and assets. Some main components are described below:
Vehicles/Apart from these, PIPCamera contains the camera initialization, and UnrealImageCapture & RenderRequest the image rendering code. AirBlueprintLib has a lot of utility and wrapper methods used to interface with the UE4 engine.
This is the library developed by our own team member Chris Lovett that provides C++ classes to talk to the MavLink devices. This library is stand alone and can be used in any project. See MavLinkCom for more info.
We have created a few sample programs to demonstrate how to use the API. See HelloDrone and DroneShell. DroneShell demonstrates how to connect to the simulator using UDP. The simulator is running a server (similar to DroneServer).
PythonClient contains Python API wrapper files and sample programs demonstrating their uses.
The following picture illustrates how AirSim is loaded and invoked by the Unreal Game Engine: