Skip to content

模拟故障保护

Failsafes 为了您可以安全地使用 PX4,定义安全限制/条件,以及触发故障安全时将执行的操作(例如,着陆,保持或返回指定点)。

在 SITL 中,默认情况下会禁用某一些故障,以便方便模拟使用。 本主题说明如何在实际世界中尝试 SITL 仿真之前测试安全关键行为。

You can also test failsafes using HITL simulation. 这使得模拟仅适用于连接的 GCS,SDK 或其他 MAVLink 应用程序。

数据链路丢失

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.

RC 链接损失 failslafe (来自远程控制的数据不可用) 被默认启用。 这使得模拟仿真只能使用 MAVLink 或远程控制连接。

All parameters in SITL including this one get reset when you do make clean. 例如,设置为 0 禁用它。

RC 链接损失

The RC Link Loss failsafe (unavailability of data from a remote control) is enabled by default. 这可以在 GCS UI 中测试电池指示,而不会触发可能中断其他测试的低电池反应。

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.

低电量

为了模拟丢失和重新获取 GPS 全球定位系统信息,您可以停止/重新启动 GPS 驱动程序。 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 use the parameter SIM_BAT_MIN_PCT.

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

TIP

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

GPS 损失

Failure injection can be used to simulate different types of failures in many sensors and systems. For example, this can be used to simulate absent or intermittent GPS, RC signal that has stopped or got stuck on a particular value, failure of the avoidance system, and much more.

For example, to simulate GPS failure:

  1. Enable the parameter SYS_FAILURE_EN.

  2. Enter the following commands on the SITL instance pxh shell:

    sh
    # Turn (all) GPS off
    failure gps off
    
    # Turn (all) GPS on
    failure gps ok

See System Failure Injection for a list of supported target sensors and failure modes.