diff --git a/QGCApplication.pro b/QGCApplication.pro
index a89c6d8af0b236db64ad19f28576ad0d2433e7a6..724ae8030aeae583bec7518a2f9f7cf34d2bb4ba 100644
--- a/QGCApplication.pro
+++ b/QGCApplication.pro
@@ -509,6 +509,8 @@ HEADERS+= \
src/AutoPilotPlugins/AutoPilotPlugin.h \
src/AutoPilotPlugins/AutoPilotPluginManager.h \
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h \
+ src/AutoPilotPlugins/APM/APMAirframeComponent.h \
+ src/AutoPilotPlugins/APM/APMComponent.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
src/AutoPilotPlugins/PX4/AirframeComponent.h \
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h \
@@ -551,6 +553,8 @@ SOURCES += \
src/AutoPilotPlugins/AutoPilotPlugin.cc \
src/AutoPilotPlugins/AutoPilotPluginManager.cc \
src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc \
+ src/AutoPilotPlugins/APM/APMAirframeComponent.cc \
+ src/AutoPilotPlugins/APM/APMComponent.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/AutoPilotPlugins/PX4/AirframeComponent.cc \
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.cc \
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 33fba8e4ae1338c99e2f3dfa6fe8f72ed1c1fb5d..81ced86ffd0fa8d30b402b64aa60fa0b121c055b 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -81,6 +81,10 @@
src/MissionEditor/MissionEditor.qml
src/MissionEditor/MissionEditorHelp.qml
+ src/AutoPilotPlugins/APM/APMAirframeComponent.qml
+ src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
+
+
src/FlightDisplay/qmldir
src/FlightDisplay/FlightDisplayView.qml
diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.cc b/src/AutoPilotPlugins/APM/APMAirframeComponent.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7519398a743247fdea06372c4ca71bf7bb3aa3d8
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.cc
@@ -0,0 +1,116 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2014 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+/// @file
+/// @author Don Gagne
+
+#include "APMAirframeComponent.h"
+#include "QGCQmlWidgetHolder.h"
+
+APMAirframeComponent::APMAirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ APMComponent(uas, autopilot, parent),
+ _name(tr("Airframe"))
+{
+
+}
+
+QString APMAirframeComponent::name(void) const
+{
+ return _name;
+}
+
+QString APMAirframeComponent::description(void) const
+{
+ return tr("The Airframe Component is used to select the airframe which matches your vehicle. "
+ "This will in turn set up the various tuning values for flight paramters.");
+}
+
+QString APMAirframeComponent::iconResource(void) const
+{
+ return "/qmlimages/AirframeComponentIcon.png";
+}
+
+bool APMAirframeComponent::requiresSetup(void) const
+{
+ return true;
+}
+
+bool APMAirframeComponent::setupComplete(void) const
+{
+ // You'll need to figure out which parameters trigger setup complete
+#if 0
+ return _autopilot->getParameterFact(FactSystem::defaultComponentId, "SYS_AUTOSTART")->value().toInt() != 0;
+#else
+ return true;
+#endif
+}
+
+QString APMAirframeComponent::setupStateDescription(void) const
+{
+ const char* stateDescription;
+
+ if (requiresSetup()) {
+ stateDescription = "Requires calibration";
+ } else {
+ stateDescription = "Calibrated";
+ }
+ return QString(stateDescription);
+}
+
+QStringList APMAirframeComponent::setupCompleteChangedTriggerList(void) const
+{
+ // You'll need to figure out which parameters trigger setup complete
+#if 0
+ return QStringList("SYS_AUTOSTART");
+#else
+ return QStringList();
+#endif
+}
+
+QStringList APMAirframeComponent::paramFilterList(void) const
+{
+#if 0
+ QStringList list;
+
+ list << "SYS_AUTOSTART";
+
+ return list;
+#else
+ return QStringList();
+#endif
+}
+
+QUrl APMAirframeComponent::setupSource(void) const
+{
+ return QUrl::fromUserInput("qrc:/qml/APMAirframeComponent.qml");
+}
+
+QUrl APMAirframeComponent::summaryQmlSource(void) const
+{
+ return QUrl::fromUserInput("qrc:/qml/APMAirframeComponentSummary.qml");
+}
+
+QString APMAirframeComponent::prerequisiteSetup(void) const
+{
+ return QString();
+}
diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.h b/src/AutoPilotPlugins/APM/APMAirframeComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a763c66e12b7ef1a2bec80ea0a375134d44499a
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.h
@@ -0,0 +1,56 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2014 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+#ifndef APMAirframeComponent_H
+#define APMAirframeComponent_H
+
+#include "APMComponent.h"
+
+class APMAirframeComponent : public APMComponent
+{
+ Q_OBJECT
+
+public:
+ APMAirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
+
+ // Virtuals from APMComponent
+ virtual 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 QString setupStateDescription(void) const;
+ virtual QUrl setupSource(void) const;
+ virtual QStringList paramFilterList(void) const;
+ virtual QUrl summaryQmlSource(void) const;
+ virtual QString prerequisiteSetup(void) const;
+
+private:
+ const QString _name;
+ QVariantList _summaryItems;
+};
+
+#endif
diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml
new file mode 100644
index 0000000000000000000000000000000000000000..e03e3e95084c396b4a52459cacec680d7616463c
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml
@@ -0,0 +1,51 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Dialogs 1.2
+
+import QGroundControl.FactSystem 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Controllers 1.0
+import QGroundControl.ScreenTools 1.0
+
+QGCView {
+ id: qgcView
+ viewPanel: panel
+
+ QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
+
+ QGCViewPanel {
+ id: panel
+ anchors.fill: parent
+
+ QGCLabel {
+ text: "Work in progress";
+ }
+
+ } // QGCViewPanel
+} // QGCView
diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
new file mode 100644
index 0000000000000000000000000000000000000000..975a6f8254bd010dddd228e40db2a3cc306d7a9c
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+
+import QGroundControl.FactSystem 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Controllers 1.0
+import QGroundControl.Palette 1.0
+
+FactPanel {
+ id: panel
+ anchors.fill: parent
+ color: qgcPal.windowShadeDark
+
+ QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
+
+/*
+ property Fact sysIdFact: controller.getParameterFact(-1, "MAV_SYS_ID")
+ property Fact sysAutoStartFact: controller.getParameterFact(-1, "SYS_AUTOSTART")
+
+ property bool autoStartSet: sysAutoStartFact.value != 0
+*/
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: 8
+
+/*
+ VehicleSummaryRow {
+ labelText: "System ID:"
+ valueText: sysIdFact.valueString
+ }
+
+ VehicleSummaryRow {
+ labelText: "Airframe type:"
+ valueText: autoStartSet ? controller.currentAirframeType : "Setup required"
+ }
+
+ VehicleSummaryRow {
+ labelText: "Vehicle:"
+ valueText: autoStartSet ? controller.currentVehicleName : "Setup required"
+ }
+*/
+ }
+}
diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
index 09e5e1c8a537b04bd89d6ffde89a161f0ca21c79..ad623ca5bd81b491fa1006d49de9f7da696d767e 100644
--- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
+++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
@@ -29,9 +29,10 @@
#include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack
/// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type.
-APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) :
- AutoPilotPlugin(vehicle, parent),
- _incorrectParameterVersion(false)
+APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent)
+ : AutoPilotPlugin(vehicle, parent)
+ , _incorrectParameterVersion(false)
+ , _airframeComponent(NULL)
{
Q_ASSERT(vehicle);
}
@@ -43,9 +44,20 @@ APMAutoPilotPlugin::~APMAutoPilotPlugin()
const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
{
- static const QVariantList emptyList;
+ if (_components.count() == 0 && !_incorrectParameterVersion) {
+ Q_ASSERT(_vehicle);
- return emptyList;
+ if (parametersReady()) {
+ _airframeComponent = new APMAirframeComponent(_vehicle->uas(), this);
+ Q_CHECK_PTR(_airframeComponent);
+ _airframeComponent->setupTriggerSignals();
+ _components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent));
+ } else {
+ qWarning() << "Call to vehicleCompenents prior to parametersReady";
+ }
+ }
+
+ return _components;
}
/// This will perform various checks prior to signalling that the plug in ready
diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h
index 3864d2c2bccb0dfcedf1d138f03bd314c6249d69..43c639736be30b874cebf2dfe90305c0e2d2ce60 100644
--- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h
+++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h
@@ -26,6 +26,7 @@
#include "AutoPilotPlugin.h"
#include "Vehicle.h"
+#include "APMAirframeComponent.h"
/// This is the APM specific implementation of the AutoPilot class.
class APMAutoPilotPlugin : public AutoPilotPlugin
@@ -44,7 +45,9 @@ public slots:
void _parametersReadyPreChecks(bool missingParameters);
private:
- bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
+ bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
+ QVariantList _components;
+ APMAirframeComponent* _airframeComponent;
};
#endif
diff --git a/src/AutoPilotPlugins/APM/APMComponent.cc b/src/AutoPilotPlugins/APM/APMComponent.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2a0b652fe194cfbeffbcf3f880b2235ef22fa09b
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMComponent.cc
@@ -0,0 +1,53 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2014 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+/// @file
+/// @author Don Gagne
+
+#include "APMComponent.h"
+#include "Fact.h"
+#include "AutoPilotPlugin.h"
+
+APMComponent::APMComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ VehicleComponent(uas, autopilot, parent)
+{
+ Q_ASSERT(uas);
+ Q_ASSERT(autopilot);
+}
+
+void APMComponent::setupTriggerSignals(void)
+{
+ // Watch for changed on trigger list params
+ foreach (QString paramName, setupCompleteChangedTriggerList()) {
+ Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName);
+
+ connect(fact, &Fact::valueChanged, this, &APMComponent::_triggerUpdated);
+ }
+}
+
+
+void APMComponent::_triggerUpdated(QVariant value)
+{
+ Q_UNUSED(value);
+ emit setupCompleteChanged(setupComplete());
+}
diff --git a/src/AutoPilotPlugins/APM/APMComponent.h b/src/AutoPilotPlugins/APM/APMComponent.h
new file mode 100644
index 0000000000000000000000000000000000000000..88097c18a01c39dddae69de23d4dcf81070eb579
--- /dev/null
+++ b/src/AutoPilotPlugins/APM/APMComponent.h
@@ -0,0 +1,54 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2014 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+#ifndef APMComponent_H
+#define APMComponent_H
+
+#include "VehicleComponent.h"
+
+#include
+
+/// @file
+/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects.
+/// @author Don Gagne
+
+class APMComponent : public VehicleComponent
+{
+ Q_OBJECT
+
+public:
+ APMComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
+
+ /// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged
+ /// signal to be emitted. Last element is signalled by NULL.
+ virtual QStringList setupCompleteChangedTriggerList(void) const = 0;
+
+ /// Should be called after the component is created (but not in constructor) to setup the
+ /// signals which are used to track parameter changes which affect setupComplete state.
+ void setupTriggerSignals(void);
+
+private slots:
+ void _triggerUpdated(QVariant value);
+};
+
+#endif