Browse Source

pid tuning: add vtol

QGC4.4
Beat Küng 4 years ago committed by Lorenz Meier
parent
commit
dcd64a5c45
  1. 18
      src/AutoPilotPlugins/PX4/PX4TuningComponent.cc
  2. 42
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml
  3. 57
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml
  4. 30
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml
  5. 45
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml
  6. 79
      src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml
  7. 2
      src/FirmwarePlugin/PX4/PX4Resources.qrc

18
src/AutoPilotPlugins/PX4/PX4TuningComponent.cc

@ -12,25 +12,9 @@ @@ -12,25 +12,9 @@
#include "PX4AutoPilotPlugin.h"
#include "AirframeComponent.h"
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:
case MAV_TYPE_HEXAROTOR:
case MAV_TYPE_OCTOROTOR:
case MAV_TYPE_TRICOPTER:
return true;
default:
break;
}
return false;
}
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: VehicleComponent(vehicle, autopilot, parent)
, _name(isCopterOrFW(vehicle->vehicleType()) ? tr("PID Tuning") : tr("Tuning"))
, _name(tr("PID Tuning"))
{
}

42
src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml

@ -9,14 +9,10 @@ @@ -9,14 +9,10 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtCharts 2.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
SetupPage {
id: tuningPage
@ -25,43 +21,7 @@ SetupPage { @@ -25,43 +21,7 @@ SetupPage {
Component {
id: pageComponent
Item {
width: availableWidth
FactPanelController {
id: controller
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
QGCTabButton {
text: qsTr("Rate Controller")
}
QGCTabButton {
text: qsTr("Attitude Controller")
}
QGCTabButton {
text: qsTr("Velocity Controller")
}
QGCTabButton {
text: qsTr("Position Controller")
}
}
property var pages: [
"PX4TuningComponentCopterRate.qml",
"PX4TuningComponentCopterAttitude.qml",
"PX4TuningComponentCopterVelocity.qml",
"PX4TuningComponentCopterPosition.qml"
]
Loader {
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
}
PX4TuningComponentCopterAll {
}
} // Component - pageComponent
} // SetupPage

57
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
/****************************************************************************
*
* (c) 2009-2020 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.ScreenTools 1.0
Item {
width: availableWidth
FactPanelController {
id: controller
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
QGCTabButton {
text: qsTr("Rate Controller")
}
QGCTabButton {
text: qsTr("Attitude Controller")
}
QGCTabButton {
text: qsTr("Velocity Controller")
}
QGCTabButton {
text: qsTr("Position Controller")
}
}
property var pages: [
"PX4TuningComponentCopterRate.qml",
"PX4TuningComponentCopterAttitude.qml",
"PX4TuningComponentCopterVelocity.qml",
"PX4TuningComponentCopterPosition.qml"
]
Loader {
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
}
}

30
src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml

@ -9,14 +9,10 @@ @@ -9,14 +9,10 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtCharts 2.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
SetupPage {
id: tuningPage
@ -25,31 +21,7 @@ SetupPage { @@ -25,31 +21,7 @@ SetupPage {
Component {
id: pageComponent
Item {
width: availableWidth
FactPanelController {
id: controller
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
QGCTabButton {
text: qsTr("TECS")
}
}
property var pages: [
"PX4TuningComponentPlaneTECS.qml",
]
Loader {
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
}
PX4TuningComponentPlaneAll {
}
} // Component - pageComponent
} // SetupPage

45
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
/****************************************************************************
*
* (c) 2009-2020 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.ScreenTools 1.0
Item {
width: availableWidth
FactPanelController {
id: controller
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
QGCTabButton {
text: qsTr("TECS")
}
}
property var pages: [
"PX4TuningComponentPlaneTECS.qml",
]
Loader {
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
}
}

79
src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml

@ -11,7 +11,9 @@ @@ -11,7 +11,9 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.Controls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.ScreenTools 1.0
SetupPage {
id: tuningPage
@ -20,64 +22,37 @@ SetupPage { @@ -20,64 +22,37 @@ SetupPage {
Component {
id: pageComponent
FactSliderPanel {
width: availableWidth
sliderModel: ListModel {
Item {
width: availableWidth
ListElement {
title: qsTr("Plane Roll sensitivity")
description: qsTr("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.2
max: 0.8
step: 0.01
}
FactPanelController {
id: controller
}
ListElement {
title: qsTr("Plane Pitch sensitivity")
description: qsTr("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.2
max: 0.8
step: 0.01
}
QGCTabBar {
id: bar
width: parent.width
anchors.top: parent.top
ListElement {
title: qsTr("Plane 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
QGCTabButton {
text: qsTr("Multirotor")
}
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
QGCTabButton {
text: qsTr("Fixedwing")
}
}
ListElement {
title: qsTr("Hover manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
property var pages: [
"PX4TuningComponentCopterAll.qml",
"PX4TuningComponentPlaneAll.qml"
]
ListElement {
title: qsTr("Plane Mission mode sensitivity")
description: qsTr("Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy.")
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
}
Loader {
source: pages[bar.currentIndex]
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
}
}
}
} // Component - pageComponent
}

2
src/FirmwarePlugin/PX4/PX4Resources.qrc

@ -13,11 +13,13 @@ @@ -13,11 +13,13 @@
<file alias="PX4SimpleFlightModes.qml">../../AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml</file>
<file alias="PX4FlightBehaviorCopter.qml">../../AutoPilotPlugins/PX4/PX4FlightBehaviorCopter.qml</file>
<file alias="PX4TuningComponentCopter.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml</file>
<file alias="PX4TuningComponentCopterAll.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml</file>
<file alias="PX4TuningComponentCopterAttitude.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterAttitude.qml</file>
<file alias="PX4TuningComponentCopterRate.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml</file>
<file alias="PX4TuningComponentCopterVelocity.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml</file>
<file alias="PX4TuningComponentCopterPosition.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml</file>
<file alias="PX4TuningComponentPlane.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml</file>
<file alias="PX4TuningComponentPlaneAll.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.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>

Loading…
Cancel
Save