PX4 HITL Testing w/ AirSim

Notes on using Pixhawk and PX4 firmware for hardware-in-the-loop testing with AirSIM

There are few important key steps that need to be done to ensure success:

  • Load PX4 firmware onto Pixhawk with QGroundControl. As of 1/20/2021 PX4 firmware version 1.9.2 has been confirmed to work. Use any newer versions at your own risk.

  • After loading firmware Pixhawk will reboot and QGC will reconnect. Go to Airframe and select HIL Quadcopter X Airframe:

  • Bind your RX/TX (In my case this is Taranis QX7 and FrSky RX4R)

  • Calibrate your radio in QGroundControl (this tutorial was tested with Taranis QX7)

  • Setup flight modes in QGC. These are ones that I used for testing purposes and setup on Channel 5:

    • Stabilize

    • Altitude

    • Land

    • RTL

  • Download one of the AirSim builds and open it then close it. This will create a settings.json file in your user documents directory. You'll then need to modify it with the following params:

{
  "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
  "SettingsVersion": 1.2,
  "LogMessagesVisible": true,
  "SimMode": "Multirotor",
  "Vehicles": {
    "PX4": {
      "VehicleType": "PX4Multirotor",
      "UseSerial": true,
      "Parameters": {
          "NAV_RCL_ACT": 0,
          "NAV_DLL_ACT": 0,
          "LPE_LAT": 47.641468,
          "LPE_LON": -122.140165,
          "COM_OBL_ACT": 1
      }
    }
  }
}
  • Make sure AirSim is still closed and power up your TX

  • Connect Pixhawk via USB to your computer

  • Launch AirSim and voila!

Last updated

Was this helpful?