mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
* feat(failure_injection): integrate failure injection support across sensor drivers * feat(failure_injection): enhance failure injection with RC switch support and instance bitmasking feat(failure_injection): add disabled failure injection manager and system command support for v5x and v6x boards * feat(failure_injection): add battery failure injection Add a value-mutating apply-site for FAILURE_UNIT_SYSTEM_BATTERY. On an injected OFF the outgoing battery_status is reported as a depleted pack (zero remaining, emergency warning) so the low-battery failsafe triggers. The apply-site lives in the shared Battery library, covering the analog ADC, INA power monitors, ESC battery and SITL in one place, plus the UAVCAN battery driver which publishes battery_status directly. The previous SITL-only hack in BatterySimulator is removed in favour of this shared path so simulation and hardware behave identically. * fix(failure_injection): change parameter types from int32 to enum * refactor(failure_injection): disable failure injection manager and system commands across multiple boards * feat(failure_injection): enhance failure injection with timestamp handling and message-less support * refactor(failure_injection): simplify has_timestamp_sample implementation and remove unused includes * refactor(failure_injection):move conditional compilation into helper libary * refactor(failure_injection): update CMakeLists to include failure_injection dependency across multiple drivers --------- Co-authored-by: Claudio Chies <chiesc@chies.com>
47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
#Failure injection configuration.
|
|
#
|
|
# Currently active failure-injection configuration, published by the failure
|
|
# injection manager (the sole subscriber to vehicle_command INJECT_FAILURE).
|
|
# Republished only when the configuration changes, so command spam on
|
|
# vehicle_command cannot propagate to the consumers applying the failures.
|
|
|
|
uint64 timestamp # [us] Time since system start
|
|
|
|
uint8 MAX_FAILURES = 4 # maximum number of simultaneous failures
|
|
|
|
uint8 count # number of valid entries in the arrays below
|
|
|
|
uint8[4] unit # [@enum FAILURE_UNIT] Affected component per entry
|
|
# Failure unit (affected component). Mirrors MAVLink FAILURE_UNIT and the
|
|
# FAILURE_UNIT_* values in vehicle_command.
|
|
uint8 FAILURE_UNIT_SENSOR_GYRO = 0
|
|
uint8 FAILURE_UNIT_SENSOR_ACCEL = 1
|
|
uint8 FAILURE_UNIT_SENSOR_MAG = 2
|
|
uint8 FAILURE_UNIT_SENSOR_BARO = 3
|
|
uint8 FAILURE_UNIT_SENSOR_GPS = 4
|
|
uint8 FAILURE_UNIT_SENSOR_OPTICAL_FLOW = 5
|
|
uint8 FAILURE_UNIT_SENSOR_VIO = 6
|
|
uint8 FAILURE_UNIT_SENSOR_DISTANCE_SENSOR = 7
|
|
uint8 FAILURE_UNIT_SENSOR_AIRSPEED = 8
|
|
uint8 FAILURE_UNIT_SYSTEM_BATTERY = 100
|
|
uint8 FAILURE_UNIT_SYSTEM_MOTOR = 101
|
|
uint8 FAILURE_UNIT_SYSTEM_SERVO = 102
|
|
uint8 FAILURE_UNIT_SYSTEM_AVOIDANCE = 103
|
|
uint8 FAILURE_UNIT_SYSTEM_RC_SIGNAL = 104
|
|
uint8 FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL = 105
|
|
uint8 FAILURE_UNIT_SYSTEM_ESC = 106
|
|
|
|
uint16[4] instance_mask # Bit i targets instance (i+1); 0xFFFF = all instances
|
|
|
|
uint8[4] failure_type # [@enum FAILURE_TYPE] failure mode per entry
|
|
# Failure mode.
|
|
# Mirrors MAVLink FAILURE_TYPE and the FAILURE_TYPE_* values in vehicle_command.
|
|
uint8 FAILURE_TYPE_OK = 0
|
|
uint8 FAILURE_TYPE_OFF = 1
|
|
uint8 FAILURE_TYPE_STUCK = 2
|
|
uint8 FAILURE_TYPE_GARBAGE = 3
|
|
uint8 FAILURE_TYPE_WRONG = 4
|
|
uint8 FAILURE_TYPE_SLOW = 5
|
|
uint8 FAILURE_TYPE_DELAYED = 6
|
|
uint8 FAILURE_TYPE_INTERMITTENT = 7
|