QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleReadiness Class Reference

Whether the vehicle would accept the Arm, Takeoff and Start Mission guided actions. More...

#include <VehicleReadiness.h>

Inheritance diagram for VehicleReadiness:
Collaboration diagram for VehicleReadiness:

Classes

struct  ActionFlightModes
 Flight modes a guided action uses, as the firmware plugin performs it. More...

Public Types

enum class  Status { Unknown , NotReady , Ready , Syncing }

Signals

void readinessChanged ()

Public Member Functions

 VehicleReadiness (Vehicle *vehicle)
bool canArm () const
bool canTakeoff () const
bool canStartMission () const
Status status () const
void update ()
 Re-evaluates readiness. Vehicle calls this once the firmware's subclass is fully constructed.

Protected Types

enum class  GuidedAction { Takeoff , StartMission }

Protected Member Functions

virtual ActionFlightModes _actionFlightModes (GuidedAction) const
 Firmware returns the modes its plugin uses for the action. Unknown modes fall back to the current mode.
virtual bool _canArm (bool genericCanArm) const
virtual bool _canTakeoff (bool genericCanTakeoff) const
virtual bool _canStartMission (bool genericCanStartMission) const
virtual Status _status (Status genericStatus) const

Protected Attributes

Vehicle * _vehicle = nullptr

Friends

class VehicleReadinessPX4Test
class VehicleReadinessTest

Detailed Description

Whether the vehicle would accept the Arm, Takeoff and Start Mission guided actions.

This is the single source of readiness for both the guided actions and the toolbar status. It is created by FirmwarePlugin::createVehicleReadiness, since the firmware plugin decides which flight modes each guided action arms and runs in. Every action is locked out until initial connect completes. After that readiness uses the best source available on the vehicle:

  1. libevents health and arming checks (mode aware: arming checks while disarmed, mode requirements while armed)
  2. The SYS_STATUS prearm check bit (current mode only)
  3. SYS_STATUS sensor health and vehicle setup, which only feeds the pre-flight status and never blocks actions Readiness is a prediction. The vehicle has the final say on every command.

Definition at line 26 of file VehicleReadiness.h.

Member Enumeration Documentation

◆ GuidedAction

enum class VehicleReadiness::GuidedAction
strongprotected
Enumerator
Takeoff 
StartMission 

Definition at line 64 of file VehicleReadiness.h.

◆ Status

enum class VehicleReadiness::Status
strong
Enumerator
Unknown 

Waiting for a health report the vehicle is expected to send, or the current mode is unknown to it.

NotReady 
Ready 
Syncing 

Initial connect is still in progress, so every action is locked out.

Definition at line 40 of file VehicleReadiness.h.

Constructor & Destructor Documentation

◆ VehicleReadiness()

Member Function Documentation

◆ _actionFlightModes()

virtual ActionFlightModes VehicleReadiness::_actionFlightModes ( GuidedAction ) const
inlineprotectedvirtual

Firmware returns the modes its plugin uses for the action. Unknown modes fall back to the current mode.

Reimplemented in APMVehicleReadiness, and PX4VehicleReadiness.

Definition at line 78 of file VehicleReadiness.h.

◆ _canArm()

virtual bool VehicleReadiness::_canArm ( bool genericCanArm) const
inlineprotectedvirtual

Per action overrides of the generic readiness. Each is given the generic answer, which firmware can keep, tighten or replace to match how its plugin performs the action. The initial connect lockout and an enforced pre-flight checklist still apply afterwards.

Definition at line 84 of file VehicleReadiness.h.

Referenced by update().

◆ _canStartMission()

virtual bool VehicleReadiness::_canStartMission ( bool genericCanStartMission) const
inlineprotectedvirtual

Definition at line 88 of file VehicleReadiness.h.

Referenced by update().

◆ _canTakeoff()

virtual bool VehicleReadiness::_canTakeoff ( bool genericCanTakeoff) const
inlineprotectedvirtual

Definition at line 86 of file VehicleReadiness.h.

Referenced by update().

◆ _status()

virtual Status VehicleReadiness::_status ( Status genericStatus) const
inlineprotectedvirtual

Definition at line 90 of file VehicleReadiness.h.

Referenced by update().

◆ canArm()

bool VehicleReadiness::canArm ( ) const
inline

Definition at line 49 of file VehicleReadiness.h.

References canArm().

Referenced by canArm().

◆ canStartMission()

bool VehicleReadiness::canStartMission ( ) const
inline

Definition at line 53 of file VehicleReadiness.h.

◆ canTakeoff()

bool VehicleReadiness::canTakeoff ( ) const
inline

Definition at line 51 of file VehicleReadiness.h.

◆ readinessChanged

void VehicleReadiness::readinessChanged ( )
signal

Referenced by update().

◆ status()

Status VehicleReadiness::status ( ) const
inline

Definition at line 55 of file VehicleReadiness.h.

◆ update()

void VehicleReadiness::update ( )

Re-evaluates readiness. Vehicle calls this once the firmware's subclass is fully constructed.

Definition at line 189 of file VehicleReadiness.cc.

References _canArm(), _canStartMission(), _canTakeoff(), _status(), and readinessChanged().

Referenced by VehicleReadiness().

◆ VehicleReadinessPX4Test

friend class VehicleReadinessPX4Test
friend

Definition at line 97 of file VehicleReadiness.h.

References VehicleReadinessPX4Test.

Referenced by VehicleReadinessPX4Test.

◆ VehicleReadinessTest

friend class VehicleReadinessTest
friend

Definition at line 98 of file VehicleReadiness.h.

References VehicleReadinessTest.

Referenced by VehicleReadinessTest.

Member Data Documentation

◆ _vehicle

Vehicle* VehicleReadiness::_vehicle = nullptr
protected

The documentation for this class was generated from the following files: