现在规则清单
全部检查经验的清单:各自读什么字段、什么条件触发、产出什么标签。
引擎当前内置的 113 条检查经验,按执行位置(slot,即下面每一节的标题)分组。 每条给出:适用(固件 / 机架 / 依赖)、取值(读哪些字段、过哪个算子)、判定(自上而下 命中第一条即发射)、产出(写进报告的 check 名、喂故障库匹配的标签、UI 用的统计)。
判定阈值就写在各自的经验 YAML 里;slot 决定执行顺序(报告里的 F01、F02… 编号按发射顺序生成)。
所有判定都由确定性引擎在浏览器本地完成——LLM 只把结论翻译成中文报告,不参与任何数值判断。
本页在构建时从 rules/*.yaml 自动生成。
airspeed(group: `airspeed`)
px4-airspeed-invalid — 空速健康
- 文件:
rules/airspeed.yaml| 位置:groupairspeed#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:机架 fixed_wing
- 取值:
cruise_ok = require_true(masked_any_in(vehicle_status.nav_state, vehicle_status.timestamp, ARMED_INTERVALS, codes=[3, 8]))invalid_frac = _try(np.mean( airspeed_validated.airspeed_sensor_measurement_valid == 0))has_invalid = invalid_frac is not Nonetas_min = _try(min(airspeed_validated.true_airspeed_m_s))- 判定:
- critical |
has_invalid and invalid_frac >= 0.50| threshold 0.5 | description "空速传感器在固定翼段大部分时间无效({invalid_frac:.0%} 样本)" | label=low_airspeed - warning |
has_invalid and invalid_frac >= 0.10| threshold 0.1 | description "空速传感器间歇无效({invalid_frac:.0%} 样本)" | label=low_airspeed - 产出:airspeedInvalidRatio=invalid_frac, airspeedMinM=tas_min, tag=low_airspeed
attitude_tracking(group: `attitude_tracking`)
apm-attitude-roll — 横滚跟踪误差
- 文件:
rules/attitude.yaml| 位置:groupattitude_tracking#1 - 文档:https://ardupilot.org/copter/docs/common-tuning.html
- 适用:总是适用
- 取值:
ats = ATT.timestamperr_roll = abs(ATT.DesRoll - ATT.Roll)peak_roll = max(err_roll)worst_roll = excursion_events(err_roll, ats, T0_US, threshold=15.0, limit=1)- 判定:
- critical |
dur_s >= 1.0 and peak > 25.0| threshold 25 | unit deg | description "横滚跟踪失败,持续 {dur_s:.1f} s、误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
dur_s >= 1.0| threshold 15 | unit deg | description "横滚持续偏离指令 {dur_s:.1f} s,误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
peak_roll > 30.0| threshold 30 | unit deg | description "横滚跟踪误差瞬时尖峰 {peak_roll:.0f}°" - 产出:tag=apm_attitude_tracking_error
px4-attitude-overshoot — 姿态跟踪超调
- 文件:
rules/attitude-overshoot.yaml| 位置:groupattitude_tracking#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
- `p99, osc_hz, seg_n = _try(att_tracking_stats(
att_q=vehicle_attitude.q,
指令源:两路都给,有 q_d 就用 q_d(新版只记它),没有才回退 roll/pitch_body。
顺序由算子定,规则不用管版本——按存在性挑,不按版本号挑。
sp_q=_ref("vehicle_attitude_setpoint.q_d"), sp_roll=_ref("vehicle_attitude_setpoint.roll_body"), sp_pitch=_ref("vehicle_attitude_setpoint.pitch_body"), att_ts=vehicle_attitude.timestamp, sp_ts=vehicle_attitude_setpoint.timestamp, intervals=ARMED_INTERVALS, tilt_min_deg=10.0, min_samples=50, sample_rate=50))` seg_ok = seg_n > 50 if seg_n else Falsep99_stat = p99 if seg_ok else Noneosc_stat = osc_hz if seg_ok else None- 判定:
- critical |
p99_stat >= 40.0 and VEHICLE == 'fixed_wing'| threshold 25 | unit ° | description "姿态跟踪误差过大(p99 {p99_stat:.1f}°)" | label=attitude_overshoot - warning |
p99_stat >= 25.0 and VEHICLE == 'fixed_wing'| threshold 25 | unit ° | description "姿态跟踪误差偏大(p99 {p99_stat:.1f}°)" | label=attitude_overshoot - critical |
p99_stat >= 30.0 and VEHICLE != 'fixed_wing'| threshold 15 | unit ° | description "姿态跟踪误差过大(p99 {p99_stat:.1f}°)" | label=attitude_overshoot - warning |
p99_stat >= 15.0 and VEHICLE != 'fixed_wing'| threshold 15 | unit ° | description "姿态跟踪误差偏大(p99 {p99_stat:.1f}°)" | label=attitude_overshoot - 产出:attitudeErrDegP99=p99_stat, attitudeOscHz=osc_stat, tag=attitude_overshoot
apm-attitude-pitch — 俯仰跟踪误差
- 文件:
rules/attitude.yaml| 位置:groupattitude_tracking#2 - 文档:https://ardupilot.org/copter/docs/common-tuning.html
- 适用:总是适用
- 取值:
ats = ATT.timestamperr_pitch = abs(ATT.DesPitch - ATT.Pitch)peak_pitch = max(err_pitch)worst_pitch = excursion_events(err_pitch, ats, T0_US, threshold=15.0, limit=1)- 判定:
- critical |
dur_s >= 1.0 and peak > 25.0| threshold 25 | unit deg | description "俯仰跟踪失败,持续 {dur_s:.1f} s、误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
dur_s >= 1.0| threshold 15 | unit deg | description "俯仰持续偏离指令 {dur_s:.1f} s,误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
peak_pitch > 30.0| threshold 30 | unit deg | description "俯仰跟踪误差瞬时尖峰 {peak_pitch:.0f}°" - 产出:tag=apm_attitude_tracking_error
px4-attitude-oscillation — 姿态误差高频振荡
- 文件:
rules/attitude-oscillation.yaml| 位置:groupattitude_tracking#2 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
- `p99, osc_hz, seg_n = _try(att_tracking_stats(
att_q=vehicle_attitude.q,
指令源:两路都给,有 q_d 就用 q_d(新版只记它),没有才回退 roll/pitch_body。
顺序由算子定,规则不用管版本——按存在性挑,不按版本号挑。
sp_q=_ref("vehicle_attitude_setpoint.q_d"), sp_roll=_ref("vehicle_attitude_setpoint.roll_body"), sp_pitch=_ref("vehicle_attitude_setpoint.pitch_body"), att_ts=vehicle_attitude.timestamp, sp_ts=vehicle_attitude_setpoint.timestamp, intervals=ARMED_INTERVALS, tilt_min_deg=10.0, min_samples=50, sample_rate=50))` seg_ok = seg_n > 50 if seg_n else Falsep99_stat = p99 if seg_ok else Noneosc_stat = osc_hz if seg_ok else None- 判定:
- warning |
osc_stat >= 4.0 and p99_stat >= 25.0 and VEHICLE == 'fixed_wing'| threshold 4 | unit Hz | description "姿态误差高频振荡(约 {osc_stat:.1f} Hz)" | label=attitude_overshoot - warning |
osc_stat >= 4.0 and p99_stat >= 15.0 and VEHICLE != 'fixed_wing'| threshold 4 | unit Hz | description "姿态误差高频振荡(约 {osc_stat:.1f} Hz)" | label=attitude_overshoot - 产出:attitudeErrDegP99=p99_stat, attitudeOscHz=osc_stat, tag=attitude_overshoot
apm-attitude-yaw — 航向跟踪误差
- 文件:
rules/attitude.yaml| 位置:groupattitude_tracking#3 - 文档:https://ardupilot.org/copter/docs/common-tuning.html
- 适用:总是适用
- 取值:
ats = ATT.timestamperr_yaw = abs(wrap_degrees(ATT.Yaw - ATT.DesYaw))peak_yaw = max(err_yaw)worst_yaw = excursion_events(err_yaw, ats, T0_US, threshold=15.0, limit=1)- 判定:
- critical |
dur_s >= 1.0 and peak > 25.0| threshold 25 | unit deg | description "航向跟踪失败,持续 {dur_s:.1f} s、误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
dur_s >= 1.0| threshold 15 | unit deg | description "航向持续偏离指令 {dur_s:.1f} s,误差峰值 {peak:.0f}°(t={start_s:.1f}s)" - warning |
peak_yaw > 30.0| threshold 30 | unit deg | description "航向跟踪误差瞬时尖峰 {peak_yaw:.0f}°" - 产出:tag=apm_attitude_tracking_error
baro(group: `baro`)
px4-baro-error-count — 气压计错误计数
- 文件:
rules/baro.yaml| 位置:groupbaro#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
ec = sensor_baro.error_countn_err = int(max(ec) - min(ec))- 判定:
- warning |
n_err > 0| threshold 0 | description "气压计错误计数增长 {n_err} 次" - 产出:baroErrorCount=n_err, tag=baro_error_count
px4-baro-frozen — 气压计数据冻结
- 文件:
rules/baro.yaml| 位置:groupbaro#2 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
m = interval_mask(sensor_baro.timestamp, ARMED_INTERVALS)prange = range_of(apply_mask(sensor_baro.pressure, m))- 判定:
- warning |
prange < 3.0| threshold 3 | unit Pa | description "armed 段气压极差仅 {prange:.1f} Pa(数据疑似冻结)" - 产出:baroPressureRange=prange, tag=baro_frozen
px4-baro-overheat — 气压计过温
- 文件:
rules/baro.yaml| 位置:groupbaro#3 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
tmax = max(sensor_baro.temperature)- 判定:
- warning |
tmax >= 85| threshold 85 | unit degC | description "气压计最高温度 {tmax:.0f} °C" - 产出:baroTempMax=tmax, tag=baro_overheat
px4-baro-gps-alt-drift — 气压高度相对 GPS 漂移
- 文件:
rules/baro.yaml| 位置:groupbaro#4 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
bts = vehicle_air_data.timestampgalt = vehicle_global_position.altgalt_b = interp_to(galt, vehicle_global_position.timestamp, bts)d = vehicle_air_data.baro_alt_meter - galt_bdrop, tail = head_tail_median_drop(d, bts, ARMED_INTERVALS, skip_first_s=5, min_seg=20)drift = abs(drop)- 判定:
- warning |
drift >= 50.0| threshold 50 | unit m | description "armed 段气压高度相对 GPS 漂移 {drift:.0f} m" - 产出:baroAltDrift=drift, tag=baro_alt_drift
battery(group: `battery`)
apm-battery-low — 电池最低电压
- 文件:
rules/power.yaml| 位置:groupbattery#1 - 文档:https://ardupilot.org/copter/docs/failsafe-battery.html
- 适用:总是适用
- 取值:
volts = _ref("BAT.Volt", "CURR.Volt")vmin = min(volts)vmax = max(volts)cells_raw = int(vmax / 4.2 + 0.5)per_cell = vmax / cells_rawcells = cells_raw if (vmax > 4.0 and 70.0 > vmax and per_cell > 3.3 and 4.4 > per_cell) else Nonecrit_v = cells * 3.3low_v = cells * 3.5- 判定:
- critical |
vmin <= crit_v and vmax <= 70.0| threshold 3.3 | unit V | description "电池电压触及临界线,最低 {vmin:.2f} V" - warning |
vmin <= low_v and vmax <= 70.0| threshold 3.5 | unit V | description "电池电压触及低电压告警线,最低 {vmin:.2f} V" - 产出:tag=apm_battery_low_voltage
px4-power-cell-voltage — 单电芯电压
- 文件:
rules/power-cell-voltage.yaml| 位置:groupbattery#1 - 文档:https://docs.px4.io/main/en/config/battery.html
- 适用:总是适用
- 取值:
vmin, cell_min, cells, have_measured, have_fallback, no_cell = _try(cell_voltage_min( battery_status.voltage_cell_v, battery_status.voltage_v, battery_status.voltage_filtered_v, battery_status.cell_count))- 判定:
- critical |
have_measured and cell_min < 3.55| threshold 3.55 | unit V/cell | description "电芯电压严重过低" - critical |
have_fallback and not have_measured and cell_min < 3.55| threshold 3.55 | unit V/cell | description "电芯电压严重过低" - warning |
have_measured and cell_min < 3.70| threshold 3.7 | unit V/cell | description "电芯电压偏低" - warning |
have_fallback and not have_measured and cell_min < 3.70| threshold 3.7 | unit V/cell | description "电芯电压偏低" - info |
no_cell| description "日志缺少电芯电压与 cell_count,未做单电芯判断" - 产出:batteryVoltageMin=vmin, batteryCellCount=cells, batteryCellVoltageMin=cell_min, tag=battery_voltage_drop
apm-battery-sag — 电池负载压降
- 文件:
rules/power.yaml| 位置:groupbattery#2 - 文档:https://ardupilot.org/copter/docs/failsafe-battery.html
- 适用:总是适用
- 取值:
volts = _ref("BAT.Volt", "CURR.Volt")curr = _ref("BAT.Curr", "CURR.Curr")peak_curr = max(curr)sag = np.ptp(volts[curr > 20.0])- 判定:
- info |
sag >= 1.0| threshold 1 | unit V | description "大电流下压降 {sag:.2f} V(峰值电流 {peak_curr:.1f} A)" - 产出:tag=apm_battery_sag
px4-power-sag — 飞行中持续压降
- 文件:
rules/power-sag.yaml| 位置:groupbattery#2 - 文档:https://docs.px4.io/main/en/config/battery.html
- 适用:总是适用
- 取值:
cell_min_t = rows_aggregate(battery_status.voltage_cell_v, agg="min", gt=0)drop, tail = head_tail_median_drop(cell_min_t, battery_status.timestamp, ARMED_INTERVALS, skip_first_s=5, min_seg=20)- 判定:
- warning |
drop >= 0.30 and tail < 3.70| threshold 0.3 | unit V | description "飞行中单电芯持续压降 {drop:.2f} V(尾段中位 {tail:.2f} V)" - 产出:batteryCellSagFlight=drop, tag=battery_voltage_drop
apm-battery-sudden-drop — 电池电压突降
- 文件:
rules/power.yaml| 位置:groupbattery#3 - 文档:https://ardupilot.org/copter/docs/failsafe-battery.html
- 适用:总是适用
- 取值:
volts = _ref("BAT.Volt", "CURR.Volt")vts = _ref("BAT.timestamp", "CURR.timestamp")vmed = median(volts)drops = step_drop_events(volts, vts, T0_US) if (vmed > 4.0 and 70.0 > vmed) else None- 判定:
- critical |
not recovered and drop > 4.0| threshold 4 | unit V | description "电池电压在 {dt_s:.3f} s 内跌落 {drop:.2f} V(t={start_s:.2f}s)" - warning |
not recovered| threshold 2 | unit V | description "电池电压在 {dt_s:.3f} s 内跌落 {drop:.2f} V(t={start_s:.2f}s)" - 产出:tag=apm_battery_sudden_drop
px4-power-remaining — 电池剩余电量
- 文件:
rules/power-remaining.yaml| 位置:groupbattery#3 - 文档:https://docs.px4.io/main/en/config/battery.html
- 适用:总是适用
- 取值:
rem = min_ge(battery_status.remaining, ge=0)rem_pct = rem * 100- 判定:
- critical |
rem <= 0.10| threshold 0.1 | description "电池剩余电量极低({rem_pct:.0f}%)" - warning |
rem <= 0.20| threshold 0.2 | description "电池剩余电量偏低({rem_pct:.0f}%)" - 产出:batteryRemainingMin=rem, tag=battery_voltage_drop
px4-battery-temperature — 电池温度
- 文件:
rules/battery-temperature.yaml| 位置:groupbattery#4 - 文档:https://docs.px4.io/main/en/config/battery.html
- 适用:总是适用
- 取值:
t_max = _try(max(battery_status.temperature))- 判定:
- critical |
t_max >= 65| threshold 65 | unit degC | description "电池最高温 {t_max:.1f}°C" - warning |
t_max >= 55| threshold 55 | unit degC | description "电池最高温 {t_max:.1f}°C" - 产出:batteryTempMax=t_max, tag=battery_overheat
calibration(group: `calibration`)
apm-calibration-compass-offset — 罗盘校准偏移
- 文件:
rules/calibration.yaml| 位置:groupcalibration#1 - 文档:https://ardupilot.org/copter/docs/common-compass-calibration-in-mission-planner.html
- 适用:总是适用
- 取值:
ofs_x = _cfg("COMPASS_OFS_X", 0.0)ofs_y = _cfg("COMPASS_OFS_Y", 0.0)ofs_z = _cfg("COMPASS_OFS_Z", 0.0)offset_mag = np.hypot(np.hypot(ofs_x, ofs_y), ofs_z)- 判定:
- critical |
offset_mag > 600.0| threshold 600 | unit mGauss | description "罗盘硬铁偏移 {offset_mag:.0f} mGauss,校准质量差" - warning |
offset_mag > 300.0| threshold 300 | unit mGauss | description "罗盘硬铁偏移 {offset_mag:.0f} mGauss,偏大" - 产出:tag=apm_calibration_compass_large_offset
compass(group: `compass`)
apm-compass-interference — 罗盘场强稳定性
- 文件:
rules/compass.yaml| 位置:groupcompass#1 - 文档:https://ardupilot.org/copter/docs/common-compass-setup-advanced.html
- 适用:总是适用
- 取值:
mag = np.hypot(np.hypot(MAG.MagX, MAG.MagY), MAG.MagZ)mean_mag = mean(mag)cv_mag = np.std(mag) / np.mean(mag)range_ratio = np.ptp(mag) / mean_magn_mag = len(mag)- 判定:
- critical |
cv_mag > 0.60 and n_mag >= 10| threshold 0.6 | description "罗盘场强极不稳定,变异系数 {cv_mag:.2f}({mean_mag:.0f} mGauss 均值上摆动)" - warning |
(cv_mag > 0.30 or range_ratio > 0.60) and n_mag >= 10| threshold 0.3 | description "罗盘场强摆动偏大,变异系数 {cv_mag:.2f}、极差比 {range_ratio:.2f}(均值 {mean_mag:.0f} mGauss)" - 产出:tag=apm_compass_interference
config_safety(group: `config_safety`)
apm-config-arming-check — 预解锁检查被禁用
- 文件:
rules/config.yaml| 位置:groupconfig_safety#1 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
arming_check = _cfg("ARMING_CHECK")- 判定:
- warning |
arming_check == 0| threshold 0 | description "预解锁检查被整体禁用(ARMING_CHECK=0)" - 产出:tag=apm_config_arming_check_disabled
apm-config-batt-monitor — 未配置电池监控
- 文件:
rules/config.yaml| 位置:groupconfig_safety#2 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
batt_monitor = _cfg("BATT_MONITOR")- 判定:
- info |
batt_monitor == 0| threshold 0 | description "未配置电池监控(BATT_MONITOR=0)" - 产出:tag=apm_config_no_battery_monitor
apm-config-fs-thr — 油门失效保护被禁用
- 文件:
rules/config.yaml| 位置:groupconfig_safety#3 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
fs_thr_enable = _cfg("FS_THR_ENABLE")- 判定:
- info |
fs_thr_enable == 0| threshold 0 | description "油门失效保护被禁用(FS_THR_ENABLE=0)" - 产出:tag=apm_config_thr_failsafe_disabled
cpu(group: `cpu`)
px4-cpu-load — CPU 负载
- 文件:
rules/cpu-load.yaml| 位置:groupcpu#— - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
cpu_max = max(cpuload.load)- 判定:
- critical |
cpu_max >= 0.95| threshold 0.95 | description "CPU 负载峰值 {cpu_max:.0%} 超阈值" - warning |
cpu_max >= 0.90| threshold 0.9 | description "CPU 负载峰值 {cpu_max:.0%} 偏高" - 产出:cpuLoadMax=cpu_max
ekf_faults(group: `ekf_faults`)
px4-ekf-fault — EKF 融合硬故障
- 文件:
rules/ekf-faults.yaml| 位置:groupekf_faults#1 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
fault_raw = _try(bit_or_max( estimator_status[:].filter_fault_flags))fault_union = _try(coalesce(fault_raw, 0))crit_bits = _try(has_bits(fault_union, 63))- 判定:
- critical |
crit_bits| threshold 0 | description "EKF 报告核心融合硬故障(filter_fault_flags={fault_union})" - info |
fault_union > 0 and not crit_bits| threshold 0 | description "EKF 报告非核心辅助传感器融合拒绝(filter_fault_flags={fault_union},常见为未使用视觉/光流)" - 产出:tag=ekf_innovation_failure
px4-ekf-timeout — EKF 融合超时
- 文件:
rules/ekf-timeout.yaml| 位置:groupekf_faults#2 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
to = _try(bit_or_max(estimator_status[:].timeout_flags))to = _try(coalesce(to, 0))- 判定:
- warning |
to > 0| threshold 0 | description "EKF 某路观测融合超时(timeout_flags={to})" | label=ekf_innovation_failure - 产出:tag=ekf_innovation_failure
px4-ekf-gps-check-fails — EKF 拒收 GPS(解锁后)
- 文件:
rules/ekf-gps-check-fails.yaml| 位置:groupekf_faults#3 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
gf = estimator_status.gps_check_fail_flagsam = interval_mask(estimator_status.timestamp, ARMED_INTERVALS)gf_armed = apply_mask(gf, am)n_armed = count_true(am)n_bad = count_above(gf_armed, gt=0)ratio = _try(div(n_bad, n_armed))gf_worst = max(gf_armed)- 判定:
- warning |
ratio is not None and ratio >= 0.5 and n_bad >= 100| threshold 0.5 | description "EKF 在解锁后 {ratio:.0%} 的时间拒绝 GPS 融合(gps_check_fail_flags 最严 {gf_worst})" | label=ekf_innovation_failure - 产出:tag=ekf_innovation_failure
ekf_innovations(group: `ekf_innovations`)
px4-ekf-innovation — EKF 创新检验
- 文件:
rules/ekf-innovation.yaml| 位置:groupekf_innovations#1 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
frac, names, inst = worst_reject_ratio( estimator_status[:].innovation_check_flags, estimator_status[:].vel_test_ratio, estimator_status[:].pos_test_ratio, estimator_status[:].hgt_test_ratio, estimator_status[:].hdg_test_ratio, estimator_status[:].mag_test_ratio, estimator_status[:].tas_test_ratio, estimator_status[:].hagl_test_ratio, estimator_status[:].beta_test_ratio, primary_min=3, primary_names=["速度", "水平位置", "垂直位置", "磁罗盘 X", "磁罗盘 Y", "磁罗盘 Z", "航向", "空速", "侧滑", "离地高度", "光流 X", "光流 Y"], ge=1.0, # 通道判拒阈值:ratio >= 1 即该路观测被 EKF 拒绝 channel_min=3, # 通道最少被拒样本数,去偶发尖峰毛刺 channel_labels=["速度", "水平位置", "垂直高度", "航向", "磁罗盘", "空速", "离地高度", "侧滑"], fallback_label="未知通道")pct = frac * 100- 判定:
- critical |
pct >= 5.0| threshold 5 | unit % | description "EKF 创新检验持续失败(estimator #{inst}:{names})" - warning |
pct >= 1.0| threshold 1 | unit % | description "EKF 创新检验偶发失败(estimator #{inst}:{names})" - 产出:ekfRejectRatioPct=pct, tag=ekf_innovation_failure
ekf_variance(group: `ekf_variance`)
apm-ekf-velocity — EKF 速度检验比
- 文件:
rules/ekf.yaml| 位置:groupekf_variance#1 - 文档:https://ardupilot.org/copter/docs/ekf-inav-failsafe.html
- 适用:总是适用
- 取值:
sv_max = max(_ref("XKF4.SV", "NKF4.SV"))- 判定:
- critical |
sv_max > 1.0| threshold 1 | description "EKF 速度检验比超拒绝线,峰值 {sv_max:.2f}" - warning |
sv_max > 0.8| threshold 0.8 | description "EKF 速度检验比偏高,峰值 {sv_max:.2f}" - 产出:tag=apm_ekf_variance_high
apm-ekf-position — EKF 位置检验比
- 文件:
rules/ekf.yaml| 位置:groupekf_variance#2 - 文档:https://ardupilot.org/copter/docs/ekf-inav-failsafe.html
- 适用:总是适用
- 取值:
sp_max = max(_ref("XKF4.SP", "NKF4.SP"))- 判定:
- critical |
sp_max > 1.0| threshold 1 | description "EKF 位置检验比超拒绝线,峰值 {sp_max:.2f}" - warning |
sp_max > 0.8| threshold 0.8 | description "EKF 位置检验比偏高,峰值 {sp_max:.2f}" - 产出:tag=apm_ekf_variance_high
apm-ekf-height — EKF 高度检验比
- 文件:
rules/ekf.yaml| 位置:groupekf_variance#3 - 文档:https://ardupilot.org/copter/docs/ekf-inav-failsafe.html
- 适用:总是适用
- 取值:
sh_max = max(_ref("XKF4.SH", "NKF4.SH"))- 判定:
- critical |
sh_max > 1.0| threshold 1 | description "EKF 高度检验比超拒绝线,峰值 {sh_max:.2f}" - warning |
sh_max > 0.8| threshold 0.8 | description "EKF 高度检验比偏高,峰值 {sh_max:.2f}" - 产出:tag=apm_ekf_variance_high
apm-ekf-magnetometer — EKF 磁罗盘检验比
- 文件:
rules/ekf.yaml| 位置:groupekf_variance#4 - 文档:https://ardupilot.org/copter/docs/ekf-inav-failsafe.html
- 适用:总是适用
- 取值:
sm_max = max(_ref("XKF4.SM", "NKF4.SM"))- 判定:
- critical |
sm_max > 1.0| threshold 1 | description "EKF 磁罗盘检验比超拒绝线,峰值 {sm_max:.2f}" - warning |
sm_max > 0.8| threshold 0.8 | description "EKF 磁罗盘检验比偏高,峰值 {sm_max:.2f}" - 产出:tag=apm_ekf_variance_high
esc(group: `esc`)
px4-esc-rpm-unbalance — ESC 转速不平衡
- 文件:
rules/esc-status.yaml| 位置:groupesc#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
rpm_m = stack_columns( _ref("esc_status.esc[0].esc_rpm"), _ref("esc_status.esc[1].esc_rpm"), _ref("esc_status.esc[2].esc_rpm"), _ref("esc_status.esc[3].esc_rpm"), _ref("esc_status.esc[4].esc_rpm"), _ref("esc_status.esc[5].esc_rpm"), _ref("esc_status.esc[6].esc_rpm"), _ref("esc_status.esc[7].esc_rpm"))seg = active_window_mask(esc_status.timestamp, ARMED_INTERVALS, vehicle_status.nav_state, vehicle_status.timestamp, codes=[2, 4, 6, 14, 21], min_active=20)means = active_column_means(rpm_m, seg, min_mean=100.0)sp, hi_i, lo_i = items_spread(means)hi = means[hi_i]["mean"]lo = means[lo_i]["mean"]rel = (hi - lo) / hi- 判定:
- critical |
rel >= 0.30| threshold 0.3 | description "ESC {lo_i} 转速比 {hi_i} 低 {rel:.0%}(悬停段 {lo:.0f} vs {hi:.0f} rpm)" - warning |
rel >= 0.15| threshold 0.15 | description "ESC {lo_i} 转速比 {hi_i} 低 {rel:.0%}(悬停段 {lo:.0f} vs {hi:.0f} rpm)" - 产出:escRpmSpreadRatio=rel, escRpmHigh=hi, escRpmLow=lo, escCountActive=len(means), tag=esc_rpm_unbalance
px4-esc-current-skew — ESC 电流偏斜
- 文件:
rules/esc-status.yaml| 位置:groupesc#2 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
cur_m = stack_columns( _ref("esc_status.esc[0].esc_current"), _ref("esc_status.esc[1].esc_current"), _ref("esc_status.esc[2].esc_current"), _ref("esc_status.esc[3].esc_current"), _ref("esc_status.esc[4].esc_current"), _ref("esc_status.esc[5].esc_current"), _ref("esc_status.esc[6].esc_current"), _ref("esc_status.esc[7].esc_current"))seg = active_window_mask(esc_status.timestamp, ARMED_INTERVALS, vehicle_status.nav_state, vehicle_status.timestamp, codes=[2, 4, 6, 14, 21], min_active=20)means = active_column_means(cur_m, seg, min_mean=0.5)sp, hi_i, lo_i = items_spread(means)hi = means[hi_i]["mean"]lo = means[lo_i]["mean"]ratio = hi / lo if lo > 0 else 0- 判定:
- warning |
ratio >= 2.5 and hi >= 5.0| threshold 2.5 | description "ESC {hi_i} 平均电流是 {lo_i} 的 {ratio:.1f} 倍({hi:.1f} vs {lo:.1f} A,悬停段)" - 产出:escCurrentRatio=ratio, escCurrentHigh=hi, escCurrentLow=lo, tag=esc_current_skew
px4-esc-overheat — 电调过温
- 文件:
rules/esc-status.yaml| 位置:groupesc#3 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
temp_m = stack_columns( _ref("esc_status.esc[0].esc_temperature"), _ref("esc_status.esc[1].esc_temperature"), _ref("esc_status.esc[2].esc_temperature"), _ref("esc_status.esc[3].esc_temperature"), _ref("esc_status.esc[4].esc_temperature"), _ref("esc_status.esc[5].esc_temperature"), _ref("esc_status.esc[6].esc_temperature"), _ref("esc_status.esc[7].esc_temperature"))tmax_t = rows_aggregate(temp_m, agg="max", gt=0.0)tmax = max(tmax_t) if tmax_t is not None else Nonerise, tail_med = _try(head_tail_median_drop(tmax_t, esc_status.timestamp, ARMED_INTERVALS, skip_first_s=5, min_seg=20))- 判定:
- critical |
tmax >= 105| threshold 105 | unit degC | description "ESC 最高温度 {tmax:.0f} °C(飞行中温升约 {rise:.0f} °C)" - warning |
tmax >= 85| threshold 85 | unit degC | description "ESC 最高温度 {tmax:.0f} °C" - 产出:escTempMax=tmax, escTempRise=rise if rise is not None else None, tag=esc_overheat
px4-esc-error-count — 电调报错计数
- 文件:
rules/esc-status.yaml| 位置:groupesc#4 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
err_m = stack_columns( _ref("esc_status.esc[0].esc_errorcount"), _ref("esc_status.esc[1].esc_errorcount"), _ref("esc_status.esc[2].esc_errorcount"), _ref("esc_status.esc[3].esc_errorcount"), _ref("esc_status.esc[4].esc_errorcount"), _ref("esc_status.esc[5].esc_errorcount"), _ref("esc_status.esc[6].esc_errorcount"), _ref("esc_status.esc[7].esc_errorcount"))err_t = rows_aggregate(err_m, agg="max")n_err = int(max(err_t) - err_t[0]) if err_t is not None else 0- 判定:
- critical |
n_err > 0| threshold 0 | description "电调错误计数增长 {n_err} 次" - 产出:escErrorCount=n_err, tag=esc_error_count
events(group: `events`)
apm-err-subsystem — 子系统错误(ERR)
- 文件:
rules/events.yaml| 位置:groupevents#1 - 文档:https://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html
- 适用:总是适用
- 取值:
err_subsys = ERR.Subsys[ERR.ECode > 0.5]err_count = len(err_subsys)crit_count = sum(np.isin(err_subsys, [5, 6, 7, 9, 12, 16, 17, 25, 29, 30]))- 判定:
- critical |
crit_count > 0| threshold 0 | unit 条 | description "发生 {crit_count} 条安全关键子系统错误(ERR)" - warning |
err_count > 0| threshold 0 | unit 条 | description "发生 {err_count} 条子系统错误(ERR)" - 产出:tag=apm_subsystem_error
apm-ev-events — 关键事件(EV)
- 文件:
rules/events.yaml| 位置:groupevents#2 - 文档:https://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html
- 适用:总是适用
- 取值:
ev_id = EV.Idev_count = len(ev_id)key_count = sum(np.isin(ev_id, [19, 54, 59, 60, 62]))- 判定:
- warning |
key_count > 0| threshold 0 | unit 条 | description "日志含 {key_count} 条关键异常事件(EV)" - info |
ev_count > 0| threshold 0 | unit 条 | description "日志共记录 {ev_count} 条事件(EV)" - 产出:tag=apm_critical_event_logged
apm-mode-timeline — 模式时间线
- 文件:
rules/events.yaml| 位置:groupevents#3 - 文档:https://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html
- 适用:总是适用
- 取值:
mode_num = MODE.ModeNummode_name = MODE.Modets = MODE.timestampchanged = np.diff(mode_num) != 0change_count = sum(changed)n_modes = len(mode_num)- 判定:
- info |
change_count > 0| threshold 0 | unit 次切换 | description "共 {change_count} 次模式切换({n_modes} 条 MODE 消息,日志全程 {DURATION_S:.0f}s)" - 产出:-
failsafe(group: `failsafe`)
px4-failsafe-failsafe — 失效保护触发
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#1 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = rising_edge_events(vehicle_status.failsafe, vehicle_status.timestamp, ARMED_INTERVALS, T0_US)- 判定:
- critical |
True| description "触发失效保护(飞行中,t={t_s:.1f}s)" | label=failsafe - 产出:-
px4-failsafe-rc_signal_lost — 遥控信号丢失
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#2 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = rising_edge_events(vehicle_status.rc_signal_lost, vehicle_status.timestamp, ARMED_INTERVALS, T0_US)- 判定:
- warning |
True| description "遥控信号丢失(飞行中,t={t_s:.1f}s)" | label=rc_lost - 产出:-
px4-failsafe-data_link_lost — 数据链路丢失
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#3 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = rising_edge_events(vehicle_status.data_link_lost, vehicle_status.timestamp, ARMED_INTERVALS, T0_US)- 判定:
- warning |
True| description "数据链路丢失(飞行中,t={t_s:.1f}s)" - 产出:-
px4-failsafe-engine_failure — 动力故障保护
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#4 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = rising_edge_events(vehicle_status.engine_failure, vehicle_status.timestamp, ARMED_INTERVALS, T0_US)- 判定:
- critical |
True| description "发动机/动力故障保护(飞行中,t={t_s:.1f}s)" - 产出:-
px4-failsafe-mission_failure — 任务失效保护
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#5 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = rising_edge_events(vehicle_status.mission_failure, vehicle_status.timestamp, ARMED_INTERVALS, T0_US)- 判定:
- critical |
True| description "任务失效保护(飞行中,t={t_s:.1f}s)" - 产出:-
px4-failsafe-nav — 失效保护导航状态
- 文件:
rules/failsafe.yaml| 位置:groupfailsafe#6 - 文档:https://docs.px4.io/main/en/config/safety.html
- 适用:总是适用
- 取值:
events = step_into_events(vehicle_status.nav_state, vehicle_status.timestamp, ARMED_INTERVALS, T0_US, codes={5: "AUTO_RTL", 12: "DESCEND", 13: "TERMINATION", 18: "LAND"})- 判定:
- critical |
True| description "飞行中导航状态切换为 {name}(t={t_s:.1f}s)" | label=failsafe - 产出:-
fd_status(group: `fd_status`)
px4-fd-status — 飞行故障检测器
- 文件:
rules/fd-status.yaml| 位置:groupfd_status#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
n_roll = sum(failure_detector_status.fd_roll)n_pitch = sum(failure_detector_status.fd_pitch)n_alt = sum(failure_detector_status.fd_alt)n_batt = sum(failure_detector_status.fd_battery)n_motor = sum(failure_detector_status.fd_motor)imbal = sum(failure_detector_status.fd_imbalanced_prop)motor_mask = max(failure_detector_status.motor_failure_mask)fd_any = n_roll + n_pitch + n_alt + n_batt + n_motor- 判定:
- critical |
motor_mask > 0| threshold 0 | description "飞行故障检测器报告电机失效(mask={motor_mask})" - critical |
fd_any > 0| threshold 0 | description "飞行故障检测器触发 {fd_any} 帧(roll={n_roll} pitch={n_pitch} alt={n_alt} batt={n_batt} motor={n_motor})" - warning |
imbal > 0| threshold 0 | description "动力不平衡检测触发 {imbal} 帧" - 产出:fdTriggeredFrames=fd_any, fdMotorFailureMask=motor_mask, tag=fd_triggered
gps_detailed(group: `gps_detailed`)
px4-gps-detailed — GPS 检查明细
- 文件:
rules/gps-detailed.yaml| 位置:groupgps_detailed#1 - 文档:https://docs.px4.io/main/en/gps_compass/
- 适用:总是适用
- 取值:
n_fix = sum(estimator_gps_status.check_fail_gps_fix)n_sat = sum(estimator_gps_status.check_fail_min_sat_count)n_drift = sum(estimator_gps_status.check_fail_max_horz_drift)n_err = sum(estimator_gps_status.check_fail_max_horz_err)n_pdop = sum(estimator_gps_status.check_fail_max_pdop)n_spoof = sum(estimator_gps_status.check_fail_spoofed_gps)n_fail = n_fix + n_sat + n_drift + n_err + n_pdop + n_spoofdrift_rate = max(estimator_gps_status.position_drift_rate_horizontal_m_s)spd = max(estimator_gps_status.filtered_horizontal_speed_m_s)- 判定:
- critical |
n_spoof > 0| threshold 0 | description "GPS 欺骗检测触发 {n_spoof} 帧" - warning |
n_fail > 0| threshold 0 | description "GPS 检查未通过 {n_fail} 帧(峰值水平漂移率 {drift_rate:.2f} m/s)" - 产出:gpsCheckFailFrames=n_fail, gpsDriftRateMax=drift_rate, tag=gps_check_fail
gps_health(group: `gps_health`)
apm-gps-fix — GPS 定位状态
- 文件:
rules/gps.yaml| 位置:groupgps_health#1 - 文档:https://ardupilot.org/copter/docs/gps-failsafe-glitch-protection.html
- 适用:总是适用
- 取值:
status = GPS.Statussmax = max(status)status_armed = status[interval_mask(GPS.timestamp, ARMED_INTERVALS)]smin_armed = min(status_armed)- 判定:
- warning |
smax < 3.0| threshold 3 | description "全程未达 3D 定位,最高状态 {smax:.0f}" - critical |
smin_armed < 3.0| threshold 3 | description "飞行中丢过 3D 定位,armed 段最低状态 {smin_armed:.0f}" - 产出:tag=apm_gps_no_fix
px4-gps-eph — GPS 水平位置误差
- 文件:
rules/gps-eph.yaml| 位置:groupgps_health#1 - 文档:https://docs.px4.io/main/en/gps_compass/
- 适用:总是适用
- 取值:
eph_pos = vehicle_gps_position.eph[vehicle_gps_position.eph > 0]eph_m = eph_pos * 0.001e_p95 = percentile(eph_m, p=95)e_max = max(eph_m)- 判定:
- warning |
e_p95 >= 10.0| threshold 10 | unit m | description "GPS 水平位置误差持续偏大(p95 {e_p95:.1f} m)" | label=gps_eph_high - info |
e_p95 >= 5.0| threshold 5 | unit m | description "GPS 水平位置误差偶发偏大(p95 {e_p95:.1f} m)" | label=gps_eph_high - 产出:gpsEphP95M=e_p95, gpsEphMaxM=e_max, tag=gps_eph_high
apm-gps-sats — GPS 搜星数
- 文件:
rules/gps.yaml| 位置:groupgps_health#2 - 文档:https://ardupilot.org/copter/docs/gps-failsafe-glitch-protection.html
- 适用:总是适用
- 取值:
nmin = min(GPS.NSats[interval_mask(GPS.timestamp, ARMED_INTERVALS)])- 判定:
- critical |
nmin < 4| threshold 4 | unit 颗 | description "飞行中搜星数最低仅 {nmin} 颗" - warning |
nmin < 6| threshold 6 | unit 颗 | description "飞行中搜星数偏低,最低 {nmin} 颗" - 产出:tag=apm_gps_low_sats
px4-gps-sats — GPS 卫星数
- 文件:
rules/gps-sats.yaml| 位置:groupgps_health#2 - 文档:https://docs.px4.io/main/en/gps_compass/
- 适用:总是适用
- 取值:
s_min = min(vehicle_gps_position.satellites_used)- 判定:
- warning |
s_min <= 6| threshold 8 | unit 颗 | description "GPS 卫星数最少仅 {s_min} 颗" | label=gps_eph_high - 产出:gpsSatellitesMin=s_min, tag=gps_eph_high
apm-gps-hdop — GPS 水平精度因子
- 文件:
rules/gps.yaml| 位置:groupgps_health#3 - 文档:https://ardupilot.org/copter/docs/gps-failsafe-glitch-protection.html
- 适用:总是适用
- 取值:
hmax = max(GPS.HDop[interval_mask(GPS.timestamp, ARMED_INTERVALS) & (GPS.Status > 2.5)])- 判定:
- critical |
hmax > 5.0| threshold 5 | description "飞行中 HDOP 峰值 {hmax:.1f},水平位置不可用" - warning |
hmax > 2.0| threshold 2 | description "飞行中 HDOP 峰值 {hmax:.1f},卫星几何偏弱" - 产出:tag=apm_gps_high_hdop
px4-gps-jump — GPS 位置跳变
- 文件:
rules/gps-jump.yaml| 位置:groupgps_health#3 - 文档:https://docs.px4.io/main/en/gps_compass/
- 适用:总是适用
- 取值:
step = _try(adjacent_speed_mps( _ref("vehicle_gps_position.latitude_deg", "vehicle_gps_position.lat", unit="deg"), _ref("vehicle_gps_position.longitude_deg", "vehicle_gps_position.lon", unit="deg"), vehicle_gps_position.timestamp))njump = _try(np.sum(step > 50.0))- 判定:
- warning |
njump >= 3| threshold 3 | unit 次 | description "GPS 位置出现 {njump} 次异常跳变(>50 m/s)" | label=gps_jump - 产出:gpsJumpCount=njump, tag=gps_jump
px4-gps-interference — GPS 干扰
- 文件:
rules/gps-interference.yaml| 位置:groupgps_health#4 - 文档:https://docs.px4.io/main/en/gps_compass/
- 适用:总是适用
- 取值:
jam_max = _try(max(vehicle_gps_position.jamming_state))jam_ind = _try(max(vehicle_gps_position.jamming_indicator))noise = _try(max(vehicle_gps_position.noise_per_ms))hdop_p95 = _try(percentile(vehicle_gps_position.hdop, p=95))have_jam = is_not_none(jam_max)- 判定:
- critical |
have_jam and jam_max >= 3| threshold 3 | unit 枚举 | description "GPS 接收机自报严重干扰" - warning |
have_jam and jam_max >= 2| threshold 2 | unit 枚举 | description "GPS 接收机自报疑似干扰" - warning |
not have_jam and hdop_p95 > 2.0| threshold 2 | description "HDOP p95 = {hdop_p95:.2f},定位精度恶化" - 产出:gpsJammingStateWorst=jam_max, gpsJammingIndicatorMax=jam_ind, gpsNoisePerMsMax=noise, gpsHdopP95=hdop_p95, tag=gps_interference
数据质量 guard(group: `guards`)
px4-guard-restart — 数据质量-中途重启
- 文件:
rules/guard-restart.yaml| 位置:groupguards#1 - 适用:总是适用
- 取值:
- (无 compute)
- 判定:
- guard |
RESTART_DETECTED| description "Data quality: restart_detected" | label=restart_detected - 产出:-
px4-guard-topic-missing — 数据质量-关键 topic 缺失
- 文件:
rules/guard-topic-missing.yaml| 位置:groupguards#2 - 适用:总是适用
- 取值:
- (无 compute)
- 判定:
- guard |
not has_topic('vehicle_status')| description "Data quality: topic_missing:vehicle_status" | label=topic_missing:vehicle_status - guard |
not has_topic('battery_status')| description "Data quality: topic_missing:battery_status" | label=topic_missing:battery_status - guard |
not has_topic('estimator_status')| description "Data quality: topic_missing:estimator_status" | label=topic_missing:estimator_status - 产出:-
px4-guard-log-dropouts — 数据质量-日志丢包
- 文件:
rules/guard-log-dropouts.yaml| 位置:groupguards#3 - 适用:总是适用
- 取值:
- (无 compute)
- 判定:
- guard |
DROPOUT_MS > 1000| description "Data quality: log_dropouts_high" | label=log_dropouts_high - 产出:-
数据质量 guard(最早执行)(group: `guards_early`)
apm-guard-integrity — 数据质量-日志完整性
- 文件:
rules/integrity.yaml| 位置:groupguards_early#1 - 适用:总是适用
- 取值:
- (无 compute)
- 判定:
- guard |
not log_ok()| description "Data quality: log_incomplete" | label=log_incomplete - 产出:tag=apm_guard_log_incomplete
px4-guard-short-log — 数据质量-短日志
- 文件:
rules/guard-short-log.yaml| 位置:groupguards_early#1 - 适用:总是适用
- 取值:
- (无 compute)
- 判定:
- guard |
ARMED_S > 0 and ARMED_S < 60| description "Data quality: insufficient_data" | label=insufficient_data - guard |
ARMED_S == 0 and DURATION_S < 60| description "Data quality: insufficient_data" | label=insufficient_data - 产出:-
gyro_fft(group: `gyro_fft`)
px4-gyro-fft — 陀螺频谱峰值
- 文件:
rules/gyro-fft.yaml| 位置:groupgyro_fft#1 - 文档:https://docs.px4.io/main/en/assembly/vibration_isolation.html
- 适用:总是适用
- 取值:
snr_x = max(sensor_gyro_fft.peak_snr_x)snr_y = max(sensor_gyro_fft.peak_snr_y)snr_z = max(sensor_gyro_fft.peak_snr_z)snr_max = max(snr_x, snr_y, snr_z)freq_x = max(sensor_gyro_fft.peak_frequencies_x)freq_y = max(sensor_gyro_fft.peak_frequencies_y)freq_z = max(sensor_gyro_fft.peak_frequencies_z)res_hz = max(sensor_gyro_fft.resolution_hz)- 判定:
- warning |
snr_max >= 20.0| threshold 20 | description "陀螺频谱峰值显著(三轴最大 SNR={snr_max:.1f},Z 轴峰频 {freq_z:.0f} Hz)" - info |
snr_max >= 12.0| threshold 12 | description "陀螺频谱存在峰值(SNR={snr_max:.1f},X/Y/Z 峰频 {freq_x:.0f}/{freq_y:.0f}/{freq_z:.0f} Hz)" - 产出:gyroFftSnrMax=snr_max, gyroFftPeakFreqHz=freq_z, tag=gyro_fft_peak
health(group: `health`)
px4-health-errors — 子系统健康错误
- 文件:
rules/health-report.yaml| 位置:grouphealth#1 - 文档:https://docs.px4.io/main/en/flying/pre_flight_checks.html
- 适用:总是适用
- 取值:
err_mask = bit_or_max(health_report.health_error_flags)warn_mask = bit_or_max(health_report.health_warning_flags)- 判定:
- critical |
err_mask > 0| threshold 0 | description "子系统健康错误位图 err_mask={err_mask}" - warning |
warn_mask > 0| threshold 0 | description "子系统健康警告位图 warn_mask={warn_mask}" - 产出:healthErrorMask=err_mask, healthWarningMask=warn_mask, tag=health_error_flags_set
px4-arming-check-errors — 解锁检查报错
- 文件:
rules/health-report.yaml| 位置:grouphealth#2 - 文档:https://docs.px4.io/main/en/flying/pre_flight_checks.html
- 适用:总是适用
- 取值:
arm_err = bit_or_max(health_report.arming_check_error_flags)arm_warn = bit_or_max(health_report.arming_check_warning_flags)- 判定:
- critical |
arm_err > 0| threshold 0 | description "解锁检查错误位图 arm_err={arm_err}" - warning |
arm_warn > 0| threshold 0 | description "解锁检查警告位图 arm_warn={arm_warn}" - 产出:armingCheckErrorMask=arm_err, armingCheckWarningMask=arm_warn, tag=arming_check_error
px4-armability — 全模式不可解锁
- 文件:
rules/health-report.yaml| 位置:grouphealth#3 - 文档:https://docs.px4.io/main/en/flying/pre_flight_checks.html
- 适用:总是适用
- 取值:
armable = max(health_report.can_arm_mode_flags)- 判定:
- critical |
armable == 0| threshold 0 | description "全程无可解锁模式(can_arm_mode_flags 恒 0)" - 产出:armableModeMaskMax=armable, tag=cannot_arm_any_mode
home_position(group: `home_position`)
px4-home-position — 返航点有效性
- 文件:
rules/home-position.yaml| 位置:grouphome_position#1 - 文档:https://docs.px4.io/main/en/flying/geofence.html
- 适用:总是适用
- 取值:
n_upd = max(home_position.update_count)n_frames = len(home_position.timestamp)hpos_bad = sum(home_position.valid_hpos == 0)alt_bad = sum(home_position.valid_alt == 0)- 判定:
- warning |
n_upd == 0| threshold 0 | description "返航点从未更新(update_count=0,共 {n_frames} 帧)" - info |
hpos_bad > 0| threshold 0 | description "返航点水平位置无效 {hpos_bad} 帧(高度轴无效 {alt_bad} 帧)" - 产出:homeUpdateCount=n_upd, homeInvalidHposFrames=hpos_bad, tag=home_position_invalid
imu_bias(group: `imu_bias`)
px4-imu-bias-drift — 陀螺零偏漂移
- 文件:
rules/imu-bias.yaml| 位置:groupimu_bias#1 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
bx, by, bz, bts, src_text = _try(gyro_bias_series( _ref("estimator_sensor_bias.gyro_bias"), _ref("estimator_sensor_bias.timestamp"), _ref("estimator_states.states"), _ref("estimator_states.timestamp"), _ref("estimator_status.states"), _ref("estimator_status.timestamp"), slot=10, sources=["estimator_sensor_bias.gyro_bias[]", "estimator_states.states[10..12]", "estimator_status.states[10..12]"]))worst_abs, worst_axis, worst_drift, drift_axis = gyro_bias_worst( bx, by, bz, bts, ARMED_INTERVALS, labels=["X", "Y", "Z"], min_count=10)temp_range = _try(max_temp_range(_ref("vehicle_imu_status.temperature_gyro"), _ref("vehicle_air_data.ambient_temperature")))bias_stat = _try(np.maximum(worst_abs, worst_drift))- 判定:
- critical |
worst_abs >= 0.05 or worst_drift >= 0.05| threshold 0.02 | unit rad/s | description "陀螺零偏异常(轴 {worst_axis}:绝对值 {worst_abs:.4f} rad/s,漂移 {worst_drift:.4f} rad/s)" | label=imu_bias_drift - warning |
worst_abs >= 0.02 or worst_drift >= 0.02| threshold 0.02 | unit rad/s | description "陀螺零偏异常(轴 {worst_axis}:绝对值 {worst_abs:.4f} rad/s,漂移 {worst_drift:.4f} rad/s)" | label=imu_bias_drift - guard |
temp_range >= 15| description "Data quality: temperature_change_large" | label=temperature_change_large - 产出:gyroBiasMaxRadS=worst_abs, gyroBiasDriftRadS=worst_drift, gyroBiasSource=src_text, imuTempRangeC=temp_range, tag=imu_bias_drift
land_detection(group: `land_detection`)
px4-land-detection — 落地与自由落体
- 文件:
rules/land-detection.yaml| 位置:groupland_detection#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
n_freefall = sum(vehicle_land_detected.freefall)n_landed = sum(vehicle_land_detected.landed)n_ground = sum(vehicle_land_detected.ground_contact)n_descend = sum(vehicle_land_detected.in_descend)- 判定:
- critical |
n_freefall > 0| threshold 0 | description "自由落体 {n_freefall} 帧(落地判定 {n_landed} 帧、接地 {n_ground} 帧)" - 产出:freefallFrames=n_freefall, groundContactFrames=n_ground, tag=freefall_detected
logged_messages(group: `logged_messages`)
px4-logged-messages — 日志错误与警告消息
- 文件:
rules/logged-messages.yaml| 位置:grouplogged_messages#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
msgs = get_logged_events()n_err = count_items(msgs, key="level_name", in_list=["EMERGENCY", "ALERT", "CRITICAL", "ERROR"])samples_err = take_items(msgs, key="level_name", in_list=["EMERGENCY", "ALERT", "CRITICAL", "ERROR"], limit=5, clip={"message": 200}, drop=["level", "level_name"])n_warn = count_items(msgs, key="level_name", eq="WARNING")samples_warn = take_items(msgs, key="level_name", eq="WARNING", limit=5, clip={"message": 200}, drop=["level", "level_name"])- 判定:
- critical |
n_err > 0| threshold 0 | unit 条 | description "日志中出现 {n_err} 条 ERROR 及以上消息" - warning |
n_warn > 0| threshold 0 | unit 条 | description "日志中出现 {n_warn} 条 WARNING 消息" - 产出:-
mission(group: `mission`)
px4-mission-failure — 任务执行失败
- 文件:
rules/mission-result.yaml| 位置:groupmission#1 - 文档:https://docs.px4.io/main/en/flight_modes_mission.html
- 适用:总是适用
- 取值:
n_fail = sum(mission_result.failure)- 判定:
- critical |
n_fail > 0| threshold 0 | description "任务报告无法继续/完成({n_fail} 帧)" - 产出:missionFailureFrames=n_fail, tag=mission_failure
px4-mission-incomplete — 任务未完成
- 文件:
rules/mission-result.yaml| 位置:groupmission#2 - 文档:https://docs.px4.io/main/en/flight_modes_mission.html
- 适用:总是适用
- 取值:
seq_total_max = max(mission_result.seq_total)n_fin = sum(mission_result.finished)seq_reached_max = max(mission_result.seq_reached)- 判定:
- warning |
seq_total_max > 0 and n_fin == 0| threshold 0 | description "任务 {seq_total_max} 项,最多到达第 {seq_reached_max} 项,未完成" - 产出:missionSeqTotal=seq_total_max, missionSeqReached=seq_reached_max, tag=mission_incomplete
px4-mission-invalid — 任务检查未通过
- 文件:
rules/mission-result.yaml| 位置:groupmission#3 - 文档:https://docs.px4.io/main/en/flight_modes_mission.html
- 适用:总是适用
- 取值:
seq_total_max = max(mission_result.seq_total)n_valid = sum(mission_result.valid)- 判定:
- warning |
seq_total_max > 0 and n_valid == 0| threshold 0 | description "任务 {seq_total_max} 项但全程无有效状态" - 产出:missionValidFrames=n_valid, tag=mission_invalid
mode_thrash(group: `mode_thrash`)
px4-mode-thrash — 飞行模式抖动
- 文件:
rules/mode-thrash.yaml| 位置:groupmode_thrash#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
n_changes = edges_count(vehicle_status.nav_state)- 判定:
- warning |
n_changes > 12| threshold 12 | unit 次 | description "飞行模式切换 {n_changes} 次(>12),可能存在模式抖动" - 产出:navStateChanges=n_changes
motor_balance(group: `motor_balance`)
apm-motor-imbalance — 电机输出不平衡
- 文件:
rules/motors.yaml| 位置:groupmotor_balance#1 - 文档:https://ardupilot.org/copter/docs/thrust_loss_yaw_imbalance.html
- 适用:总是适用
- 取值:
cols = [RCOU.C1, RCOU.C2, RCOU.C3, RCOU.C4, RCOU.C5, RCOU.C6, RCOU.C7, RCOU.C8]spread, hot, cold, n_active = column_spread_stats(cols, None, min_mean=1100.0, min_channels=2)hot_ch = hot + 1cold_ch = cold + 1- 判定:
- critical |
spread > 300.0| threshold 300 | unit us | description "电机输出严重不平衡,极差 {spread:.0f} us({n_active} 个活跃通道)" - warning |
spread > 150.0| threshold 150 | unit us | description "电机输出不平衡,极差 {spread:.0f} us({n_active} 个活跃通道)" - 产出:tag=apm_motor_output_unbalance
px4-motor-unbalance — 电机输出不平衡
- 文件:
rules/motor-balance.yaml| 位置:groupmotor_balance#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
mts = actuator_motors.timestampcols = actuator_motors.controlseg = active_window_mask(mts, ARMED_INTERVALS, vehicle_status.nav_state, vehicle_status.timestamp, codes=[2, 4, 6, 14, 21], min_active=20)spread, busiest, idlest, n_active = column_spread_stats( cols, seg, min_mean=0.01, min_channels=4)- 判定:
- critical |
spread >= 0.15| threshold 0.15 | description "电机输出不平衡(悬停段通道 {busiest} 与 {idlest} 差 {spread:.3f})" | label=motor_output_unbalance - warning |
spread >= 0.08| threshold 0.08 | description "电机输出差异偏大(通道 {busiest} 与 {idlest} 差 {spread:.3f})" | label=motor_output_unbalance - 产出:motorControlSpread=spread, motorCountActive=n_active, tag=motor_output_unbalance
apm-motor-saturation — 电机输出饱和
- 文件:
rules/motors.yaml| 位置:groupmotor_balance#2 - 文档:https://ardupilot.org/copter/docs/thrust_loss_yaw_imbalance.html
- 适用:总是适用
- 取值:
cols = [RCOU.C1, RCOU.C2, RCOU.C3, RCOU.C4, RCOU.C5, RCOU.C6, RCOU.C7, RCOU.C8]sats = column_ratio_events(cols, 1950.0, min_frac=0.20, min_mean=1100.0)- 判定:
- critical |
frac > 0.50| threshold 0.5 | unit % | description "电机 {channel} 号通道长时间满舵(均值 {mean:.0f} us)" - warning |
True| threshold 0.2 | unit % | description "电机 {channel} 号通道接近满舵(均值 {mean:.0f} us)" - 产出:tag=apm_motor_output_saturated
px4-actuator-saturation — 电机输出饱和
- 文件:
rules/actuator-saturation.yaml| 位置:groupmotor_balance#2 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
mts = actuator_motors.timestampseg = interval_mask(mts, ARMED_INTERVALS)sats = column_ratio_events(actuator_motors.control, 0.98, mask=seg, min_frac=0.10, min_mean=0.01)- 判定:
- critical |
frac > 0.30| threshold 0.3 | unit % | description "电机 {channel} 号通道长时间满推力(均值 {mean:.2f})" - warning |
True| threshold 0.1 | unit % | description "电机 {channel} 号通道推力经常贴顶(均值 {mean:.2f})" - 产出:tag=motor_output_saturated
px4-servo-saturation — 舵机输出饱和
- 文件:
rules/actuator-saturation.yaml| 位置:groupmotor_balance#3 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
sts = actuator_servos.timestampseg = interval_mask(sts, ARMED_INTERVALS)sats = column_ratio_events(actuator_servos.control, 0.98, mask=seg, min_frac=0.10, min_mean=0.01)- 判定:
- critical |
frac > 0.30| threshold 0.3 | unit % | description "舵机 {channel} 号通道长时间贴顶(均值 {mean:.2f})" - warning |
True| threshold 0.1 | unit % | description "舵机 {channel} 号通道输出经常贴顶(均值 {mean:.2f})" - 产出:tag=servo_output_saturated
param_audit(group: `param_audit`)
apm-param-audit-rate-p — Rate P 增益异常
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#1 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
rp_r = _cfg("ATC_RAT_RLL_P", 0.0)rp_p = _cfg("ATC_RAT_PIT_P", 0.0)rp_y = _cfg("ATC_RAT_YAW_P", 0.0)low_count = int(rp_r < 0.04) + int(rp_p < 0.04) + int(rp_y < 0.04)high_count = int(rp_r > 0.5) + int(rp_p > 0.5) + int(rp_y > 0.5)- 判定:
- critical |
low_count > 0| threshold 0 | unit 轴 | description "{low_count} 个轴的 Rate P 增益低于 0.04(R:{rp_r:.3f} P:{rp_p:.3f} Y:{rp_y:.3f}),可能不可控" - warning |
high_count > 0| threshold 0 | unit 轴 | description "{high_count} 个轴的 Rate P 增益高于 0.5(R:{rp_r:.3f} P:{rp_p:.3f} Y:{rp_y:.3f}),可能振荡" - 产出:tag=apm_param_rate_p_anomaly
apm-param-audit-accel-max — 角加速度限制被禁用
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#2 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
acc_r = _cfg("ATC_ACCEL_R_MAX", 110000.0)acc_p = _cfg("ATC_ACCEL_P_MAX", 110000.0)acc_y = _cfg("ATC_ACCEL_Y_MAX", 27000.0)zero_count = int(acc_r == 0) + int(acc_p == 0) + int(acc_y == 0)- 判定:
- critical |
zero_count > 0| threshold 0 | unit 轴 | description "{zero_count} 个轴的角加速度限制被置零(R:{acc_r:.0f} P:{acc_p:.0f} Y:{acc_y:.0f}),无上限" - 产出:tag=apm_param_accel_limit_disabled
apm-param-audit-batt-crt — 电池失效保护阈值倒挂
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#3 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
batt_crt = _cfg("BATT_CRT_VOLT", 0.0)batt_low = _cfg("BATT_LOW_VOLT", 0.0)- 判定:
- warning |
batt_crt >= batt_low and batt_low > 0.0| threshold CRT<LOW | unit V | description "电池失效保护阈值倒挂(CRT:{batt_crt:.1f}V >= LOW:{batt_low:.1f}V)" - 产出:tag=apm_param_batt_crt_inverted
apm-param-audit-spin-arm — MOT_SPIN_ARM 高于 MOT_SPIN_MIN
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#4 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
spin_arm = _cfg("MOT_SPIN_ARM", 0.0)spin_min = _cfg("MOT_SPIN_MIN", 0.0)- 判定:
- warning |
spin_arm > spin_min and spin_min > 0.0| threshold ARM<=MIN | description "MOT_SPIN_ARM ({spin_arm:.4f}) 高于 MOT_SPIN_MIN ({spin_min:.4f}),推力控制反转" - 产出:tag=apm_param_spin_arm_gt_min
apm-param-audit-pwm-inverted — MOT_PWM 区间异常
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#5 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
pwm_min = _cfg("MOT_PWM_MIN", 0)pwm_max = _cfg("MOT_PWM_MAX", 0)- 判定:
- critical |
pwm_min >= pwm_max and not (pwm_min == 0 and pwm_max == 0)| threshold MIN<MAX | unit us | description "MOT_PWM 区间异常(MIN:{pwm_min} >= MAX:{pwm_max})" - 产出:tag=apm_param_pwm_inverted
apm-param-audit-fence-empty — 围栏启用但无边界
- 文件:
rules/param_audit.yaml| 位置:groupparam_audit#6 - 文档:https://ardupilot.org/copter/docs/parameters.html
- 适用:总是适用
- 取值:
fence_enable = _cfg("FENCE_ENABLE", 0)fence_alt = _cfg("FENCE_ALT_MAX", 0.0)fence_radius = _cfg("FENCE_RADIUS", 0.0)- 判定:
- warning |
fence_enable == 1 and fence_alt <= 0.0 and fence_radius <= 0.0| threshold 非空边界 | description "围栏已启用但没有高度或半径边界" - 产出:tag=apm_param_fence_empty
position(group: `position`)
px4-gpos-dead-reckoning — 位置惯性推算
- 文件:
rules/global-position.yaml| 位置:groupposition#1 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
m = interval_mask(vehicle_global_position.timestamp, ARMED_INTERVALS)dr_armed = apply_mask(vehicle_global_position.dead_reckoning, m)dr_frac = count_above(dr_armed, gt=0.0) / len(dr_armed) if len(dr_armed) > 0 else 0- 判定:
- warning |
dr_frac >= 0.05| threshold 0.05 | description "armed 段 {dr_frac:.0%} 时间处于惯性推算" - 产出:deadReckoningFrac=dr_frac, tag=dead_reckoning_used
px4-gpos-reset — EKF 位置重置
- 文件:
rules/global-position.yaml| 位置:groupposition#2 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
n_h = int(max(vehicle_global_position.lat_lon_reset_counter) - min(vehicle_global_position.lat_lon_reset_counter))n_v = int(max(vehicle_global_position.alt_reset_counter) - min(vehicle_global_position.alt_reset_counter))n_reset = n_h + n_v- 判定:
- warning |
n_reset > 0| threshold 0 | description "EKF 位置/高度重置 {n_reset} 次(水平 {n_h} / 高度 {n_v})" - 产出:posResetCount=n_reset, posResetHorizontal=n_h, posResetVertical=n_v, tag=ekf_position_reset
px4-gpos-never-valid — 位置估计从未有效
- 文件:
rules/global-position.yaml| 位置:groupposition#3 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_the_ecl_ekf.html
- 适用:总是适用
- 取值:
latlon_ok = max(vehicle_global_position.lat_lon_valid)alt_ok = max(vehicle_global_position.alt_valid)- 判定:
- critical |
latlon_ok == 0| threshold 0 | description "armed 段水平位置估计从未有效" - critical |
alt_ok == 0| threshold 0 | description "armed 段高度估计从未有效" - 产出:latLonEverValid=latlon_ok, altEverValid=alt_ok, tag=position_never_valid
power_supply(group: `power_supply`)
px4-power-supply — 供电健康
- 文件:
rules/power-supply.yaml| 位置:grouppower_supply#1 - 文档:https://docs.px4.io/main/en/config/battery.html
- 适用:总是适用
- 取值:
n_oc = sum(system_power.periph_5v_oc) + sum(system_power.hipower_5v_oc)brick_bad = sum(system_power.brick_valid == 0)servo_bad = sum(system_power.servo_valid == 0)v5_min = min(system_power.voltage5v_v[system_power.voltage5v_v > 0])n_bad = n_oc + brick_bad + servo_bad- 判定:
- critical |
brick_bad > 0 or servo_bad > 0| threshold 0 | description "供电轨失效(brick={brick_bad} 帧,servo={servo_bad} 帧)" - warning |
n_oc > 0| threshold 0 | description "5V 过流 {n_oc} 帧(5V 最低 {v5_min:.2f} V)" - 产出:power5vOcFrames=n_oc, powerBrickInvalidFrames=brick_bad, power5vMinV=v5_min, tag=power_5v_fault
prearm_messages(group: `prearm_messages`)
apm-prearm-warnings — 预解锁/启动消息扫描
- 文件:
rules/prearm.yaml| 位置:groupprearm_messages#1 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
msg_lines = _try(MSG.Message) or []statustext_lines = _try(STATUSTEXT.Text) or []n_prearm = count_items(msg_lines, contains="prearm")n_arm = count_items(msg_lines, contains="arm:")n_not_calibrated = count_items(msg_lines, contains="not calibrated")n_unhealthy = count_items(msg_lines, contains="unhealthy")n_inconsistent = count_items(msg_lines, contains="inconsistent")n_error = count_items(msg_lines, contains="error")n_failed = count_items(msg_lines, contains="failed")n_bad = count_items(msg_lines, contains="bad ")n_denied = count_items(msg_lines, contains="denied")n_st_prearm = count_items(statustext_lines, contains="prearm")n_st_error = count_items(statustext_lines, contains="error")n_st_failed = count_items(statustext_lines, contains="failed")n_st_denied = count_items(statustext_lines, contains="denied")total_warn = n_prearm + n_arm + n_not_calibrated + n_unhealthy + n_inconsistent + n_error + n_failed + n_bad + n_denied + n_st_prearm + n_st_error + n_st_failed + n_st_deniedsamples = take_items(msg_lines, contains="prearm", limit=6, clip={"text": 120})- 判定:
- critical |
total_warn >= 2| threshold 1 | unit 条 | description "启动阶段 {total_warn} 条预解锁/错误消息" - warning |
total_warn > 0| threshold 0 | unit 条 | description "启动阶段 {total_warn} 条预解锁/错误消息" - 产出:tag=apm_prearm_warnings
range_finder(group: `range_finder`)
px4-range-signal-quality — 测距信号质量差
- 文件:
rules/distance-sensor.yaml| 位置:grouprange_finder#1 - 文档:https://docs.px4.io/main/en/computer_vision/object_avoidance.html
- 适用:总是适用
- 取值:
q_mean, q_p95, q_max, q_idx = worst_mean_stats(distance_sensor[:].signal_quality, min_mean=0)- 判定:
- warning |
q_mean < 60| threshold 60 | description "测距传感器 {q_idx} 平均信号质量仅 {q_mean:.0f}/100" - 产出:rangeSignalQualityMean=q_mean, rangeSignalQualityIdx=q_idx, tag=range_signal_quality
px4-range-invalid — 测距无效读数偏多
- 文件:
rules/distance-sensor.yaml| 位置:grouprange_finder#2 - 文档:https://docs.px4.io/main/en/computer_vision/object_avoidance.html
- 适用:总是适用
- 取值:
frac0 = ratio_equal(distance_sensor.current_distance, value=0.0)- 判定:
- warning |
frac0 >= 0.30| threshold 0.3 | description "armed 段无效测距读数占比 {frac0:.0%}" - 产出:rangeInvalidFrac=frac0, tag=range_invalid_reads
px4-range-jump — 测距读数跳变
- 文件:
rules/distance-sensor.yaml| 位置:grouprange_finder#3 - 文档:https://docs.px4.io/main/en/computer_vision/object_avoidance.html
- 适用:总是适用
- 取值:
d_valid = keep_gt(distance_sensor.current_distance, gt=0.0)n_jump = count_above(abs(diff(d_valid)), gt=1.0)- 判定:
- warning |
n_jump >= 10| threshold 10 | description "armed 段测距跳变(>1 m){n_jump} 次" - 产出:rangeJumpCount=n_jump, tag=range_distance_jump
rate_tracking(group: `rate_tracking`)
px4-rate-tracking-rms — 角速率跟踪误差(RMS)
- 文件:
rules/rate-tracking.yaml| 位置:grouprate_tracking#1 - 文档:https://docs.px4.io/main/en/config_mc/rate_tuning.html
- 适用:总是适用
- 取值:
act = stack_columns( vehicle_angular_velocity.xyz[0] * 57.29578, vehicle_angular_velocity.xyz[1] * 57.29578, vehicle_angular_velocity.xyz[2] * 57.29578)sp = stack_columns( vehicle_rates_setpoint.roll * 57.29578, vehicle_rates_setpoint.pitch * 57.29578, vehicle_rates_setpoint.yaw * 57.29578)rms, p95, axis_i, seg_n = rate_tracking_stats( act, vehicle_angular_velocity.timestamp, sp, vehicle_rates_setpoint.timestamp, ARMED_INTERVALS, min_samples=50)seg_ok = seg_n > 50 if seg_n else Falserms_stat = rms if seg_ok else Noneaxis_name = ["Roll", "Pitch", "Yaw"][axis_i] if (seg_ok and axis_i is not None) else None- 判定:
- warning |
rms_stat >= 30.0| threshold 30 | description "armed 段角速率跟踪误差 RMS {rms_stat:.1f} deg/s(最差轴 {axis_name})" | label=rate_tracking_error - 产出:rateErrRmsDeg=rms_stat, rateErrWorstAxis=axis_name, tag=rate_tracking_error
px4-rate-tracking-p95 — 角速率跟踪误差(P95 峰值)
- 文件:
rules/rate-tracking.yaml| 位置:grouprate_tracking#2 - 文档:https://docs.px4.io/main/en/config_mc/rate_tuning.html
- 适用:总是适用
- 取值:
act = stack_columns( vehicle_angular_velocity.xyz[0] * 57.29578, vehicle_angular_velocity.xyz[1] * 57.29578, vehicle_angular_velocity.xyz[2] * 57.29578)sp = stack_columns( vehicle_rates_setpoint.roll * 57.29578, vehicle_rates_setpoint.pitch * 57.29578, vehicle_rates_setpoint.yaw * 57.29578)rms, p95, axis_i, seg_n = rate_tracking_stats( act, vehicle_angular_velocity.timestamp, sp, vehicle_rates_setpoint.timestamp, ARMED_INTERVALS, min_samples=50)seg_ok = seg_n > 50 if seg_n else Falsep95_stat = p95 if seg_ok else Noneaxis_name = ["Roll", "Pitch", "Yaw"][axis_i] if (seg_ok and axis_i is not None) else None- 判定:
- warning |
p95_stat >= 60.0| threshold 60 | description "armed 段角速率跟踪误差 P95 {p95_stat:.1f} deg/s(最差轴 {axis_name})" | label=rate_tracking_error - 产出:rateErrP95Deg=p95_stat, rateErrWorstAxis=axis_name, tag=rate_tracking_error
rc_input(group: `rc_input`)
apm-rcin-link-loss — 遥控输入链路
- 文件:
rules/rcin.yaml| 位置:grouprc_input#1 - 文档:https://ardupilot.org/copter/docs/radio-failsafe.html
- 适用:总是适用
- 取值:
low1 = -RCIN.C1 > -1000low2 = -RCIN.C2 > -1000low3 = -RCIN.C3 > -1000low4 = -RCIN.C4 > -1000all_low = low1 & low2 & low3 & low4lost_samples = sum(all_low)ts = RCIN.timestampruns = excursion_events(all_low, ts, T0_US, min_duration_s=1.0)- 判定:
- critical |
duration_s >= 2.0 or end_s >= DURATION_S - 1.0| threshold 1000 | unit us | description "四个主通道持续低于 1000us,持续 {duration_s:.1f}s(t={start_s:.1f}s 起)" - warning |
True| threshold 1000 | unit us | description "四个主通道同时低于 1000us,持续 {duration_s:.1f}s(t={start_s:.1f}s 起,共 {lost_samples} 个样本)" - 产出:tag=apm_rc_link_loss
rc_link(group: `rc_link`)
px4-rc-link — 遥控链路质量
- 文件:
rules/rc-link.yaml| 位置:grouprc_link#1 - 文档:https://docs.px4.io/main/en/config/radio.html
- 适用:总是适用
- 取值:
lost = max(input_rc.rc_lost)fs = max(input_rc.rc_failsafe)n_drop = max(input_rc.rc_lost_frame_count)n_total = max(input_rc.rc_total_frame_count)rssi_series = input_rc.rssirssi_min = _try(min(rssi_series[rssi_series > 0]))- 判定:
- critical |
fs > 0| threshold 0 | description "遥控触发失效保护(丢帧累计 {n_drop},总帧 {n_total})" - warning |
lost > 0| threshold 0 | description "遥控信号丢失(丢帧累计 {n_drop},总帧 {n_total})" - info |
rssi_min < 40.0| threshold 40 | description "遥控信号强度偏低(RSSI 最低 {rssi_min:.0f})" - 产出:rcRssiMin=rssi_min, rcLostFrames=n_drop, tag=rc_link_degraded
sensor_health(group: `sensor_health`)
apm-sensor-rangefinder — 测距仪配置但无数据
- 文件:
rules/sensors.yaml| 位置:groupsensor_health#1 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
rng_type = _cfg("RNGFND_TYPE", 0.0)rng1_type = _cfg("RNGFND1_TYPE", 0.0)- 判定:
- warning |
(rng_type > 0 or rng1_type > 0) and not has_topic('RFND') and not has_topic('RNGFND')| threshold 0 | description "测距仪已配置但日志无数据" - 产出:tag=apm_sensor_configured_but_silent
apm-sensor-gps — GPS 配置但无数据
- 文件:
rules/sensors.yaml| 位置:groupsensor_health#2 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
gps_type = _cfg("GPS_TYPE", 0.0)- 判定:
- warning |
gps_type > 0 and not has_topic('GPS')| threshold 0 | description "GPS 已配置但日志无数据" - 产出:tag=apm_sensor_configured_but_silent
apm-sensor-compass-health — 罗盘健康标志
- 文件:
rules/sensors.yaml| 位置:groupsensor_health#3 - 文档:https://ardupilot.org/copter/docs/common-prearm-safety-checks.html
- 适用:总是适用
- 取值:
unhealthy_ratio = np.mean(MAG.Health == 0.0)- 判定:
- warning |
unhealthy_ratio > 0.20| threshold 0.2 | description "罗盘不健康样本占比 {unhealthy_ratio:.0%}" - 产出:tag=apm_compass_unhealthy
tecs(group: `tecs`)
px4-tecs-underspeed — 空速不足
- 文件:
rules/tecs.yaml| 位置:grouptecs#1 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_guide_fixedwing.html
- 适用:总是适用
- 取值:
us = tecs_status.underspeed_ratious_max = max(us)us_p95 = np.percentile(us, 95)- 判定:
- critical |
us_max >= 1.0| threshold 1 | description "armed 段 underspeed_ratio 达到 {us_max:.2f}(失速裕度耗尽)" - warning |
us_p95 >= 0.7| threshold 0.7 | description "armed 段 underspeed_ratio p95={us_p95:.2f}" - 产出:tecsUnderspeedMax=us_max, tecsUnderspeedP95=us_p95, tag=tecs_underspeed
px4-tecs-height-rate-track — 高度速率跟踪差
- 文件:
rules/tecs.yaml| 位置:grouptecs#2 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_guide_fixedwing.html
- 适用:总是适用
- 取值:
herr = abs(tecs_status.height_rate - tecs_status.height_rate_setpoint)herr_p95 = np.percentile(herr, 95)- 判定:
- warning |
herr_p95 >= 3.0| threshold 3 | unit m/s | description "armed 段高度速率跟踪误差 p95={herr_p95:.1f} m/s(VTOL 的 MC 段也计入)" - 产出:tecsHeightRateErrP95=herr_p95, tag=tecs_height_rate_error
px4-tecs-airspeed-track — 空速跟踪差
- 文件:
rules/tecs.yaml| 位置:grouptecs#3 - 文档:https://docs.px4.io/main/en/advanced_config/tuning_guide_fixedwing.html
- 适用:总是适用
- 取值:
asp = tecs_status.true_airspeed_spaerr = abs(tecs_status.true_airspeed_filtered - asp)aerr_act = aerr[asp > 0.0]aerr_p95 = np.percentile(aerr_act, 95) if len(aerr_act) > 50 else 0- 判定:
- warning |
aerr_p95 >= 5.0| threshold 5 | unit m/s | description "armed 段空速跟踪误差 p95={aerr_p95:.1f} m/s" - 产出:tecsAirspeedErrP95=aerr_p95, tag=tecs_airspeed_error
timing(group: `timing`)
apm-timing-gaps — 日志间隙
- 文件:
rules/timing.yaml| 位置:grouptiming#1 - 文档:https://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html
- 适用:总是适用
- 取值:
gts = _ref("IMU.timestamp", "ATT.timestamp", "VIBE.timestamp")gaps = gap_events(gts, T0_US)- 判定:
- warning |
True| threshold 0.5 | unit s | description "日志间隙 {gap_s:.2f} s(t={start_s:.2f}s 起,{end_s:.2f}s 恢复)" - 产出:tag=apm_logging_gap
apm-timing-long-loops — 调度长循环
- 文件:
rules/timing.yaml| 位置:grouptiming#2 - 文档:https://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html
- 适用:总是适用
- 取值:
long_loops = sum(PM.NLon)- 判定:
- warning |
long_loops > 0| threshold 0 | unit 次 | description "调度记录到 {long_loops:.0f} 次长循环" - 产出:tag=apm_scheduler_long_loops
vehicle_profile(group: `vehicle_profile`)
apm-vehicle-profile-hover — 悬停油门 / 动力余量
- 文件:
rules/vehicle-profile.yaml| 位置:groupvehicle_profile#1 - 文档:https://ardupilot.org/copter/docs/common-tuning.html
- 适用:总是适用
- 取值:
hover_l = _cfg("MOT_THST_HOVER")hover_l_ok = hover_l is not None and hover_l > 0.0 and hover_l <= 1.0tho = CTUN.ThOfly = tho[(tho > 0.1) & (tho < 0.95)]n_fly = len(fly)hover_e = value_if(n_fly > 20, median(fly))hover = coalesce(value_if(hover_l_ok, hover_l), hover_e)margin = sub(100.0, scale(hover, factor=100.0))t2w = div(1.0, hover)hover_src = choose(hover_l_ok, "MOT_THST_HOVER", "CTUN.ThO 中位数估计")- 判定:
- warning |
hover is not None and hover >= 0.62| threshold 0.62 | description "悬停油门 {hover:.0%}({hover_src})≥62%,动力余量仅 {margin:.0f}%,推重比 ≈{t2w:.1f}" - info |
hover is not None and hover <= 0.30| threshold 0.3 | description "悬停油门 {hover:.0%}({hover_src})≤30%,推重比 ≈{t2w:.1f},动力过剩" - 产出:hoverThrottle=hover, powerMarginPct=margin, thrustToWeight=t2w, tag=apm_vehicle_power_margin
vibration(group: `vibration`)
apm-vibration-x — X 轴振动
- 文件:
rules/vibration.yaml| 位置:groupvibration#1 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
vx = VIBE.VibeXvx_max = max(vx)frac_warn = np.sum(vx > 30.0) / len(vx)frac_crit = np.sum(vx > 60.0) / len(vx)- 判定:
- critical |
vx_max > 60.0 or frac_crit > 0.0| threshold 60 | unit m/s^2 | description "X 轴振动严重超标,峰值 {vx_max:.0f} m/s^2" - warning |
frac_warn >= 0.10| threshold 30 | unit m/s^2 | description "X 轴振动持续偏大,峰值 {vx_max:.0f} m/s^2" - info |
vx_max > 30.0| threshold 30 | unit m/s^2 | description "X 轴振动偶有冒尖,峰值 {vx_max:.0f} m/s^2" - 产出:tag=apm_high_vibration
px4-vibration — 高频振动
- 文件:
rules/vibration.yaml| 位置:groupvibration#1 - 文档:https://docs.px4.io/main/en/assembly/vibration_isolation.html
- 适用:总是适用
- 取值:
vibe_mean, vibe_p95, vibe_max, imu_idx = worst_mean_stats( vehicle_imu_status[:].accel_vibration_metric, min_mean=0)- 判定:
- critical |
vibe_mean >= 9.81| threshold 9.81 | unit m/s^2 | description "高频振动严重超标(IMU #{imu_idx})" - warning |
vibe_mean >= 4.905| threshold 4.905 | unit m/s^2 | description "高频振动偏大(IMU #{imu_idx})" - 产出:imuAccelVibrationMean=vibe_mean, imuAccelVibrationP95=vibe_p95, imuAccelVibrationMax=vibe_max, tag=high_vibration
apm-vibration-y — Y 轴振动
- 文件:
rules/vibration.yaml| 位置:groupvibration#2 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
vy = VIBE.VibeYvy_max = max(vy)frac_warn = np.sum(vy > 30.0) / len(vy)frac_crit = np.sum(vy > 60.0) / len(vy)- 判定:
- critical |
vy_max > 60.0 or frac_crit > 0.0| threshold 60 | unit m/s^2 | description "Y 轴振动严重超标,峰值 {vy_max:.0f} m/s^2" - warning |
frac_warn >= 0.10| threshold 30 | unit m/s^2 | description "Y 轴振动持续偏大,峰值 {vy_max:.0f} m/s^2" - info |
vy_max > 30.0| threshold 30 | unit m/s^2 | description "Y 轴振动偶有冒尖,峰值 {vy_max:.0f} m/s^2" - 产出:tag=apm_high_vibration
apm-vibration-z — Z 轴振动
- 文件:
rules/vibration.yaml| 位置:groupvibration#3 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
vz = VIBE.VibeZvz_max = max(vz)frac_warn = np.sum(vz > 30.0) / len(vz)frac_crit = np.sum(vz > 60.0) / len(vz)- 判定:
- critical |
vz_max > 60.0 or frac_crit > 0.0| threshold 60 | unit m/s^2 | description "Z 轴振动严重超标,峰值 {vz_max:.0f} m/s^2" - warning |
frac_warn >= 0.10| threshold 30 | unit m/s^2 | description "Z 轴振动持续偏大,峰值 {vz_max:.0f} m/s^2" - info |
vz_max > 30.0| threshold 30 | unit m/s^2 | description "Z 轴振动偶有冒尖,峰值 {vz_max:.0f} m/s^2" - 产出:tag=apm_high_vibration
px4-imu-clipping — 加速度计削波
- 文件:
rules/imu-clipping.yaml| 位置:groupvibration#3 - 文档:https://docs.px4.io/main/en/assembly/vibration_isolation.html
- 适用:总是适用
- 取值:
clip, clip_idx, clip_axis = worst_column_delta( _ref("vehicle_imu_status[:].accel_clipping", alias="clipping"))clip_stat = clip if clip > 0 else None- 判定:
- critical |
clip >= 1000| threshold 1000 | unit count | description "加速度计削波严重:IMU #{clip_idx} 轴 {clip_axis} 全日志累计削波 {clip} 次(理想值为 0)" - warning |
clip >= 100| threshold 100 | unit count | description "检测到明显加速度计削波:IMU #{clip_idx} 轴 {clip_axis} 全日志累计削波 {clip} 次(理想值为 0)" - info |
clip > 0| threshold 0 | unit count | description "偶发加速度计削波:IMU #{clip_idx} 轴 {clip_axis} 全日志累计削波 {clip} 次(理想值为 0)" - 产出:imuAccelClippingCountMax=clip_stat, tag=high_vibration
apm-clip-0 — 加速度计削波(IMU0)
- 文件:
rules/vibration.yaml| 位置:groupvibration#4 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
clip0_total = np.ptp(VIBE.Clip0)- 判定:
- critical |
clip0_total >= 100.0| threshold 100 | unit 次 | description "IMU0 削波 {clip0_total:.0f} 次" - warning |
clip0_total > 0.0| threshold 0 | unit 次 | description "IMU0 削波 {clip0_total:.0f} 次" - 产出:tag=apm_accel_clipping
px4-gyro-vibration — 陀螺高频振动
- 文件:
rules/gyro-vibration.yaml| 位置:groupvibration#4 - 文档:https://docs.px4.io/main/en/assembly/vibration_isolation.html
- 适用:总是适用
- 取值:
gyro_vib_mean, gyro_vib_p95, gyro_vib_max, gyro_idx = _try(worst_mean_stats( vehicle_imu_status[:].gyro_vibration_metric, min_mean=0))- 判定:
- critical |
gyro_vib_mean >= 0.5| threshold 0.5 | unit rad/s | description "陀螺高频振动严重超标(IMU #{gyro_idx})" - warning |
gyro_vib_mean >= 0.2| threshold 0.2 | unit rad/s | description "陀螺高频振动偏大(IMU #{gyro_idx})" - 产出:imuGyroVibrationMean=gyro_vib_mean, imuGyroVibrationP95=gyro_vib_p95, imuGyroVibrationMax=gyro_vib_max, tag=gyro_vibration
apm-clip-1 — 加速度计削波(IMU1)
- 文件:
rules/vibration.yaml| 位置:groupvibration#5 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
clip1_total = np.ptp(VIBE.Clip1)- 判定:
- critical |
clip1_total >= 100.0| threshold 100 | unit 次 | description "IMU1 削波 {clip1_total:.0f} 次" - warning |
clip1_total > 0.0| threshold 0 | unit 次 | description "IMU1 削波 {clip1_total:.0f} 次" - 产出:tag=apm_accel_clipping
apm-clip-2 — 加速度计削波(IMU2)
- 文件:
rules/vibration.yaml| 位置:groupvibration#6 - 文档:https://ardupilot.org/copter/docs/common-measuring-vibration.html
- 适用:总是适用
- 取值:
clip2_total = np.ptp(VIBE.Clip2)- 判定:
- critical |
clip2_total >= 100.0| threshold 100 | unit 次 | description "IMU2 削波 {clip2_total:.0f} 次" - warning |
clip2_total > 0.0| threshold 0 | unit 次 | description "IMU2 削波 {clip2_total:.0f} 次" - 产出:tag=apm_accel_clipping
vtol_transition(group: `vtol_transition`)
px4-vtol-transition-attitude — VTOL 转换姿态越限
- 文件:
rules/vtol-transition.yaml| 位置:groupvtol_transition#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
trans_n = _try(np.sum(vtol_vehicle_status.vtol_in_trans_mode > 0))trans_mask = _try(fill_to(vtol_vehicle_status.vtol_in_trans_mode, vtol_vehicle_status.timestamp, vehicle_attitude.timestamp))roll, pitch, yaw = _try(quat_to_euler(vehicle_attitude.q))tilt_max = _try(masked_absmax(np.maximum(abs(roll), abs(pitch)), trans_mask))trans_cnt = _try(sum(trans_mask))enough = _try(trans_cnt > 5)has_tilt = tilt_max is not Nonetilt_stat = _try(tilt_max if enough else None)- 判定:
- warning |
has_tilt and enough and tilt_max > 8.0| threshold 8 | unit ° | description "VTOL 转换阶段姿态越限(最大 {tilt_max:.1f}°,限值 8°)" | label=vtol_convert_attitude_over - 产出:vtolTransitionSamples=trans_n, vtolTransitionMaxTiltDeg=tilt_stat, tag=vtol_convert_attitude_over
wind_estimate(group: `wind_estimate`)
px4-wind-estimate — 风扰估计
- 文件:
rules/wind-estimate.yaml| 位置:groupwind_estimate#1 - 文档:https://docs.px4.io/main/en/log/flight_log_analysis.html
- 适用:总是适用
- 取值:
w_p95 = percentile( np.hypot(coalesce(_ref("estimator_wind.windspeed_north"), _ref("wind_estimate.windspeed_north")), coalesce(_ref("estimator_wind.windspeed_east"), _ref("wind_estimate.windspeed_east"))), p=95)- 判定:
- warning |
w_p95 >= 12.0| threshold 8 | unit m/s | description "估计风速较大(p95 {w_p95:.1f} m/s)" | label=wind_disturb - info |
w_p95 >= 8.0| threshold 8 | unit m/s | description "估计风速偏大(p95 {w_p95:.1f} m/s)" | label=wind_disturb - guard |
w_p95 >= 8.0| description "Data quality: wind_strong" | label=wind_strong - 产出:windSpeedP95M=w_p95, tag=wind_disturb