QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4CollisionComponent.cc
Go to the documentation of this file.
2
3#include "Fact.h"
4
6 : VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
7 , _name(tr("Collision"))
8{}
9
11{
12 return tr("Configure collision prevention, which keeps the vehicle away from obstacles seen by distance sensors.");
13}
14
16{
17 return QStringLiteral("/InstrumentValueIcons/radar.svg");
18}
19
21{
22 return {
23 tr("Collision prevention"), tr("Avoidance"), tr("Obstacle"), tr("Proximity"), tr("Distance sensor"),
24 };
25}
26
28{
29 return QUrl::fromUserInput(
30 QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/PX4/PX4CollisionComponent.qml"));
31}
32
33QList<VehicleSummaryItem> PX4CollisionComponent::summaryItems() const
34{
35 const Fact* const distance = _parameterFact(QStringLiteral("CP_DIST"));
36 if (!distance) {
37 return {};
38 }
39
40 if (distance->rawValue().toFloat() > 0) {
41 return {{tr("Collision Prevention"), _valueWithUnits(distance), VehicleSummaryItem::Normal}};
42 }
43
44 return {{tr("Collision Prevention"), tr("Disabled"), VehicleSummaryItem::Muted}};
45}
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
QString iconResource() const final
QUrl setupSource() const final
QString description() const final
QStringList searchKeywords() const final
Translated search terms for the whole component, for pages without vehicleConfigJson() sections.
PX4CollisionComponent(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...
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.