Hardware in the loop simulation is a simulation mode where the autopilot is connected to the simulator and all flight code runs on the autopilot. This approach has the benefit of testing the actual flight code on the real processor.
PX4 supports HITL for multicopters (using jMAVSim) and fixed wing (using X-Plane demo or full). Flightgear support is present as well, but we generally recommend X-Plane. To enable it, configure it via the airframe menu.
If a joystick is preferred over a radio remote control, set the parameter
1. It can be found in the Commander parameter group.
In X-Plane two key settings have to be made: In Settings -> Data Input and Output, set these checkboxes:
In Settings -> Net Connections in the Data tab, set localhost and port 49005 as IP address, as shown in the screenshot below:
Widgets -> HIL Config, then select X-Plane 10 in the drop-down and hit connect. Once the system is connected, battery status, GPS status and aircraft position should all become valid:
Switch to the flight planning view and put a single waypoint in front of the plane. Click on the sync icon to send the waypoint.
Then select MISSION from the flight mode menu in the toolbar and click on DISARMED to arm the plane. It will take off and loiter around the takeoff waypoint.