Skip to content

Commit

Permalink
Update to include GeoFence settings
Browse files Browse the repository at this point in the history
Removed more obscure settings
  • Loading branch information
DonLakeFlyer committed Jan 5, 2025
1 parent c812165 commit 72c1f6c
Showing 1 changed file with 30 additions and 91 deletions.
121 changes: 30 additions & 91 deletions src/FirmwarePlugin/PX4/PX4FlightModeIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ FlightModeIndicator {
property var qgcPal: QGroundControl.globalPalette
property real margins: ScreenTools.defaultFontPixelHeight
property real sliderWidth: ScreenTools.defaultFontPixelWidth * 40
property var flyViewSettings: QGroundControl.settingsManager.flyViewSettings

FactPanelController { id: controller }

Expand Down Expand Up @@ -62,132 +63,70 @@ FlightModeIndicator {

SettingsGroupLayout {
Layout.fillWidth: true
visible: sys_vehicle_resp
heading: qsTr("GeoFence")

ColumnLayout {
Layout.fillWidth: true

QGCCheckBoxSlider {
id: responsivenessCheckBox
Layout.fillWidth: true
text: qsTr("Overall Responsiveness")
checked: sys_vehicle_resp && sys_vehicle_resp.value >= 0

onClicked: {
if (checked) {
sys_vehicle_resp.value = Math.abs(sys_vehicle_resp.value)
} else {
sys_vehicle_resp.value = -Math.abs(sys_vehicle_resp.value)
}
}
}

FactSlider {
Layout.fillWidth: true
enabled: responsivenessCheckBox.checked
fact: sys_vehicle_resp
from: 0.01
to: 1
majorTickStepSize: 0.1
}

QGCLabel {
Layout.preferredWidth: sliderWidth
enabled: responsivenessCheckBox.checked
text: qsTr("A higher value makes the vehicle react faster. Be aware that this affects braking as well, and a combination of slow responsiveness with high maximum velocity will lead to long braking distances.")
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
}
QGCLabel {
Layout.preferredWidth: sliderWidth
color: qgcPal.warningText
text: qsTr("Warning: a high responsiveness requires a vehicle with large thrust-to-weight ratio. The vehicle might lose altitude otherwise.")
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
visible: sys_vehicle_resp && sys_vehicle_resp.value > 0.8
}
LabelledFactComboBox {
Layout.fillWidth: true
label: qsTr("Breach Action")
fact: controller.getParameterFact(-1, "GF_ACTION")
}

ColumnLayout {
Layout.fillWidth: true
visible: mpc_xy_vel_all

QGCCheckBoxSlider {
id: xyVelCheckBox
Layout.fillWidth: true
text: qsTr("Overall Horizontal Velocity (m/s)")
checked: mpc_xy_vel_all && mpc_xy_vel_all.value >= 0
text: qsTr("Max Distance")
checked: maxDistanceSlider.value > 0

onClicked: {
if (checked) {
mpc_xy_vel_all.value = Math.abs(mpc_xy_vel_all.value)
maxDistanceSlider.setValue(prevValue != 0 ? prevValue : maxDistanceSlider.to)
} else {
mpc_xy_vel_all.value = -Math.abs(mpc_xy_vel_all.value)
prevValue = maxDistanceSlider.value
maxDistanceSlider.setValue(0)
}
}

property real prevValue: 0
}

FactSlider {
id: maxDistanceSlider
Layout.fillWidth: true
enabled: xyVelCheckBox.checked
fact: mpc_xy_vel_all
from: 0.5
to: 20
majorTickStepSize: 0.5
fact: controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
to: flyViewSettings.maxGoToLocationDistance.value
majorTickStepSize: 500
enabled: fact.value > 0
}
}

ColumnLayout {
Layout.fillWidth: true
visible: mpc_z_vel_all

QGCCheckBoxSlider {
id: zVelCheckBox
Layout.fillWidth: true
text: qsTr("Overall Vertical Velocity (m/s)")
checked: mpc_z_vel_all && mpc_z_vel_all.value >= 0
text: qsTr("Max Altitude")
checked: maxAltitudeSlider.value > 0

onClicked: {
if (checked) {
mpc_z_vel_all.value = Math.abs(mpc_z_vel_all.value)
maxAltitudeSlider.setValue(prevValue != 0 ? prevValue : maxAltitudeSlider.to)
} else {
mpc_z_vel_all.value = -Math.abs(mpc_z_vel_all.value)
prevValue = maxAltitudeSlider.value
maxAltitudeSlider.setValue(0)
}
}

property real prevValue: 0
}

FactSlider {
id: maxAltitudeSlider
Layout.fillWidth: true
enabled: zVelCheckBox.checked
fact: mpc_z_vel_all
from: 0.2
to: 8
majorTickStepSize: 0.5
fact: controller.getParameterFact(-1, "GF_MAX_VER_DIST")
to: flyViewSettings.guidedMaximumAltitude.value
majorTickStepSize: 10
enabled: fact.value > 0
}
}
}

SettingsGroupLayout {
Layout.fillWidth: true
showDividers: false

FactSlider {
Layout.fillWidth: true
label: qsTr("Mission Turning Radius")
fact: controller.getParameterFact(-1, "NAV_ACC_RAD")
from: 2
to: 16
majorTickStepSize: 2
}

QGCLabel {
Layout.fillWidth: true
Layout.preferredWidth: sliderWidth
text: qsTr("Increasing this leads to rounder turns in missions (corner cutting). Use the minimum value for accurate corner tracking.")
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
}
}
}
}
}

0 comments on commit 72c1f6c

Please sign in to comment.