Browse Source

pid tuning: fix layouting

- use correct available height for chart (fill height)
- show scrollbar if param list overflows the window size
QGC4.4
Beat Küng 4 years ago committed by Lorenz Meier
parent
commit
6b5db72a54
  1. 1
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml
  2. 1
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml
  3. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAttitude.qml
  4. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml
  5. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml
  6. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml
  7. 1
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml
  8. 1
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml
  9. 5
      src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml
  10. 2
      src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml
  11. 124
      src/QmlControls/PIDTuning.qml

1
src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml

@ -22,6 +22,7 @@ SetupPage { @@ -22,6 +22,7 @@ SetupPage {
id: pageComponent
PX4TuningComponentCopterAll {
height: availableHeight
}
} // Component - pageComponent
} // SetupPage

1
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml

@ -53,5 +53,6 @@ Item { @@ -53,5 +53,6 @@ Item {
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
anchors.bottom: parent.bottom
}
}

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAttitude.qml

@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0 @@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
ColumnLayout {
width: availableWidth
anchors.fill: parent
PIDTuning {
width: availableWidth
@ -75,8 +76,6 @@ Column { @@ -75,8 +76,6 @@ Column {
}
}
}
anchors.left: parent.left
anchors.right: parent.right
title: "Attitude"
tuningMode: Vehicle.ModeRateAndAttitude
unit: "deg"

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml

@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0 @@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
ColumnLayout {
width: availableWidth
anchors.fill: parent
property Fact _mcPosMode: controller.getParameterFact(-1, "MPC_POS_MODE", false)
GridLayout {
@ -73,8 +74,6 @@ Column { @@ -73,8 +74,6 @@ Column {
}
}
}
anchors.left: parent.left
anchors.right: parent.right
title: "Position"
tuningMode: Vehicle.ModeVelocityAndPosition
unit: "m"

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml

@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0 @@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
ColumnLayout {
width: availableWidth
anchors.fill: parent
property Fact _airmode: controller.getParameterFact(-1, "MC_AIRMODE", false)
property Fact _thrustModelFactor: controller.getParameterFact(-1, "THR_MDL_FAC", false)
@ -143,8 +144,6 @@ Column { @@ -143,8 +144,6 @@ Column {
}
}
}
anchors.left: parent.left
anchors.right: parent.right
title: "Rate"
tuningMode: Vehicle.ModeRateAndAttitude
unit: "deg/s"

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml

@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0 @@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
ColumnLayout {
width: availableWidth
anchors.fill: parent
property Fact _mcPosMode: controller.getParameterFact(-1, "MPC_POS_MODE", false)
GridLayout {
@ -105,8 +106,6 @@ Column { @@ -105,8 +106,6 @@ Column {
}
}
}
anchors.left: parent.left
anchors.right: parent.right
title: "Velocity"
tuningMode: Vehicle.ModeVelocityAndPosition
unit: "m/s"

1
src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml

@ -22,6 +22,7 @@ SetupPage { @@ -22,6 +22,7 @@ SetupPage {
id: pageComponent
PX4TuningComponentPlaneAll {
height: availableHeight
}
} // Component - pageComponent
} // SetupPage

1
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml

@ -41,5 +41,6 @@ Item { @@ -41,5 +41,6 @@ Item {
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
anchors.bottom: parent.bottom
}
}

5
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml

@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0 @@ -18,8 +18,9 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
Column {
ColumnLayout {
width: availableWidth
anchors.fill: parent
PIDTuning {
width: availableWidth
@ -43,8 +44,6 @@ Column { @@ -43,8 +44,6 @@ Column {
}
// TODO: add other params
}
anchors.left: parent.left
anchors.right: parent.right
title: "TECS"
tuningMode: Vehicle.ModeAltitudeAndAirspeed
unit: ""

2
src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml

@ -24,6 +24,7 @@ SetupPage { @@ -24,6 +24,7 @@ SetupPage {
Item {
width: availableWidth
height: availableHeight
FactPanelController {
id: controller
@ -52,6 +53,7 @@ SetupPage { @@ -52,6 +53,7 @@ SetupPage {
width: parent.width
anchors.top: bar.bottom
anchors.topMargin: ScreenTools.defaultFontPixelWidth
anchors.bottom: parent.bottom
}
}
} // Component - pageComponent

124
src/QmlControls/PIDTuning.qml

@ -165,92 +165,98 @@ RowLayout { @@ -165,92 +165,98 @@ RowLayout {
property int _maxPointCount: 10000 / interval
}
Column {
spacing: _margins
Layout.alignment: Qt.AlignTop
width: parent.width * (_showCharts ? 0.4 : 1)
QGCFlickable {
contentWidth: parent.width * (_showCharts ? 0.4 : 1)
contentHeight: rightColumn.height
Layout.fillHeight: true
Layout.minimumWidth: contentWidth
Layout.maximumWidth: contentWidth
Layout.alignment: Qt.AlignTop
Column {
RowLayout {
spacing: _margins
visible: axis.length > 1
QGCLabel { text: qsTr("Select Tuning:") }
Repeater {
model: axis
QGCRadioButton {
text: modelData.name
checked: index == _currentAxis
onClicked: _currentAxis = index
spacing: _margins
Layout.alignment: Qt.AlignTop
width: parent.width
id: rightColumn
Column {
RowLayout {
spacing: _margins
visible: axis.length > 1
QGCLabel { text: qsTr("Select Tuning:") }
Repeater {
model: axis
QGCRadioButton {
text: modelData.name
checked: index == _currentAxis
onClicked: _currentAxis = index
}
}
}
}
}
// Instantiate all sliders (instead of switching the model), so that
// values are not changed unexpectedly if they do not match with a tick
// value
Repeater {
model: axis
FactSliderPanel {
width: parent.width
visible: _currentAxis === index
sliderModel: axis[index].params
// Instantiate all sliders (instead of switching the model), so that
// values are not changed unexpectedly if they do not match with a tick
// value
Repeater {
model: axis
FactSliderPanel {
width: parent.width
visible: _currentAxis === index
sliderModel: axis[index].params
}
}
}
Column {
QGCLabel { text: qsTr("Clipboard Values:") }
Column {
QGCLabel { text: qsTr("Clipboard Values:") }
GridLayout {
rows: savedRepeater.model.length
flow: GridLayout.TopToBottom
rowSpacing: 0
columnSpacing: _margins
GridLayout {
rows: savedRepeater.model.length
flow: GridLayout.TopToBottom
rowSpacing: 0
columnSpacing: _margins
Repeater {
model: axis[_currentAxis].params
Repeater {
model: axis[_currentAxis].params
QGCLabel { text: param }
}
QGCLabel { text: param }
}
Repeater {
id: savedRepeater
Repeater {
id: savedRepeater
QGCLabel { text: modelData }
QGCLabel { text: modelData }
}
}
}
}
RowLayout {
spacing: _margins
RowLayout {
spacing: _margins
QGCButton {
text: qsTr("Save To Clipboard")
onClicked: saveTuningParamValues()
}
QGCButton {
text: qsTr("Save To Clipboard")
onClicked: saveTuningParamValues()
}
QGCButton {
text: qsTr("Restore From Clipboard")
onClicked: resetToSavedTuningParamValues()
QGCButton {
text: qsTr("Restore From Clipboard")
onClicked: resetToSavedTuningParamValues()
}
}
}
}
Column {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
ColumnLayout {
visible: _showCharts
ChartView {
id: chart
anchors.left: parent.left
anchors.right: parent.right
height: availableHeight * 0.75
antialiasing: true
legend.alignment: Qt.AlignBottom
Layout.fillHeight: true
Layout.fillWidth: true
// enable mouse dragging
MouseArea {

Loading…
Cancel
Save