QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
APMVehicleReadiness.cc
Go to the documentation of this file.
2
3#include "APMFirmwarePlugin.h"
4#include "Vehicle.h"
5#include "VehicleSupports.h"
6
10
12{
13 const auto* const firmwarePlugin = qobject_cast<const APMFirmwarePlugin*>(_vehicle->firmwarePlugin());
14 if (!firmwarePlugin) {
15 return ActionFlightModes{};
16 }
17
18 const QString guidedFlightMode = firmwarePlugin->guidedFlightMode();
19 const QString missionFlightMode = firmwarePlugin->missionFlightMode();
20
21 switch (action) {
23 // guidedModeTakeoff arms in Guided and takes off without a mode change; startTakeoff arms in Takeoff mode
24 const QString takeoffFlightMode = _vehicle->supports()->guidedTakeoffWithAltitude()
25 ? guidedFlightMode
26 : firmwarePlugin->takeOffFlightMode();
27 return ActionFlightModes{.armFlightMode = takeoffFlightMode, .targetFlightMode = takeoffFlightMode};
28 }
30 if (_vehicle->fixedWing() || _vehicle->vtol()) {
31 return ActionFlightModes{.armFlightMode = missionFlightMode, .targetFlightMode = missionFlightMode};
32 }
33 // MAV_CMD_MISSION_START switches to Auto after arming in Guided
34 return ActionFlightModes{.armFlightMode = guidedFlightMode, .targetFlightMode = missionFlightMode};
35 }
36
37 return ActionFlightModes{};
38}
ActionFlightModes _actionFlightModes(GuidedAction action) const override
Firmware returns the modes its plugin uses for the action. Unknown modes fall back to the current mod...
APMVehicleReadiness(Vehicle *vehicle)
VehicleReadiness(Vehicle *vehicle)
Flight modes a guided action uses, as the firmware plugin performs it.