Browse Source

pid tuning: add page for FW TECS tuning

QGC4.4
Beat Küng 4 years ago committed by Lorenz Meier
parent
commit
2df2689a85
  1. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponent.cc
  2. 60
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml
  3. 56
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml
  4. 1
      src/FirmwarePlugin/PX4/PX4Resources.qrc
  5. 1
      src/QmlControls/PIDTuning.qml

5
src/AutoPilotPlugins/PX4/PX4TuningComponent.cc

@ -12,8 +12,9 @@ @@ -12,8 +12,9 @@
#include "PX4AutoPilotPlugin.h"
#include "AirframeComponent.h"
static bool isCopter(MAV_TYPE type) {
static bool isCopterOrFW(MAV_TYPE type) {
switch (type) {
case MAV_TYPE_FIXED_WING:
case MAV_TYPE_QUADROTOR:
case MAV_TYPE_COAXIAL:
case MAV_TYPE_HELICOPTER:
@ -29,7 +30,7 @@ static bool isCopter(MAV_TYPE type) { @@ -29,7 +30,7 @@ static bool isCopter(MAV_TYPE type) {
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: VehicleComponent(vehicle, autopilot, parent)
, _name(isCopter(vehicle->vehicleType()) ? tr("PID Tuning") : tr("Tuning"))
, _name(isCopterOrFW(vehicle->vehicleType()) ? tr("PID Tuning") : tr("Tuning"))
{
}

60
src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml

@ -25,61 +25,31 @@ SetupPage { @@ -25,61 +25,31 @@ SetupPage {
Component {
id: pageComponent
Column {
Item {
width: availableWidth
Component.onCompleted: {
// We use QtCharts only on Desktop platforms
showAdvanced = !ScreenTools.isMobile
}
FactPanelController {
id: controller
}
// Standard tuning page
FactSliderPanel {
width: availableWidth
visible: !advanced
sliderModel: ListModel {
ListElement {
title: qsTr("Cruise throttle")
description: qsTr("This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%.")
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
QGCTabButton {
text: qsTr("TECS")
}
}
property var pages: [
"PX4TuningComponentPlaneTECS.qml",
]
Loader {
anchors.left: parent.left
anchors.right: parent.right
sourceComponent: advanced ? advancePageComponent : undefined
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
}
Component {
id: advancePageComponent
PIDTuning {
anchors.left: parent.left
anchors.right: parent.right
tuneList: [ qsTr("Roll"), qsTr("Pitch"), qsTr("Yaw") ]
params: [
[ controller.getParameterFact(-1, "FW_RR_P"),
controller.getParameterFact(-1, "FW_RR_I"),
controller.getParameterFact(-1, "FW_RR_FF"),
controller.getParameterFact(-1, "FW_R_TC"),],
[ controller.getParameterFact(-1, "FW_PR_P"),
controller.getParameterFact(-1, "FW_PR_I"),
controller.getParameterFact(-1, "FW_PR_FF"),
controller.getParameterFact(-1, "FW_P_TC") ],
[ controller.getParameterFact(-1, "FW_YR_P"),
controller.getParameterFact(-1, "FW_YR_I"),
controller.getParameterFact(-1, "FW_YR_FF") ] ]
}
} // Component - Advanced Page
} // Column
}
} // Component - pageComponent
} // SetupPage

56
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
/****************************************************************************
*
* (c) 2021 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
width: availableWidth
PIDTuning {
width: availableWidth
property var data: QtObject {
property string name: qsTr("Altitude & Airspeed")
property var plot: [
{ name: "Airspeed", value: globals.activeVehicle.airSpeed.value },
{ name: "Airspeed Setpoint", value: globals.activeVehicle.airSpeedSetpoint.value },
{ name: "Altitide (Rel)", value: globals.activeVehicle.altitudeTuning.value },
{ name: "Altitude Setpoint", value: globals.activeVehicle.altitudeTuningSetpoint.value }
]
property var params: ListModel {
ListElement {
title: qsTr("Height rate feed forward (FW_T_HRATE_FF)")
description: qsTr("TODO")
param: "FW_T_HRATE_FF"
min: 0
max: 1
step: 0.05
}
}
// TODO: add other params
}
anchors.left: parent.left
anchors.right: parent.right
title: "TECS"
tuningMode: Vehicle.ModeAltitudeAndAirspeed
unit: ""
axis: [ data ]
}
}

1
src/FirmwarePlugin/PX4/PX4Resources.qrc

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
<file alias="PX4TuningComponentCopterRate.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml</file>
<file alias="PX4TuningComponentCopterVelocity.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml</file>
<file alias="PX4TuningComponentPlane.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml</file>
<file alias="PX4TuningComponentPlaneTECS.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml</file>
<file alias="PX4TuningComponentVTOL.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file>
<file alias="SafetyComponent.qml">../../AutoPilotPlugins/PX4/SafetyComponent.qml</file>
<file alias="SafetyComponentSummary.qml">../../AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>

1
src/QmlControls/PIDTuning.qml

@ -167,6 +167,7 @@ RowLayout { @@ -167,6 +167,7 @@ RowLayout {
RowLayout {
spacing: _margins
visible: axis.length > 1
QGCLabel { text: qsTr("Select Tuning:") }

Loading…
Cancel
Save