From 909e6ddab13bf542a0a012976258b4a55bde3338 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 11 Mar 2016 14:42:52 -0800 Subject: [PATCH 1/2] Allow VehicleComponent setup while armed --- src/AutoPilotPlugins/APM/APMSafetyComponent.h | 3 ++- src/AutoPilotPlugins/APM/APMTuningComponent.h | 3 ++- src/AutoPilotPlugins/PX4/PX4TuningComponent.h | 21 +++++++++++---------- .../PX4/PX4TuningComponentCopter.qml | 3 ++- src/AutoPilotPlugins/PX4/SafetyComponent.h | 21 +++++++++++---------- src/VehicleSetup/SetupView.qml | 2 +- src/VehicleSetup/VehicleComponent.cc | 6 ++++++ src/VehicleSetup/VehicleComponent.h | 20 ++++++++++++-------- 8 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponent.h b/src/AutoPilotPlugins/APM/APMSafetyComponent.h index 805e97e..bf06820 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponent.h +++ b/src/AutoPilotPlugins/APM/APMSafetyComponent.h @@ -45,7 +45,8 @@ public: QUrl setupSource(void) const final; QUrl summaryQmlSource(void) const final; QString prerequisiteSetup(void) const final; - + bool allowSetupWhileArmed(void) const final { return true; } + private: const QString _name; QVariantList _summaryItems; diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.h b/src/AutoPilotPlugins/APM/APMTuningComponent.h index 90fcfe5..ac18f0b 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.h +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.h @@ -45,7 +45,8 @@ public: QUrl setupSource(void) const final; QUrl summaryQmlSource(void) const final; QString prerequisiteSetup(void) const final; - + bool allowSetupWhileArmed(void) const final { return true; } + private: const QString _name; QVariantList _summaryItems; diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponent.h b/src/AutoPilotPlugins/PX4/PX4TuningComponent.h index 89aeb40..599b287 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponent.h +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponent.h @@ -34,18 +34,19 @@ public: PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); // Virtuals from VehicleComponent - virtual QStringList setupCompleteChangedTriggerList(void) const; + QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent - virtual QString name(void) const; - virtual QString description(void) const; - virtual QString iconResource(void) const; - virtual bool requiresSetup(void) const; - virtual bool setupComplete(void) const; - virtual QUrl setupSource(void) const; - virtual QUrl summaryQmlSource(void) const; - virtual QString prerequisiteSetup(void) const; - + QString name(void) const final; + QString description(void) const final; + QString iconResource(void) const final; + bool requiresSetup(void) const final; + bool setupComplete(void) const final; + QUrl setupSource(void) const final; + QUrl summaryQmlSource(void) const final; + QString prerequisiteSetup(void) const final; + bool allowSetupWhileArmed(void) const final { return true; } + private: const QString _name; }; diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml b/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml index ae3e511..9ec2de8 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml @@ -27,7 +27,8 @@ import QtQuick.Controls 1.4 import QGroundControl.Controls 1.0 FactSliderPanel { - anchors.fill: parent + anchors.fill: parent + panelTitle: "Tuning" sliderModel: ListModel { ListElement { diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.h b/src/AutoPilotPlugins/PX4/SafetyComponent.h index 9cbf37e..77208b6 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.h +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.h @@ -39,18 +39,19 @@ public: SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); // Virtuals from VehicleComponent - virtual QStringList setupCompleteChangedTriggerList(void) const; + QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent - virtual QString name(void) const; - virtual QString description(void) const; - virtual QString iconResource(void) const; - virtual bool requiresSetup(void) const; - virtual bool setupComplete(void) const; - virtual QUrl setupSource(void) const; - virtual QUrl summaryQmlSource(void) const; - virtual QString prerequisiteSetup(void) const; - + QString name(void) const final; + QString description(void) const final; + QString iconResource(void) const final; + bool requiresSetup(void) const final; + bool setupComplete(void) const final; + QUrl setupSource(void) const final; + QUrl summaryQmlSource(void) const final; + QString prerequisiteSetup(void) const final; + bool allowSetupWhileArmed(void) const final { return true; } + private: const QString _name; QVariantList _summaryItems; diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index fb030cd..cb4ee37 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -101,7 +101,7 @@ Rectangle { function showVehicleComponentPanel(vehicleComponent) { - if (multiVehicleManager.activeVehicle.armed) { + if (multiVehicleManager.activeVehicle.armed && !vehicleComponent.allowSetupWhileArmed) { _messagePanelText = _armedVehicleText panelLoader.sourceComponent = messagePanelComponent } else { diff --git a/src/VehicleSetup/VehicleComponent.cc b/src/VehicleSetup/VehicleComponent.cc index 4331692..a011634 100644 --- a/src/VehicleSetup/VehicleComponent.cc +++ b/src/VehicleSetup/VehicleComponent.cc @@ -73,3 +73,9 @@ void VehicleComponent::_triggerUpdated(QVariant /*value*/) { emit setupCompleteChanged(setupComplete()); } + +bool VehicleComponent::allowSetupWhileArmed(void) const +{ + // Default is to not allow setup while armed + return false; +} diff --git a/src/VehicleSetup/VehicleComponent.h b/src/VehicleSetup/VehicleComponent.h index 3e4fba2..7a2f9fc 100644 --- a/src/VehicleSetup/VehicleComponent.h +++ b/src/VehicleSetup/VehicleComponent.h @@ -42,14 +42,15 @@ class VehicleComponent : public QObject { Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString description READ description CONSTANT) - Q_PROPERTY(bool requiresSetup READ requiresSetup CONSTANT) - Q_PROPERTY(bool setupComplete READ setupComplete STORED false NOTIFY setupCompleteChanged) - Q_PROPERTY(QString iconResource READ iconResource CONSTANT) - Q_PROPERTY(QUrl setupSource READ setupSource CONSTANT) - Q_PROPERTY(QUrl summaryQmlSource READ summaryQmlSource CONSTANT) - Q_PROPERTY(QString prerequisiteSetup READ prerequisiteSetup) + Q_PROPERTY(QString name READ name CONSTANT) + Q_PROPERTY(QString description READ description CONSTANT) + Q_PROPERTY(bool requiresSetup READ requiresSetup CONSTANT) + Q_PROPERTY(bool setupComplete READ setupComplete STORED false NOTIFY setupCompleteChanged) + Q_PROPERTY(QString iconResource READ iconResource CONSTANT) + Q_PROPERTY(QUrl setupSource READ setupSource CONSTANT) + Q_PROPERTY(QUrl summaryQmlSource READ summaryQmlSource CONSTANT) + Q_PROPERTY(QString prerequisiteSetup READ prerequisiteSetup CONSTANT) + Q_PROPERTY(bool allowSetupWhileArmed READ allowSetupWhileArmed CONSTANT) public: VehicleComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); @@ -63,6 +64,9 @@ public: virtual QUrl setupSource(void) const = 0; virtual QUrl summaryQmlSource(void) const = 0; virtual QString prerequisiteSetup(void) const = 0; + + // @return true: Setup panel can be shown while vehicle is armed + virtual bool allowSetupWhileArmed(void) const; virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent); From 3af867356fc02398e320b7e1760526f46fa51603 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 11 Mar 2016 14:43:02 -0800 Subject: [PATCH 2/2] Rework tuning UI --- src/QmlControls/FactSliderPanel.qml | 43 +++++++++++++++++++------------------ src/comm/PX4MockLink.params | 1 + 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/QmlControls/FactSliderPanel.qml b/src/QmlControls/FactSliderPanel.qml index b1d1321..6b6bfe1 100644 --- a/src/QmlControls/FactSliderPanel.qml +++ b/src/QmlControls/FactSliderPanel.qml @@ -80,30 +80,31 @@ QGCView { font.weight: Font.DemiBold } - Rectangle { - id: sliderRect - anchors.topMargin: _margins / 2 + + Column { + anchors.margins: _margins anchors.left: parent.left anchors.right: parent.right anchors.top: panelLabel.bottom - height: sliderColumns.y + sliderColumns.height + _margins - color: palette.windowShade + spacing: _margins - Column { - id: sliderColumns - anchors.margins: _margins - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - spacing: _margins + Repeater { + id: sliderRepeater + model: sliderModel - Repeater { - id: sliderRepeater - model: sliderModel + Rectangle { + id: sliderRect + anchors.left: parent.left + anchors.right: parent.right + height: sliderColumn.y + sliderColumn.height + _margins + color: palette.windowShade Column { - anchors.left: parent.left - anchors.right: parent.right + id: sliderColumn + anchors.margins: _margins + anchors.left: parent.left + anchors.right: parent.right + anchors.top: sliderRect.top property alias sliderValue: slider.value @@ -132,11 +133,11 @@ QGCView { fact.value = value } } - } + } // Slider } // Column - } // Repeater - } // Column - } // Rectangle + } // Rectangle + } // Repeater + } // Column } // QGCFlickable } // QGCViewPanel } // QGCView diff --git a/src/comm/PX4MockLink.params b/src/comm/PX4MockLink.params index 124acd0..81dbb44 100644 --- a/src/comm/PX4MockLink.params +++ b/src/comm/PX4MockLink.params @@ -282,6 +282,7 @@ 1 50 MPC_MANTHR_MIN 0.080 9 1 50 MPC_THR_MAX 1 9 1 50 MPC_THR_MIN 0.1 9 +1 50 MPC_THR_HOVER 0.5 9 1 50 MPC_TILTMAX_AIR 45 9 1 50 MPC_TILTMAX_LND 15 9 1 50 MPC_XY_FF 0.5 9