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. 73
      src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml
  7. 2
      src/FirmwarePlugin/PX4/PX4Resources.qrc

18
src/AutoPilotPlugins/PX4/PX4TuningComponent.cc

@ -12,25 +12,9 @@
#include "PX4AutoPilotPlugin.h" #include "PX4AutoPilotPlugin.h"
#include "AirframeComponent.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) PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: VehicleComponent(vehicle, autopilot, 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 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtCharts 2.2
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
SetupPage { SetupPage {
id: tuningPage id: tuningPage
@ -25,43 +21,7 @@ SetupPage {
Component { Component {
id: pageComponent id: pageComponent
Item { PX4TuningComponentCopterAll {
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
}
} }
} // Component - pageComponent } // Component - pageComponent
} // SetupPage } // SetupPage

57
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml

@ -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 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtCharts 2.2
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
SetupPage { SetupPage {
id: tuningPage id: tuningPage
@ -25,31 +21,7 @@ SetupPage {
Component { Component {
id: pageComponent id: pageComponent
Item { PX4TuningComponentPlaneAll {
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
}
} }
} // Component - pageComponent } // Component - pageComponent
} // SetupPage } // SetupPage

45
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml

@ -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
}
}

73
src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml

@ -12,6 +12,8 @@ import QtQuick 2.3
import QtQuick.Controls 1.2 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 { SetupPage {
id: tuningPage id: tuningPage
@ -20,64 +22,37 @@ SetupPage {
Component { Component {
id: pageComponent id: pageComponent
FactSliderPanel { Item {
width: availableWidth width: availableWidth
sliderModel: ListModel {
ListElement { FactPanelController {
title: qsTr("Plane Roll sensitivity") id: controller
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
} }
ListElement { QGCTabBar {
title: qsTr("Plane Pitch sensitivity") id: bar
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.") width: parent.width
param: "FW_P_TC" anchors.top: parent.top
min: 0.2
max: 0.8
step: 0.01
}
ListElement { QGCTabButton {
title: qsTr("Plane Cruise throttle") text: qsTr("Multirotor")
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 {
ListElement { text: qsTr("Fixedwing")
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
} }
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
} }
ListElement { property var pages: [
title: qsTr("Plane Mission mode sensitivity") "PX4TuningComponentCopterAll.qml",
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.") "PX4TuningComponentPlaneAll.qml"
param: "FW_L1_PERIOD" ]
min: 12
max: 50 Loader {
step: 0.5 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 @@
<file alias="PX4SimpleFlightModes.qml">../../AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml</file> <file alias="PX4SimpleFlightModes.qml">../../AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml</file>
<file alias="PX4FlightBehaviorCopter.qml">../../AutoPilotPlugins/PX4/PX4FlightBehaviorCopter.qml</file> <file alias="PX4FlightBehaviorCopter.qml">../../AutoPilotPlugins/PX4/PX4FlightBehaviorCopter.qml</file>
<file alias="PX4TuningComponentCopter.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopter.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="PX4TuningComponentCopterAttitude.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterAttitude.qml</file>
<file alias="PX4TuningComponentCopterRate.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml</file> <file alias="PX4TuningComponentCopterRate.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml</file>
<file alias="PX4TuningComponentCopterVelocity.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml</file> <file alias="PX4TuningComponentCopterVelocity.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml</file>
<file alias="PX4TuningComponentCopterPosition.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml</file> <file alias="PX4TuningComponentCopterPosition.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml</file>
<file alias="PX4TuningComponentPlane.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlane.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="PX4TuningComponentPlaneTECS.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml</file>
<file alias="PX4TuningComponentVTOL.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file> <file alias="PX4TuningComponentVTOL.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file>
<file alias="SafetyComponent.qml">../../AutoPilotPlugins/PX4/SafetyComponent.qml</file> <file alias="SafetyComponent.qml">../../AutoPilotPlugins/PX4/SafetyComponent.qml</file>

Loading…
Cancel
Save