Commit a4f8fbbe authored by Don Gagne's avatar Don Gagne

PX4 GeoFence support

parent 7a791d77
...@@ -87,7 +87,7 @@ QGCView { ...@@ -87,7 +87,7 @@ QGCView {
anchors.rightMargin: _margins anchors.rightMargin: _margins
anchors.left: parent.left anchors.left: parent.left
anchors.top: failsafeLabel.bottom anchors.top: failsafeLabel.bottom
width: throttleEnableCombo.x + throttleEnableCombo.x + _margins width: throttleEnableCombo.x + throttleEnableCombo.width + _margins
height: mahField.y + mahField.height + _margins height: mahField.y + mahField.height + _margins
color: palette.windowShade color: palette.windowShade
......
...@@ -35,16 +35,19 @@ import QGroundControl.ScreenTools 1.0 ...@@ -35,16 +35,19 @@ import QGroundControl.ScreenTools 1.0
QGCView { QGCView {
id: _safetyView id: _safetyView
viewPanel: panel viewPanel: panel
anchors.fill: parent anchors.fill: parent
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; factPanel: panel }
QGCPalette { id: palette; colorGroupEnabled: enabled } QGCPalette { id: palette; colorGroupEnabled: enabled }
property real firstColumnWidth: ScreenTools.defaultFontPixelWidth * 28 property real _margins: ScreenTools.defaultFontPixelHeight
property real secondColumnWidth: ScreenTools.defaultFontPixelWidth * 25
property Fact _fenceAction: controller.getParameterFact(-1, "GF_ACTION")
property Fact _fenceRadius: controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
property Fact _fenceAlt: controller.getParameterFact(-1, "GF_MAX_VER_DIST")
QGCViewPanel { QGCViewPanel {
id: panel id: panel
...@@ -53,205 +56,258 @@ QGCView { ...@@ -53,205 +56,258 @@ QGCView {
Flickable { Flickable {
clip: true clip: true
anchors.fill: parent anchors.fill: parent
contentHeight: safetyColumn.height contentHeight: 7000 //rtlSettings.height
contentWidth: parent.width contentWidth: parent.width
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
Column { QGCLabel {
id: safetyColumn id: triggerLabel
width: _safetyView.width text: "Triggers For Return Home"
font.weight: Font.DemiBold
//----------------------------------------------------------------- }
//-- Return Home Triggers
Rectangle {
QGCLabel { text: "Triggers For Return Home"; font.weight: Font.DemiBold; } id: triggerSettings
anchors.topMargin: _margins / 2
Item { height: ScreenTools.defaultFontPixelHeight * 0.5; width: 1 } // spacer anchors.rightMargin: _margins
anchors.left: parent.left
Rectangle { anchors.top: triggerLabel.bottom
width: parent.width anchors.bottom: geoFenceSettings.bottom
height: triggerColumn.height + ScreenTools.defaultFontPixelHeight width: telemetryLossField.x + telemetryLossField.width + (_margins * 2)
color: palette.windowShade color: palette.windowShade
Column {
id: triggerColumn QGCLabel {
width: parent.width text: "RC Transmitter Signal Loss: Return Home after"
spacing: ScreenTools.defaultFontPixelHeight * 0.5 anchors.margins: _margins
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.left: parent.left
anchors.left: parent.left anchors.baseline: rcLossField.baseline
Item { height: ScreenTools.defaultFontPixelHeight * 0.5; width: 1 } // spacer }
Row {
spacing: ScreenTools.defaultFontPixelWidth FactTextField {
QGCLabel { id: rcLossField
text: "RC Transmitter Signal Loss" anchors.topMargin: _margins
width: firstColumnWidth anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter anchors.left: telemetryLossField.left
} fact: controller.getParameterFact(-1, "COM_RC_LOSS_T")
QGCLabel { showUnits: true
text: "Return Home after" }
width: secondColumnWidth
anchors.verticalCenter: parent.verticalCenter FactCheckBox {
} id: telemetryTimeoutCheckbox
FactTextField { anchors.margins: _margins
id: rcLossField anchors.left: parent.left
fact: controller.getParameterFact(-1, "COM_RC_LOSS_T") anchors.baseline: telemetryLossField.baseline
showUnits: true fact: controller.getParameterFact(-1, "COM_DL_LOSS_EN")
anchors.verticalCenter: parent.verticalCenter checkedValue: 1
} uncheckedValue: 0
} text: "Telemetry Signal Timeout: Return Home after"
Row {
spacing: ScreenTools.defaultFontPixelWidth
FactCheckBox {
id: telemetryTimeoutCheckbox
width: firstColumnWidth
fact: controller.getParameterFact(-1, "COM_DL_LOSS_EN")
checkedValue: 1
uncheckedValue: 0
text: "Telemetry Signal Timeout"
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel {
text: "Return Home after"
width: secondColumnWidth
anchors.verticalCenter: parent.verticalCenter
}
FactTextField {
id: telemetryLossField
fact: controller.getParameterFact(-1, "COM_DL_LOSS_T")
showUnits: true
enabled: telemetryTimeoutCheckbox.checked
anchors.verticalCenter: parent.verticalCenter
}
}
Item { height: ScreenTools.defaultFontPixelHeight * 0.5; width: 1 } // spacer
}
} }
Item { height: ScreenTools.defaultFontPixelHeight; width: 1 } // spacer FactTextField {
id: telemetryLossField
//----------------------------------------------------------------- anchors.leftMargin: _margins
//-- Return Home Settings anchors.topMargin: _margins / 2
anchors.left: telemetryTimeoutCheckbox.right
QGCLabel { text: "Return Home Settings"; font.weight: Font.DemiBold; } anchors.top: rcLossField.bottom
fact: controller.getParameterFact(-1, "COM_DL_LOSS_T")
Item { height: ScreenTools.defaultFontPixelHeight * 0.5; width: 1 } // spacer showUnits: true
enabled: telemetryTimeoutCheckbox.checked
Rectangle {
width: parent.width
height: settingsRow.height
color: palette.windowShade
Row {
id: settingsRow
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
spacing: ScreenTools.defaultFontPixelWidth
Item {
width: firstColumnWidth
height: firstColumnWidth * 0.65
Image {
id: icon
width: parent.width * 0.75
height: width * 0.5
mipmap: true
fillMode: Image.PreserveAspectFit
visible: false
source: "/qmlimages/ReturnToHomeAltitude.svg"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
ColorOverlay {
id: iconOverlay
anchors.fill: icon
source: icon
color: palette.text
}
anchors.verticalCenter: parent.verticalCenter
}
Column {
width: parent.width - firstColumnWidth
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
Item { height: ScreenTools.defaultFontPixelHeight * 0.5; width: 1 } // spacer
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Climb to altitude of"
width: secondColumnWidth
anchors.verticalCenter: parent.verticalCenter
}
FactTextField {
id: climbField
fact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
showUnits: true
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCCheckBox {
id: homeLoiterCheckbox
width: secondColumnWidth
checked: fact.value > 0
text: "Loiter at Home altitude for"
anchors.verticalCenter: parent.verticalCenter
property Fact fact: controller.getParameterFact(-1, "RTL_LAND_DELAY")
onClicked: {
fact.value = checked ? 60 : -1
}
}
FactTextField {
id: landDelayField
fact: controller.getParameterFact(-1, "RTL_LAND_DELAY")
showUnits: true
enabled: homeLoiterCheckbox.checked === true
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Home loiter altitude";
color: palette.text;
enabled: homeLoiterCheckbox.checked === true
width: secondColumnWidth
anchors.verticalCenter: parent.verticalCenter
}
FactTextField {
id: descendField;
fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT")
enabled: homeLoiterCheckbox.checked === true
showUnits: true
anchors.verticalCenter: parent.verticalCenter
}
}
Item { height: ScreenTools.defaultFontPixelHeight; width: 1 } // spacer
}
}
} }
} // Rectangle - Trigger settings
QGCLabel {
id: geoFenceLabel
anchors.leftMargin: _margins
anchors.left: triggerSettings.right
anchors.top: parent.top
text: "GeoFence"
font.weight: Font.DemiBold
}
Rectangle {
id: geoFenceSettings
anchors.topMargin: _margins / 2
anchors.left: geoFenceLabel.left
anchors.top: geoFenceLabel.bottom
width: fenceActionCombo.x + fenceActionCombo.width + _margins
height: fenceAltMaxField.y + fenceAltMaxField.height + _margins
color: palette.windowShade
QGCLabel { QGCLabel {
width: parent.width id: fenceActionLabel
font.pixelSize: ScreenTools.mediumFontPixelSize anchors.margins: _margins
text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply."; anchors.left: parent.left
visible: fact.value !== 0 anchors.baseline: fenceActionCombo.baseline
wrapMode: Text.Wrap text: "Action on breach:"
}
property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC") FactComboBox {
id: fenceActionCombo
anchors.margins: _margins
anchors.left: fenceActionLabel.right
anchors.top: parent.top
width: fenceAltMaxField.width
model: [ "None", "Warning", "Loiter", "Return Home", "Flight termination" ]
fact: _fenceAction
}
QGCCheckBox {
id: fenceRadiusCheckBox
anchors.left: fenceActionLabel.left
anchors.baseline: fenceRadiusField.baseline
text: "Max radius:"
checked: _fenceRadius.value >= 0
onClicked: _fenceRadius.value = checked ? 100 : -1
}
FactTextField {
id: fenceRadiusField
anchors.topMargin: _margins
anchors.left: fenceActionCombo.left
anchors.top: fenceActionCombo.bottom
showUnits: true
fact: _fenceRadius
enabled: fenceRadiusCheckBox.checked
}
QGCCheckBox {
id: fenceAltMaxCheckBox
anchors.left: fenceActionLabel.left
anchors.baseline: fenceAltMaxField.baseline
text: "Max altitude:"
checked: _fenceAlt.value >= 0
onClicked: _fenceAlt.value = checked ? 100 : -1
}
FactTextField {
id: fenceAltMaxField
anchors.topMargin: _margins / 2
anchors.left: fenceActionCombo.left
anchors.top: fenceRadiusField.bottom
showUnits: true
fact: _fenceAlt
enabled: fenceAltMaxCheckBox.checked
}
} // Rectangle - GeoFence Settings
QGCLabel {
id: rtlLabel
anchors.topMargin: _margins
anchors.top: triggerSettings.bottom
text: "Return Home Settings"
font.weight: Font.DemiBold
}
Rectangle {
id: rtlSettings
anchors.topMargin: _margins / 2
anchors.left: parent.left
anchors.top: rtlLabel.bottom
width: landDelayField.x + landDelayField.width + _margins
height: descendField.y + descendField.height + _margins
color: palette.windowShade
Image {
id: icon
anchors.margins: _margins
anchors.left: parent.left
anchors.top: parent.top
height: ScreenTools.defaultFontPixelWidth * 10
width: ScreenTools.defaultFontPixelWidth * 20
mipmap: true
fillMode: Image.PreserveAspectFit
visible: false
source: "/qmlimages/ReturnToHomeAltitude.svg"
}
ColorOverlay {
anchors.fill: icon
source: icon
color: palette.text
}
QGCLabel {
id: climbLabel
anchors.margins: _margins
anchors.left: icon.right
anchors.baseline: climbField.baseline
text: "Climb to altitude of"
}
FactTextField {
id: climbField
anchors.topMargin: _margins
anchors.top: parent.top
anchors.left: landDelayField.left
fact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
showUnits: true
}
QGCCheckBox {
id: homeLoiterCheckbox
anchors.baseline: landDelayField.baseline
anchors.left: climbLabel.left
checked: fact.value > 0
text: "Loiter at Home altitude for"
property Fact fact: controller.getParameterFact(-1, "RTL_LAND_DELAY")
onClicked: fact.value = checked ? 60 : -1
}
FactTextField {
id: landDelayField
anchors.margins: _margins
anchors.left: homeLoiterCheckbox.right
anchors.top: climbField.bottom
fact: controller.getParameterFact(-1, "RTL_LAND_DELAY")
showUnits: true
enabled: homeLoiterCheckbox.checked === true
} }
QGCLabel { QGCLabel {
width: parent.width text: "Home loiter altitude"
font.pixelSize: ScreenTools.mediumFontPixelSize anchors.baseline: descendField.baseline
text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply."; anchors.left: climbLabel.left
visible: fact.value !== 0 color: palette.text
wrapMode: Text.Wrap enabled: homeLoiterCheckbox.checked === true
}
property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC") FactTextField {
id: descendField
anchors.topMargin: _margins
anchors.left: landDelayField.left
anchors.top: landDelayField.bottom
fact: controller.getParameterFact(-1, "RTL_DESCEND_ALT")
enabled: homeLoiterCheckbox.checked === true
showUnits: true
} }
} }
}
} /*
} QGCLabel {
width: parent.width
font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.";
visible: fact.value !== 0
wrapMode: Text.Wrap
property Fact fact: controller.getParameterFact(-1, "NAV_RCL_OBC")
}
QGCLabel {
width: parent.width
font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.";
visible: fact.value !== 0
wrapMode: Text.Wrap
property Fact fact: controller.getParameterFact(-1, "NAV_DLL_OBC")
}
*/
} // Flickable
} // QGCViewPanel
} // QGCView
...@@ -176,9 +176,11 @@ ...@@ -176,9 +176,11 @@
1 50 FW_YR_IMAX 0.2 9 1 50 FW_YR_IMAX 0.2 9
1 50 FW_YR_P 0.05 9 1 50 FW_YR_P 0.05 9
1 50 FW_Y_RMAX 0 9 1 50 FW_Y_RMAX 0 9
1 50 GF_ACTION 1 6
1 50 GF_ALTMODE 0 6 1 50 GF_ALTMODE 0 6
1 50 GF_COUNT -1 6 1 50 GF_COUNT -1 6
1 50 GF_ON 1 6 1 50 GF_MAX_HOR_DIST -1 6
1 50 GF_MAX_VER_DIST -1 6
1 50 GF_SOURCE 0 6 1 50 GF_SOURCE 0 6
1 50 INAV_DELAY_GPS 0.2 9 1 50 INAV_DELAY_GPS 0.2 9
1 50 INAV_ENABLED 0 6 1 50 INAV_ENABLED 0 6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment