Unverified Commit f4ccb45f authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6746 from DonLakeFlyer/FWLandingPosition

FW Landing Pattern: Allow set position/heading from vehicle
parents 3ba8aff7 71c503e4
...@@ -31,8 +31,12 @@ Rectangle { ...@@ -31,8 +31,12 @@ Rectangle {
//property real availableWidth ///< Width for control //property real availableWidth ///< Width for control
//property var missionItem ///< Mission Item for editor //property var missionItem ///< Mission Item for editor
property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _spacer: ScreenTools.defaultFontPixelWidth / 2 property real _spacer: ScreenTools.defaultFontPixelWidth / 2
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string _setToVehicleHeadingStr: qsTr("Set to vehicle heading")
property string _setToVehicleLocationStr: qsTr("Set to vehicle location")
ExclusiveGroup { id: distanceGlideGroup } ExclusiveGroup { id: distanceGlideGroup }
...@@ -45,34 +49,57 @@ Rectangle { ...@@ -45,34 +49,57 @@ Rectangle {
visible: missionItem.landingCoordSet visible: missionItem.landingCoordSet
SectionHeader { SectionHeader {
text: qsTr("Loiter point") id: loiterPointSection
text: qsTr("Loiter point")
} }
Item { width: 1; height: _spacer } Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: loiterPointSection.checked
FactTextFieldGrid { Item { width: 1; height: _spacer }
anchors.left: parent.left
anchors.right: parent.right
factList: [ missionItem.loiterAltitude, missionItem.loiterRadius ]
factLabels: [ qsTr("Altitude"), qsTr("Radius") ]
}
Item { width: 1; height: _spacer } FactTextFieldGrid {
anchors.left: parent.left
anchors.right: parent.right
factList: [ missionItem.loiterAltitude, missionItem.loiterRadius ]
factLabels: [ qsTr("Altitude"), qsTr("Radius") ]
}
QGCCheckBox { Item { width: 1; height: _spacer }
text: qsTr("Loiter clockwise")
checked: missionItem.loiterClockwise QGCCheckBox {
onClicked: missionItem.loiterClockwise = checked text: qsTr("Loiter clockwise")
checked: missionItem.loiterClockwise
onClicked: missionItem.loiterClockwise = checked
}
QGCButton {
text: _setToVehicleHeadingStr
visible: _activeVehicle
onClicked: missionItem.landingHeading.rawValue = _activeVehicle.heading.rawValue
}
} }
SectionHeader { text: qsTr("Landing point") } SectionHeader {
id: landingPointSection
text: qsTr("Landing point")
}
Item { width: 1; height: _spacer } Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: landingPointSection.checked
Item { width: 1; height: _spacer }
GridLayout { GridLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
columns: 2 columns: 2
QGCLabel { text: qsTr("Heading") } QGCLabel { text: qsTr("Heading") }
...@@ -88,34 +115,42 @@ Rectangle { ...@@ -88,34 +115,42 @@ Rectangle {
fact: missionItem.landingAltitude fact: missionItem.landingAltitude
} }
QGCRadioButton { QGCRadioButton {
id: specifyLandingDistance id: specifyLandingDistance
text: qsTr("Landing Dist") text: qsTr("Landing Dist")
checked: missionItem.valueSetIsDistance checked: missionItem.valueSetIsDistance
exclusiveGroup: distanceGlideGroup exclusiveGroup: distanceGlideGroup
onClicked: missionItem.valueSetIsDistance = checked onClicked: missionItem.valueSetIsDistance = checked
Layout.fillWidth: true Layout.fillWidth: true
} }
FactTextField { FactTextField {
fact: missionItem.landingDistance fact: missionItem.landingDistance
enabled: specifyLandingDistance.checked enabled: specifyLandingDistance.checked
Layout.fillWidth: true Layout.fillWidth: true
} }
QGCRadioButton { QGCRadioButton {
id: specifyGlideSlope id: specifyGlideSlope
text: qsTr("Glide Slope") text: qsTr("Glide Slope")
checked: !missionItem.valueSetIsDistance checked: !missionItem.valueSetIsDistance
exclusiveGroup: distanceGlideGroup exclusiveGroup: distanceGlideGroup
onClicked: missionItem.valueSetIsDistance = !checked onClicked: missionItem.valueSetIsDistance = !checked
Layout.fillWidth: true Layout.fillWidth: true
} }
FactTextField {
fact: missionItem.glideSlope
enabled: specifyGlideSlope.checked
Layout.fillWidth: true
}
FactTextField { QGCButton {
fact: missionItem.glideSlope text: _setToVehicleLocationStr
enabled: specifyGlideSlope.checked visible: _activeVehicle
Layout.fillWidth: true Layout.columnSpan: 2
onClicked: missionItem.landingCoordinate = _activeVehicle.coordinate
}
} }
} }
...@@ -140,10 +175,30 @@ Rectangle { ...@@ -140,10 +175,30 @@ Rectangle {
spacing: ScreenTools.defaultFontPixelHeight spacing: ScreenTools.defaultFontPixelHeight
QGCLabel { QGCLabel {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("Click in map to set landing point.") horizontalAlignment: Text.AlignHCenter
text: qsTr("Click in map to set landing point.")
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
text: qsTr("- or -")
visible: _activeVehicle
}
QGCButton {
anchors.horizontalCenter: parent.horizontalCenter
text: _setToVehicleLocationStr
visible: _activeVehicle
onClicked: {
missionItem.landingCoordinate = _activeVehicle.coordinate
missionItem.landingHeading.rawValue = _activeVehicle.heading.rawValue
}
} }
} }
} }
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