10 changed files with 404 additions and 6 deletions
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#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(); |
||||
} |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
#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 |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
/*===================================================================== |
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||
|
||||
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 <http://www.gnu.org/licenses/>. |
||||
|
||||
======================================================================*/ |
||||
|
||||
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 |
@ -0,0 +1,45 @@
@@ -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" |
||||
} |
||||
*/ |
||||
} |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#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()); |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
#ifndef APMComponent_H |
||||
#define APMComponent_H |
||||
|
||||
#include "VehicleComponent.h" |
||||
|
||||
#include <QStringList> |
||||
|
||||
/// @file
|
||||
/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects.
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
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 |
Loading…
Reference in new issue