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 {
id: pageComponent id: pageComponent
PX4TuningComponentCopterAll { PX4TuningComponentCopterAll {
height: availableHeight
} }
} // Component - pageComponent } // Component - pageComponent
} // SetupPage } // SetupPage

1
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAll.qml

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

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterAttitude.qml

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

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterPosition.qml

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

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterRate.qml

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

5
src/AutoPilotPlugins/PX4/PX4TuningComponentCopterVelocity.qml

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

1
src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml

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

1
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneAll.qml

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

5
src/AutoPilotPlugins/PX4/PX4TuningComponentPlaneTECS.qml

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

2
src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml

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

124
src/QmlControls/PIDTuning.qml

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

Loading…
Cancel
Save