14 changed files with 453 additions and 81 deletions
@ -1,33 +0,0 @@ |
|||||||
/*===================================================================== |
|
||||||
|
|
||||||
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.5 |
|
||||||
|
|
||||||
import QGroundControl.Controls 1.0 |
|
||||||
|
|
||||||
QGCLabel { |
|
||||||
anchors.fill: parent |
|
||||||
text: "Not supported" |
|
||||||
horizontalAlignment: Text.AlignHCenter |
|
||||||
verticalAlignment: Text.AlignVCenter |
|
||||||
} |
|
@ -1,33 +0,0 @@ |
|||||||
/*===================================================================== |
|
||||||
|
|
||||||
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.5 |
|
||||||
|
|
||||||
import QGroundControl.Controls 1.0 |
|
||||||
|
|
||||||
QGCLabel { |
|
||||||
anchors.fill: parent |
|
||||||
text: "Not supported" |
|
||||||
horizontalAlignment: Text.AlignHCenter |
|
||||||
verticalAlignment: Text.AlignVCenter |
|
||||||
} |
|
@ -0,0 +1,103 @@ |
|||||||
|
/*=====================================================================
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
======================================================================*/ |
||||||
|
|
||||||
|
#include "PX4TuningComponent.h" |
||||||
|
#include "PX4AutoPilotPlugin.h" |
||||||
|
#include "AirframeComponent.h" |
||||||
|
|
||||||
|
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) |
||||||
|
: PX4Component(vehicle, autopilot, parent) |
||||||
|
, _name("Tuning") |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
QString PX4TuningComponent::name(void) const |
||||||
|
{ |
||||||
|
return _name; |
||||||
|
} |
||||||
|
|
||||||
|
QString PX4TuningComponent::description(void) const |
||||||
|
{ |
||||||
|
return tr("The Tuning Component is used to tune the flight characteristics of the Vehicle."); |
||||||
|
} |
||||||
|
|
||||||
|
QString PX4TuningComponent::iconResource(void) const |
||||||
|
{ |
||||||
|
return "/qmlimages/TuningComponentIcon.png"; |
||||||
|
} |
||||||
|
|
||||||
|
bool PX4TuningComponent::requiresSetup(void) const |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
bool PX4TuningComponent::setupComplete(void) const |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
QStringList PX4TuningComponent::setupCompleteChangedTriggerList(void) const |
||||||
|
{ |
||||||
|
return QStringList(); |
||||||
|
} |
||||||
|
|
||||||
|
QUrl PX4TuningComponent::setupSource(void) const |
||||||
|
{ |
||||||
|
QString qmlFile; |
||||||
|
|
||||||
|
switch (_vehicle->vehicleType()) { |
||||||
|
case MAV_TYPE_FIXED_WING: |
||||||
|
qmlFile = "qrc:/qml/PX4TuningComponentPlane.qml"; |
||||||
|
break; |
||||||
|
case MAV_TYPE_QUADROTOR: |
||||||
|
case MAV_TYPE_COAXIAL: |
||||||
|
case MAV_TYPE_HELICOPTER: |
||||||
|
case MAV_TYPE_HEXAROTOR: |
||||||
|
case MAV_TYPE_OCTOROTOR: |
||||||
|
case MAV_TYPE_TRICOPTER: |
||||||
|
qmlFile = "qrc:/qml/PX4TuningComponentCopter.qml"; |
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
return QUrl::fromUserInput(qmlFile); |
||||||
|
} |
||||||
|
|
||||||
|
QUrl PX4TuningComponent::summaryQmlSource(void) const |
||||||
|
{ |
||||||
|
return QUrl(); |
||||||
|
} |
||||||
|
|
||||||
|
QString PX4TuningComponent::prerequisiteSetup(void) const |
||||||
|
{ |
||||||
|
PX4AutoPilotPlugin* plugin = dynamic_cast<PX4AutoPilotPlugin*>(_autopilot); |
||||||
|
if (plugin) { |
||||||
|
if (!plugin->airframeComponent()->setupComplete()) { |
||||||
|
return plugin->airframeComponent()->name(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
qWarning() << "Internal error: plugin cast failed"; |
||||||
|
return QString(); |
||||||
|
} |
@ -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/>.
|
||||||
|
|
||||||
|
======================================================================*/ |
||||||
|
|
||||||
|
#ifndef PX4TuningComponent_H |
||||||
|
#define PX4TuningComponent_H |
||||||
|
|
||||||
|
#include "PX4Component.h" |
||||||
|
|
||||||
|
class PX4TuningComponent : public PX4Component |
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
|
||||||
|
public: |
||||||
|
PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); |
||||||
|
|
||||||
|
// Virtuals from PX4Component
|
||||||
|
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 QUrl setupSource(void) const; |
||||||
|
virtual QUrl summaryQmlSource(void) const; |
||||||
|
virtual QString prerequisiteSetup(void) const; |
||||||
|
|
||||||
|
private: |
||||||
|
const QString _name; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,69 @@ |
|||||||
|
/*===================================================================== |
||||||
|
|
||||||
|
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.5 |
||||||
|
import QtQuick.Controls 1.4 |
||||||
|
|
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
|
||||||
|
FactSliderPanel { |
||||||
|
anchors.fill: parent |
||||||
|
|
||||||
|
sliderModel: ListModel { |
||||||
|
ListElement { |
||||||
|
title: "Roll sensitivity" |
||||||
|
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy." |
||||||
|
param: "MC_ROLL_TC" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Pitch sensitivity" |
||||||
|
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy." |
||||||
|
param: "MC_PITCH_TC" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Altitude control sensitivity" |
||||||
|
description: "Slide to the left to make altitude control smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive." |
||||||
|
param: "MPC_Z_FF" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Position control sensitivity" |
||||||
|
description: "Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive." |
||||||
|
param: "MPC_XY_FF" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
/*===================================================================== |
||||||
|
|
||||||
|
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.5 |
||||||
|
import QtQuick.Controls 1.4 |
||||||
|
|
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
|
||||||
|
FactSliderPanel { |
||||||
|
anchors.fill: parent |
||||||
|
|
||||||
|
sliderModel: ListModel { |
||||||
|
ListElement { |
||||||
|
title: "Roll sensitivity" |
||||||
|
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy." |
||||||
|
param: "FW_R_TC" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Pitch sensitivity" |
||||||
|
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy." |
||||||
|
param: "FW_P_TC" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Cruise throttle" |
||||||
|
description: "This is the throttle setting required to achieve the desired cruise speed." |
||||||
|
param: "FW_THR_CRUISE" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
|
||||||
|
ListElement { |
||||||
|
title: "Position control sensitivity" |
||||||
|
description: "Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive." |
||||||
|
param: "FW_L1_PERIOD" |
||||||
|
min: 0 |
||||||
|
max: 100 |
||||||
|
step: 1 |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,143 @@ |
|||||||
|
/*===================================================================== |
||||||
|
|
||||||
|
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.5 |
||||||
|
import QtQuick.Controls 1.4 |
||||||
|
|
||||||
|
import QGroundControl.FactSystem 1.0 |
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
|
||||||
|
QGCView { |
||||||
|
viewPanel: panel |
||||||
|
|
||||||
|
property string panelTitle: "Title" ///< Title for panel |
||||||
|
|
||||||
|
/// ListModel must contains elements which look like this: |
||||||
|
/// ListElement { |
||||||
|
/// title: "Roll sensitivity" |
||||||
|
/// description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy." |
||||||
|
/// param: "MC_ROLL_TC" |
||||||
|
/// min: 0 |
||||||
|
/// max: 100 |
||||||
|
/// step: 1 |
||||||
|
/// } |
||||||
|
property ListModel sliderModel |
||||||
|
|
||||||
|
FactPanelController { id: controller; factPanel: panel } |
||||||
|
|
||||||
|
QGCPalette { id: palette; colorGroupEnabled: enabled } |
||||||
|
property real _margins: ScreenTools.defaultFontPixelHeight |
||||||
|
|
||||||
|
property bool _loadComplete: false |
||||||
|
|
||||||
|
Component.onCompleted: { |
||||||
|
// Qml Sliders have a strange behavior in which they first set Slider::value to some internal |
||||||
|
// setting and then set Slider::value to the bound properties value. If you have an onValueChanged |
||||||
|
// handler which updates your property with the new value, this first value change will trash |
||||||
|
// your bound values. In order to work around this we don't set the values into the Sliders until |
||||||
|
// after Qml load is done. We also don't track value changes until Qml load completes. |
||||||
|
for (var i=0; i<sliderModel.count; i++) { |
||||||
|
sliderRepeater.itemAt(i).sliderValue = controller.getParameterFact(-1, sliderModel.get(i).param).value |
||||||
|
} |
||||||
|
_loadComplete = true |
||||||
|
} |
||||||
|
|
||||||
|
QGCViewPanel { |
||||||
|
id: panel |
||||||
|
anchors.fill: parent |
||||||
|
|
||||||
|
Flickable { |
||||||
|
clip: true |
||||||
|
anchors.fill: parent |
||||||
|
boundsBehavior: Flickable.StopAtBounds |
||||||
|
contentHeight: sliderRect.y + sliderRect.height |
||||||
|
flickableDirection: Flickable.VerticalFlick |
||||||
|
|
||||||
|
QGCLabel { |
||||||
|
id: panelLabel |
||||||
|
text: panelTitle |
||||||
|
font.weight: Font.DemiBold |
||||||
|
} |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
id: sliderRect |
||||||
|
anchors.topMargin: _margins / 2 |
||||||
|
anchors.left: parent.left |
||||||
|
anchors.right: parent.right |
||||||
|
anchors.top: panelLabel.bottom |
||||||
|
height: sliderColumns.y + sliderColumns.height + _margins |
||||||
|
color: palette.windowShade |
||||||
|
|
||||||
|
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 |
||||||
|
|
||||||
|
Column { |
||||||
|
anchors.left: parent.left |
||||||
|
anchors.right: parent.right |
||||||
|
|
||||||
|
property alias sliderValue: slider.value |
||||||
|
|
||||||
|
QGCLabel { |
||||||
|
text: title |
||||||
|
font.weight: Font.DemiBold |
||||||
|
} |
||||||
|
|
||||||
|
QGCLabel { |
||||||
|
text: description |
||||||
|
} |
||||||
|
|
||||||
|
Slider { |
||||||
|
id: slider |
||||||
|
anchors.left: parent.left |
||||||
|
anchors.right: parent.right |
||||||
|
minimumValue: min |
||||||
|
maximumValue: max |
||||||
|
stepSize: step |
||||||
|
tickmarksEnabled: true |
||||||
|
|
||||||
|
property Fact fact: controller.getParameterFact(-1, param) |
||||||
|
|
||||||
|
onValueChanged: { |
||||||
|
if (_loadComplete) { |
||||||
|
fact.value = value |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} // Column |
||||||
|
} // Repeater |
||||||
|
} // Column |
||||||
|
} // Rectangle |
||||||
|
} // Flickable |
||||||
|
} // QGCViewPanel |
||||||
|
} // QGCView |
Loading…
Reference in new issue