Main Content

Setting Up PX4 Autopilot in Hardware-in-the-Loop (HITL) Mode from QGroundControl

The PX4® Autopilot must be configured in Hardware-in-the-Loop (HITL) mode before setting it up for HITL Simulation. The workflow is based on Hardware in the Loop Simulation (HITL).

Setting up PX4 Autopilot in HITL Mode

Perform these steps to configure and setup QGroundControl (QGC).

  1. Connect the autopilot to QGC via USB.

  2. Enable HITL mode.

    1. Navigate to Setup > Safety section.

    2. Select Enabled from the HITL Enabled list.

      QGC Safety

  3. Select Airframe.

    1. Navigate to Setup > Airframes.

    2. Select HIL QuadCopter x to simulate a quadcopter or select Generic Standard Plane) to simulate a fixed-wing plane. For VTOL, select HIL Standard VTOL QuadPlane. Click Apply and Restart on top-right of the Airframe Setup page.

      QGC Airframe

  4. In the General tab of the settings menu, clear all AutoConnect options except UDP.

    Autoconnect options

    Note

    This selection ceases the communication between QGC and PX4 Autopilot over USB. The QGC can now communicate only over UDP (this is usually taken care by a Simulator which acts as a bridge between QGC and Autopilot and routes MAVLink data between QGC and Autopilot over UDP).

    Note

    This selection is done only for HITL mode. To run Speedgoat® models, select Pixhawk option also.

  5. Select Virtual Joystick.

    1. In the General tab, from Fly View of the settings menu, select Virtual Joystick option.

  6. Configure Joystick and Failsafe. Set the following parameters to use a joystick instead of an RC remote control transmitter:

    • COM_RC_IN_MODE to Joystick only. This allows joystick input and disables RC input checks.

    • COM_DISARM_LAND to -1. This disables the timeout for auto-disarm when QGC detects a landing. This helps in avoiding a potential PX4 failsafe when drone motors stops at highest take-off point momentarily.

    • NAV_ACC_RAD to 10.

  7. Ensure there are no warnings in the Vehicle Settings tab of QGC. Only the Power tab can be in red (with warning). If you see warnings for the Flight Modes tab, set it up by picking a mode for each of the channels. Sometimes, the Sensor Calibration tab can be in red. You can go ahead with it.

    QGC vehicle setup

    Note

    Ensure that SD card is inserted in the hardware for the mission upload from QGC to work.

  8. If you plan to run Monitor & Tune simulation for the Controller model on the TELEM1, TELEM2, or TELEM3 port of the Pixhawk hardware, ensure that MAVLink is not enabled on these ports. You can verify this by checking the values of the parameters MAV_0_CONFIG and MAV_1_CONFIG. The port value in these parameters must be disabled when running the Monitor & Tune simulation.

  9. Close the QGC.

See Also