QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4ReturnLandComponent.cc
Go to the documentation of this file.
2
3#include "Fact.h"
4
6 : VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
7 , _name(tr("Return & Land"))
8{}
9
11{
12 return tr("Configure where and how high the vehicle returns, what it does on arrival, and how it lands.");
13}
14
16{
17 return QStringLiteral("/InstrumentValueIcons/home.svg");
18}
19
21{
22 return {
23 tr("RTL"), tr("Return to launch"), tr("Return home"), tr("Loiter"), tr("Landing"),
24 tr("Descent"), tr("Disarm"), tr("Touchdown"), tr("Altitude"),
25 };
26}
27
29{
30 return QUrl::fromUserInput(
31 QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/PX4/PX4ReturnLandComponent.qml"));
32}
33
34QList<VehicleSummaryItem> PX4ReturnLandComponent::summaryItems() const
35{
36 const Fact* const returnAlt = _parameterFact(QStringLiteral("RTL_RETURN_ALT"));
37 const Fact* const descendAlt = _parameterFact(QStringLiteral("RTL_DESCEND_ALT"));
38 const Fact* const landDelay = _parameterFact(QStringLiteral("RTL_LAND_DELAY"));
39 const int landDelayValue = landDelay ? landDelay->rawValue().toInt() : 0;
40
41 QList<VehicleSummaryItem> items;
42 if (returnAlt) {
43 items.append({tr("RTL Climb To"), _valueWithUnits(returnAlt), VehicleSummaryItem::Normal});
44 }
45 if (landDelay) {
46 const QString then = landDelayValue == 0 ? tr("Land immediately")
47 : landDelayValue < 0 ? tr("Loiter and do not land")
48 : tr("Loiter and land after specified time");
49 items.append({tr("RTL, Then"), then, VehicleSummaryItem::Normal});
50 }
51 if (descendAlt && landDelayValue != 0) {
52 items.append({tr("Loiter Alt"), _valueWithUnits(descendAlt), VehicleSummaryItem::Normal});
53 }
54 if (landDelay && landDelayValue > 0) {
55 items.append({tr("Land Delay"), _valueWithUnits(landDelay), VehicleSummaryItem::Normal});
56 }
57
58 return items;
59}
The AutoPilotPlugin class is an abstract base class which represents the methods and objects which ar...
A Fact is used to hold a single value within the system.
Definition Fact.h:15
QVariant rawValue() const
Definition Fact.h:87
QString description() const final
QString iconResource() const final
PX4ReturnLandComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent=nullptr)
QList< VehicleSummaryItem > summaryItems() const final
Values for this component's card on the Summary page. A component with none falls back to summaryQmlS...
QStringList searchKeywords() const final
Translated search terms for the whole component, for pages without vehicleConfigJson() sections.
VehicleComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject *parent=nullptr)
Fact * _parameterFact(const QString &name) const
Fact of a parameter of the default component, nullptr when the vehicle does not have it.
static QString _valueWithUnits(const Fact *fact)
The fact's value followed by its units, when it has any.