Unverified Commit 5ad6fdf2 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6479 from DonLakeFlyer/FWLandingWork

Fixed Wing Landing Pattern: Visualize landing area
parents 11646eb7 c7ea53d4
...@@ -36,7 +36,8 @@ Item { ...@@ -36,7 +36,8 @@ Item {
readonly property int _flightPathIndex: 0 readonly property int _flightPathIndex: 0
readonly property int _loiterPointIndex: 1 readonly property int _loiterPointIndex: 1
readonly property int _loiterRadiusIndex: 2 readonly property int _loiterRadiusIndex: 2
readonly property int _landPointIndex: 3 readonly property int _landingAreaIndex: 3
readonly property int _landPointIndex: 4
function hideItemVisuals() { function hideItemVisuals() {
for (var i=0; i<_itemVisuals.length; i++) { for (var i=0; i<_itemVisuals.length; i++) {
...@@ -56,6 +57,9 @@ Item { ...@@ -56,6 +57,9 @@ Item {
itemVisual = loiterRadiusComponent.createObject(map) itemVisual = loiterRadiusComponent.createObject(map)
map.addMapItem(itemVisual) map.addMapItem(itemVisual)
_itemVisuals[_loiterRadiusIndex] = itemVisual _itemVisuals[_loiterRadiusIndex] = itemVisual
itemVisual = landingAreaComponent.createObject(map)
map.addMapItem(itemVisual)
_itemVisuals[_landingAreaIndex] = itemVisual
itemVisual = landPointComponent.createObject(map) itemVisual = landPointComponent.createObject(map)
map.addMapItem(itemVisual) map.addMapItem(itemVisual)
_itemVisuals[_landPointIndex] = itemVisual _itemVisuals[_landPointIndex] = itemVisual
...@@ -224,7 +228,6 @@ Item { ...@@ -224,7 +228,6 @@ Item {
} }
} }
// Loiter radius visual
Component { Component {
id: loiterRadiusComponent id: loiterRadiusComponent
...@@ -238,7 +241,6 @@ Item { ...@@ -238,7 +241,6 @@ Item {
} }
} }
// Land point
Component { Component {
id: landPointComponent id: landPointComponent
...@@ -258,4 +260,40 @@ Item { ...@@ -258,4 +260,40 @@ Item {
} }
} }
} }
Component {
id: landingAreaComponent
MapPolygon {
z: QGroundControl.zOrderMapItems
border.width: 1
border.color: "black"
color: "green"
opacity: 0.5
readonly property real landingWidth: 15
readonly property real landingLength: 100
readonly property real angleRadians: Math.atan((landingWidth / 2) / (landingLength / 2))
readonly property real angleDegrees: (angleRadians * (180 / Math.PI))
readonly property real hypotenuse: (landingWidth / 2) / Math.sin(angleRadians)
property real landingAreaAngle: _missionItem.landingCoordinate.azimuthTo(_missionItem.loiterTangentCoordinate)
function calcPoly() {
path = [ ]
addCoordinate(_missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, landingAreaAngle - angleDegrees))
addCoordinate(_missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, landingAreaAngle + angleDegrees))
addCoordinate(_missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, landingAreaAngle + (180 - angleDegrees)))
addCoordinate(_missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, landingAreaAngle - (180 - angleDegrees)))
}
Component.onCompleted: calcPoly()
Connections {
target: _missionItem
onLandingCoordinateChanged: calcPoly()
onLoiterTangentCoordinateChanged: calcPoly()
}
}
}
} }
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