mavsdk::Failure Class Reference

#include: failure.h


Inject failures into system to test failsafes.

Public Types

Type Description
enum FailureUnit A failure unit.
enum FailureType A failure type.
enum Result Possible results returned for failure requests.
std::function< void(Result)> ResultCallback Callback type for asynchronous Failure calls.

Public Member Functions

Type Name Description
  Failure (System & system) Constructor. Creates the plugin for a specific System.
  Failure (std::shared_ptr< System > system) Constructor. Creates the plugin for a specific System.
  ~Failure () override Destructor (internal use only).
  Failure (const Failure & other) Copy constructor.
Result inject (FailureUnit failure_unit, FailureType failure_type, int32_t instance)const Injects a failure.
const Failure & operator= (const Failure &)=delete Equality operator (object is not copyable).

Constructor & Destructor Documentation

Failure()

mavsdk::Failure::Failure(System &system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto failure = Failure(system);

Parameters

  • System& system - The specific system associated with this plugin.

Failure()

mavsdk::Failure::Failure(std::shared_ptr< System > system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto failure = Failure(system);

Parameters

  • std::shared_ptr< System > system - The specific system associated with this plugin.

~Failure()

mavsdk::Failure::~Failure() override

Destructor (internal use only).

Failure()

mavsdk::Failure::Failure(const Failure &other)

Copy constructor.

Parameters

Member Typdef Documentation

typedef ResultCallback

using mavsdk::Failure::ResultCallback =  std::function<void(Result)>

Callback type for asynchronous Failure calls.

Member Enumeration Documentation

enum FailureUnit

A failure unit.

Value Description
SensorGyro Gyro.
SensorAccel Accelerometer.
SensorMag Magnetometer.
SensorBaro Barometer.
SensorGps GPS.
SensorOpticalFlow Optical flow.
SensorVio Visual inertial odometry.
SensorDistanceSensor Distance sensor.
SensorAirspeed Airspeed.
SystemBattery Battery.
SystemMotor Motor.
SystemServo Servo.
SystemAvoidance Avoidance.
SystemRcSignal RC signal.
SystemMavlinkSignal MAVLink signal.

enum FailureType

A failure type.

Value Description
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.

enum Result

Possible results returned for failure requests.

Value Description
Unknown Unknown result.
Success Request succeeded.
NoSystem No system is connected.
ConnectionError Connection error.
Unsupported Failure not supported.
Denied Failure injection denied.
Disabled Failure injection is disabled.
Timeout Request timed out.

Member Function Documentation

inject()

Result mavsdk::Failure::inject(FailureUnit failure_unit, FailureType failure_type, int32_t instance) const

Injects a failure.

This function is blocking.

Parameters

Returns

Result - Result of request.

operator=()

const Failure& mavsdk::Failure::operator=(const Failure &)=delete

Equality operator (object is not copyable).

Parameters

Returns

 const Failure & -

© MAVSDK Development Team 2017-2023. License: CC BY 4.0            Updated: 2023-12-27 03:58:12

results matching ""

    No results matching ""