FlightGear Hardware-in-the-Loop Simulation


Archived, no longer supported

FlightGear is an open-source free flight simulator. This article explains how to use this hardware-in-the-loop simulator with Plane (only).


This is a community-submitted article. It should work, but has not been verified by the official dev team. Questions and requests for help should be made in the DIY Drones forums.


Flightgear screenshot

Things you need

  1. Flightgear (tested Flight Gear v2.x, currently at v3.4)

  2. Mission Planner (Windows)

  3. ArduPilot HIL on your APM (via APM Planner, currently (April 2013) only v2.68 HIL works, see below)

  4. Mavlink.xml data format file for flightgear

  5. Recommended for Windows OS: the file: system.fgfsrc placed into the “C:\Program Files (x86)\FlightGear\data” folder. This will load the Rascal RC plane and a few other parameters. More information on what is loaded here, you can alter it to your own requirements.

How to make it work


Safety first: Disconnect the 3 wires from your brushless motor otherwise it will start when you advance the throttle (if in manual mode).

  1. Download and install the FlightGear Flight Sim if you have not already

  2. Copy Mavlink.xml to C:\Program Files (x86)\FlightGear\data\Protocol

  3. In the Mission Planner > ‘Configuration tab | Adv Parameter List’ save your current parameters so you can reload them after the simulation

  4. In the Firmware tab of the MP, choose ‘Pick previous firmware’, from the drop down list pick the 4th one down, firmware should show as Plane v2.68, then click ‘HIL Simulator | Plane’ to load the Plane firmware onto your APM.

  5. Connect to the APM, then open the Simulation tab of the Mission Planner

  6. Check the FlightGear radio button, then click the ‘Start FG Plane’ button.

  7. After FG has finished loading click the ‘Sim Link Start/Stop’ button in the MP

  8. In FG press ‘ v ‘ on the keyboard to get an outside view of the plane, ‘ x ‘ to zoom, move your aileron stick to see if the planes ailerons move, great if they do, go through this list again if not.

  9. Now in the Mission Planner do your usual radio setup including calibration and mode switch setup, then you can fly Missions and test the APM just like you would on a real plane.


If you used the file “system.fgfsrc” then you can just increase your throttle to fly the Rascal plane. If you didn’t and are flying the default Cessna, hold down ‘s’ on the keyboard to start the plane’s engine, then advance your throttle to take off.