Failure

class mavsdk.failure.Failure(async_plugin_manager)

Bases: mavsdk._base.AsyncBase

Inject failures into system to test failsafes.

Generated by dcsdkgen - MAVSDK Failure API

async inject(failure_unit, failure_type, instance)

Injects a failure.

Parameters
  • failure_unit (FailureUnit) – The failure unit to send

  • failure_type (FailureType) – The failure type to send

  • instance (int32_t) – Instance to affect (0 for all)

Raises

FailureError – If the request fails. The error contains the reason for the failure.

name = 'Failure'
exception mavsdk.failure.FailureError(result, origin, *params)

Bases: Exception

Raised when a FailureResult is a fail code

class mavsdk.failure.FailureResult(result, result_str)

Bases: object

Parameters
  • result (Result) – Result enum value

  • result_str (std::string) – Human-readable English string describing the result

class Result(value)

Bases: enum.Enum

Possible results returned for failure requests.

UNKNOWN

Unknown result

SUCCESS

Request succeeded

NO_SYSTEM

No system is connected

CONNECTION_ERROR

Connection error

UNSUPPORTED

Failure not supported

DENIED

Failure injection denied

DISABLED

Failure injection is disabled

TIMEOUT

Request timed out

CONNECTION_ERROR = 3
DENIED = 5
DISABLED = 6
NO_SYSTEM = 2
SUCCESS = 1
TIMEOUT = 7
UNKNOWN = 0
UNSUPPORTED = 4
class mavsdk.failure.FailureType(value)

Bases: enum.Enum

A failure type

OK

No failure injected, used to reset a previous failure

OFF

Sets unit off, so completely non-responsive

STUCK

Unit is stuck e.g. keeps reporting the same value

GARBAGE

Unit is reporting complete garbage

WRONG

Unit is consistently wrong

SLOW

Unit is slow, so e.g. reporting at slower than expected rate

DELAYED

Data of unit is delayed in time

INTERMITTENT

Unit is sometimes working, sometimes not

DELAYED = 6
GARBAGE = 3
INTERMITTENT = 7
OFF = 1
OK = 0
SLOW = 5
STUCK = 2
WRONG = 4
class mavsdk.failure.FailureUnit(value)

Bases: enum.Enum

A failure unit.

SENSOR_GYRO

Gyro

SENSOR_ACCEL

Accelerometer

SENSOR_MAG

Magnetometer

SENSOR_BARO

Barometer

SENSOR_GPS

GPS

SENSOR_OPTICAL_FLOW

Optical flow

SENSOR_VIO

Visual inertial odometry

SENSOR_DISTANCE_SENSOR

Distance sensor

SENSOR_AIRSPEED

Airspeed

SYSTEM_BATTERY

Battery

SYSTEM_MOTOR

Motor

SYSTEM_SERVO

Servo

SYSTEM_AVOIDANCE

Avoidance

SYSTEM_RC_SIGNAL

RC signal

SYSTEM_MAVLINK_SIGNAL

MAVLink signal

SENSOR_ACCEL = 1
SENSOR_AIRSPEED = 8
SENSOR_BARO = 3
SENSOR_DISTANCE_SENSOR = 7
SENSOR_GPS = 4
SENSOR_GYRO = 0
SENSOR_MAG = 2
SENSOR_OPTICAL_FLOW = 5
SENSOR_VIO = 6
SYSTEM_AVOIDANCE = 12
SYSTEM_BATTERY = 9
SYSTEM_MOTOR = 10
SYSTEM_RC_SIGNAL = 13
SYSTEM_SERVO = 11