Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
25ca15d1
Commit
25ca15d1
authored
Mar 03, 2017
by
Don Gagne
Committed by
GitHub
Mar 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4703 from DonLakeFlyer/FWLandingMore
Fixed Wing Landing Pattern
parents
ce15cf06
b7d0add0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
14 deletions
+65
-14
FWLandingPatternMapVisual.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
+58
-7
FixedWingLandingComplexItem.cc
src/MissionManager/FixedWingLandingComplexItem.cc
+1
-1
MavCmdInfoCommon.json
src/MissionManager/MavCmdInfoCommon.json
+6
-6
No files found.
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
25ca15d1
...
@@ -26,6 +26,8 @@ Item {
...
@@ -26,6 +26,8 @@ Item {
property
var
_itemVisuals
:
[
]
property
var
_itemVisuals
:
[
]
property
var
_mouseArea
property
var
_mouseArea
property
var
_dragAreas
:
[
]
property
var
_dragAreas
:
[
]
property
var
_loiterTangentCoordinate
property
var
_flightPath
readonly
property
int
_flightPathIndex
:
0
readonly
property
int
_flightPathIndex
:
0
readonly
property
int
_loiterPointIndex
:
1
readonly
property
int
_loiterPointIndex
:
1
...
@@ -84,6 +86,49 @@ Item {
...
@@ -84,6 +86,49 @@ Item {
}
}
}
}
function
radiansToDegrees
(
radians
)
{
return
radians
*
(
180.0
/
Math
.
PI
)
}
function
calcPointTangentToCircleWithCenter
()
{
if
(
_missionItem
.
landingCoordSet
)
{
console
.
log
(
"
recalc
"
)
var
radius
=
_missionItem
.
loiterRadius
.
value
var
loiterPointPixels
=
map
.
fromCoordinate
(
_missionItem
.
loiterCoordinate
,
false
/* clipToViewport */
)
var
landPointPixels
=
map
.
fromCoordinate
(
_missionItem
.
landingCoordinate
,
false
/* clipToViewport */
)
var
dxHypotenuse
=
loiterPointPixels
.
x
-
landPointPixels
.
x
var
dyHypotenuse
=
loiterPointPixels
.
y
-
landPointPixels
.
y
var
oppositeLength
=
radius
var
hypotenuseLength
=
_missionItem
.
landingCoordinate
.
distanceTo
(
_missionItem
.
loiterCoordinate
)
var
adjacentLength
=
Math
.
sqrt
(
Math
.
pow
(
hypotenuseLength
,
2
)
-
Math
.
pow
(
oppositeLength
,
2
))
var
angleToCenterRadians
=
-
Math
.
atan2
(
dyHypotenuse
,
dxHypotenuse
)
var
angleCenterToTangentRadians
=
Math
.
asin
(
oppositeLength
/
hypotenuseLength
)
var
angleToTangentRadians
if
(
_missionItem
.
loiterClockwise
)
{
angleToTangentRadians
=
angleToCenterRadians
-
angleCenterToTangentRadians
}
else
{
angleToTangentRadians
=
angleToCenterRadians
+
angleCenterToTangentRadians
}
var
angleToTangentDegrees
=
(
radiansToDegrees
(
angleToTangentRadians
)
-
90
)
*
-
1
/*
Keep in for debugging for now
console.log("dxHypotenuse", dxHypotenuse)
console.log("dyHypotenuse", dyHypotenuse)
console.log("oppositeLength", oppositeLength)
console.log("hypotenuseLength", hypotenuseLength)
console.log("adjacentLength", adjacentLength)
console.log("angleCenterToTangentRadians", angleCenterToTangentRadians, radiansToDegrees(angleCenterToTangentRadians))
console.log("angleToCenterRadians", angleToCenterRadians, radiansToDegrees(angleToCenterRadians))
console.log("angleToTangentDegrees", angleToTangentDegrees)
*/
_loiterTangentCoordinate
=
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
adjacentLength
,
angleToTangentDegrees
)
_flightPath
=
[
_loiterTangentCoordinate
,
_missionItem
.
landingCoordinate
]
}
else
{
_flightPath
=
undefined
}
}
Component.onCompleted
:
{
Component.onCompleted
:
{
if
(
_missionItem
.
landingCoordSet
)
{
if
(
_missionItem
.
landingCoordSet
)
{
showItemVisuals
()
showItemVisuals
()
...
@@ -93,6 +138,7 @@ Item {
...
@@ -93,6 +138,7 @@ Item {
}
else
if
(
_missionItem
.
isCurrentItem
)
{
}
else
if
(
_missionItem
.
isCurrentItem
)
{
showMouseArea
()
showMouseArea
()
}
}
calcPointTangentToCircleWithCenter
()
}
}
Component
.
onDestruction
:
{
Component
.
onDestruction
:
{
...
@@ -126,7 +172,12 @@ Item {
...
@@ -126,7 +172,12 @@ Item {
hideDragAreas
()
hideDragAreas
()
showMouseArea
()
showMouseArea
()
}
}
calcPointTangentToCircleWithCenter
()
}
}
onLandingCoordinateChanged
:
calcPointTangentToCircleWithCenter
()
onLoiterCoordinateChanged
:
calcPointTangentToCircleWithCenter
()
onLoiterClockwiseChanged
:
calcPointTangentToCircleWithCenter
()
}
}
// Mouse area to capture landing point coordindate
// Mouse area to capture landing point coordindate
...
@@ -151,10 +202,10 @@ Item {
...
@@ -151,10 +202,10 @@ Item {
id
:
loiterDragAreaComponent
id
:
loiterDragAreaComponent
MissionItemIndicatorDrag
{
MissionItemIndicatorDrag
{
itemIndicator
:
_itemVisuals
[
_loiterPointIndex
]
itemIndicator
:
_itemVisuals
[
_loiterPointIndex
]
itemCoordinate
:
_missionItem
.
loiterCoordinate
itemCoordinate
:
_missionItem
.
loiterCoordinate
onItemCoordinateChanged
:
_missionItem
.
loiterCoordinate
=
itemCoordinate
onItemCoordinateChanged
:
_missionItem
.
loiterCoordinate
=
itemCoordinate
}
}
}
}
...
@@ -163,10 +214,10 @@ Item {
...
@@ -163,10 +214,10 @@ Item {
id
:
landDragAreaComponent
id
:
landDragAreaComponent
MissionItemIndicatorDrag
{
MissionItemIndicatorDrag
{
itemIndicator
:
_itemVisuals
[
_landPointIndex
]
itemIndicator
:
_itemVisuals
[
_landPointIndex
]
itemCoordinate
:
_missionItem
.
landingCoordinate
itemCoordinate
:
_missionItem
.
landingCoordinate
onItemCoordinateChanged
:
_missionItem
.
landingCoordinate
=
itemCoordinate
onItemCoordinateChanged
:
_missionItem
.
landingCoordinate
=
itemCoordinate
}
}
}
}
...
@@ -178,7 +229,7 @@ Item {
...
@@ -178,7 +229,7 @@ Item {
z
:
QGroundControl
.
zOrderMapItems
-
1
// Under item indicators
z
:
QGroundControl
.
zOrderMapItems
-
1
// Under item indicators
line.color
:
"
#be781c
"
line.color
:
"
#be781c
"
line.width
:
2
line.width
:
2
path
:
_
missionItem
.
landingCoordSet
?
[
_missionItem
.
loiterCoordinate
,
_missionItem
.
landingCoordinate
]
:
undefined
path
:
_
flightPath
}
}
}
}
...
...
src/MissionManager/FixedWingLandingComplexItem.cc
View file @
25ca15d1
...
@@ -155,7 +155,7 @@ QmlObjectListModel* FixedWingLandingComplexItem::getMissionItems(void) const
...
@@ -155,7 +155,7 @@ QmlObjectListModel* FixedWingLandingComplexItem::getMissionItems(void) const
1.0
,
// Heading required = true
1.0
,
// Heading required = true
loiterRadius
,
// Loiter radius
loiterRadius
,
// Loiter radius
0.0
,
// param 3 - unused
0.0
,
// param 3 - unused
0.0
,
// Exit crosstrack - center of way
point
1.0
,
// Exit crosstrack - tangent of loiter to land
point
_loiterCoordinate
.
latitude
(),
_loiterCoordinate
.
latitude
(),
_loiterCoordinate
.
longitude
(),
_loiterCoordinate
.
longitude
(),
_loiterAltitudeFact
.
rawValue
().
toDouble
(),
_loiterAltitudeFact
.
rawValue
().
toDouble
(),
...
...
src/MissionManager/MavCmdInfoCommon.json
View file @
25ca15d1
...
@@ -92,8 +92,8 @@
...
@@ -92,8 +92,8 @@
"decimalPlaces"
:
2
"decimalPlaces"
:
2
},
},
"param4"
:
{
"param4"
:
{
"label"
:
"
Next waypoint start
:"
,
"label"
:
"
Exit loiter from
:"
,
"enumStrings"
:
"Center,
On Loiter
"
,
"enumStrings"
:
"Center,
Tangent
"
,
"enumValues"
:
"0,1"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"default"
:
1
,
"decimalPlaces"
:
0
"decimalPlaces"
:
0
...
@@ -120,8 +120,8 @@
...
@@ -120,8 +120,8 @@
"decimalPlaces"
:
2
"decimalPlaces"
:
2
},
},
"param4"
:
{
"param4"
:
{
"label"
:
"
Next waypoint start
:"
,
"label"
:
"
Exit loiter from
:"
,
"enumStrings"
:
"Center,
On Loiter
"
,
"enumStrings"
:
"Center,
Tangent
"
,
"enumValues"
:
"0,1"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"default"
:
1
,
"decimalPlaces"
:
0
"decimalPlaces"
:
0
...
@@ -224,8 +224,8 @@
...
@@ -224,8 +224,8 @@
"decimalPlaces"
:
2
"decimalPlaces"
:
2
},
},
"param4"
:
{
"param4"
:
{
"label"
:
"
Next waypoint start
:"
,
"label"
:
"
Exit loiter from
:"
,
"enumStrings"
:
"Center,
On Loiter
"
,
"enumStrings"
:
"Center,
Tangent
"
,
"enumValues"
:
"0,1"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"default"
:
1
,
"decimalPlaces"
:
0
"decimalPlaces"
:
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment