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 () Destructor (internal use only).
  Failure (const Failure &)=delete Copy constructor (object is not copyable).
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 = std::make_shared<Failure>(system);

Parameters

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

~Failure()

mavsdk::Failure::~Failure()

Destructor (internal use only).

Failure()

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

Copy constructor (object is not copyable).

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 & -

© Dronecode 2017-2020. License: CC BY 4.0            Updated: 2020-10-17 17:05:17

results matching ""

    No results matching ""