Simulate Failsafes

Failsafes define the safe limits/conditions under which you can safely use PX4, and the action that will be performed if a failsafe is triggered (for example, landing, holding position, or returning to a specified point).

In SITL some failsafes are disabled by default to enable easier simulation usage. This topic explains how you can test safety-critical behavior in SITL simulation before attempting it in the real world.

You can also test failsafes using HITL simulation. HITL uses the normal configuration parameters of your flight controller.

The SITL parameters allow you to simulate other common sensor failure cases that are not covered here, including: loss of barometer, gyro and accelerometer, increased GPS noise etc.

The Data Link Loss failsafe (unavailability of external data via MAVLink) is enabled by default. This makes the simulation only usable with a connected GCS, SDK, or other MAVLink application.

Set the parameter NAV_DLL_ACT to the desired failsafe action to change the behavior. For example, set to 0 to disable it.

All parameters in SITL including this one get reset when you do make clean.

The RC Link Loss failsafe (unavailability of data from a remote control) is enabled by default. This makes the simulation only usable with either an active MAVLink or remote control connection.

Set the parameter NAV_RCL_ACT to the desired failsafe action to change the behavior. For example, set to 0 to disable it.

All parameters in SITL including this one get reset when you do make clean.

Low Battery

The simulated battery is implemented to never run out of energy, and by default only depletes to 50% of its capacity and hence reported voltage. This enables testing of battery indication in GCS UIs without triggering low battery reactions that might interrupt other testing.

To change this minimal battery percentage value change this line.

To control how fast the battery depletes to the minimal value use the parameter SIM_BAT_DRAIN.

By changing this configuration in flight, you can also test regaining capacity to simulate inaccurate battery state estimation or in-air charging technology.

GPS Loss

To simulate losing and regaining GPS information you can just stop the publication of GPS messages. This is done by running the param set SIM_GPS_BLOCK 1 and param set SIM_GPS_BLOCK 0 commands on your SITL instance pxh shell to block and unblock messages respectively.

results matching ""

    No results matching ""