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
8f878ced
Commit
8f878ced
authored
Feb 26, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on visuals
parent
b1686c1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
51 deletions
+71
-51
FWLandingPatternEditor.qml
src/MissionEditor/FWLandingPatternEditor.qml
+15
-3
FWLandingPatternMapVisual.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
+47
-45
FWLandingPattern.FactMetaData.json
src/MissionManager/FWLandingPattern.FactMetaData.json
+3
-1
FixedWingLandingComplexItem.cc
src/MissionManager/FixedWingLandingComplexItem.cc
+6
-2
No files found.
src/MissionEditor/FWLandingPatternEditor.qml
View file @
8f878ced
...
@@ -46,7 +46,7 @@ Rectangle {
...
@@ -46,7 +46,7 @@ Rectangle {
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
wrapMode
:
Text
.
WordWrap
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.pointSize
:
ScreenTools
.
smallFontPointSize
text
:
"
WIP (NOT FOR REAL FLIGHT!)
"
text
:
qsTr
(
"
WIP (NOT FOR REAL FLIGHT!)
"
)
}
}
Item
{
width
:
1
;
height
:
_margin
}
Item
{
width
:
1
;
height
:
_margin
}
...
@@ -122,9 +122,21 @@ Rectangle {
...
@@ -122,9 +122,21 @@ Rectangle {
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
visible
:
!
missionItem
.
landingCoordSet
visible
:
!
missionItem
.
landingCoordSet
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
text
:
"
WIP (NOT FOR REAL FLIGHT!)
"
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
font.pointSize
:
ScreenTools
.
smallFontPointSize
text
:
qsTr
(
"
WIP (NOT FOR REAL FLIGHT!)
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Click in map to set landing point.
"
)
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Click in map to set landing point.
"
)
}
}
}
}
}
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
8f878ced
...
@@ -22,40 +22,36 @@ Item {
...
@@ -22,40 +22,36 @@ Item {
property
var
map
///< Map control to place item in
property
var
map
///< Map control to place item in
property
var
_missionItem
:
object
property
var
_missionItem
:
object
property
var
_itemVisuals
:
[
]
property
var
_mouseArea
property
var
_mouseArea
property
var
_dragLoiter
property
var
_dragAreas
:
[
]
property
var
_dragLand
property
var
_loiterPoint
readonly
property
int
_flightPathIndex
:
0
property
var
_landPoint
readonly
property
int
_loiterPointIndex
:
1
property
var
_flightPath
readonly
property
int
_loiterRadiusIndex
:
2
readonly
property
int
_landPointIndex
:
3
function
hideItemVisuals
()
{
function
hideItemVisuals
()
{
if
(
_flightPath
)
{
for
(
var
i
=
0
;
i
<
_itemVisuals
.
length
;
i
++
)
{
_flightPath
.
destroy
()
_itemVisuals
[
i
].
destroy
()
_flightPath
=
undefined
}
if
(
_loiterPoint
)
{
_loiterPoint
.
destroy
()
_loiterPoint
=
undefined
}
if
(
_landPoint
)
{
_landPoint
.
destroy
()
_landPoint
=
undefined
}
}
_itemVisuals
=
[
]
}
}
function
showItemVisuals
()
{
function
showItemVisuals
()
{
if
(
!
_flightPath
)
{
if
(
_itemVisuals
.
length
===
0
)
{
_flightPath
=
flightPathComponent
.
createObject
(
map
)
var
itemVisual
=
flightPathComponent
.
createObject
(
map
)
map
.
addMapItem
(
_flightPath
)
map
.
addMapItem
(
itemVisual
)
}
_itemVisuals
[
_flightPathIndex
]
=
itemVisual
if
(
!
_loiterPoint
)
{
itemVisual
=
loiterPointComponent
.
createObject
(
map
)
_loiterPoint
=
loiterPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
map
.
addMapItem
(
_loiterPoint
)
_itemVisuals
[
_loiterPointIndex
]
=
itemVisual
}
itemVisual
=
loiterRadiusComponent
.
createObject
(
map
)
if
(
!
_landPoint
)
{
map
.
addMapItem
(
itemVisual
)
_landPoint
=
landPointComponent
.
createObject
(
map
)
_itemVisuals
[
_loiterRadiusIndex
]
=
itemVisual
map
.
addMapItem
(
_landPoint
)
itemVisual
=
landPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_landPointIndex
]
=
itemVisual
}
}
}
}
...
@@ -74,24 +70,16 @@ Item {
...
@@ -74,24 +70,16 @@ Item {
}
}
function
hideDragAreas
()
{
function
hideDragAreas
()
{
console
.
log
(
"
hideDragAreas
"
)
for
(
var
i
=
0
;
i
<
_dragAreas
.
length
;
i
++
)
{
if
(
_dragLoiter
)
{
_dragAreas
[
i
].
destroy
()
_dragLoiter
.
destroy
()
_dragLoiter
=
undefined
}
if
(
_dragLand
)
{
_dragLand
.
destroy
()
_dragLand
=
undefined
}
}
_dragAreas
=
[
]
}
}
function
showDragAreas
()
{
function
showDragAreas
()
{
console
.
log
(
"
showDragAreas
"
)
if
(
_dragAreas
.
length
===
0
)
{
if
(
!
_dragLoiter
)
{
_dragAreas
.
push
(
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
true
}))
_dragLoiter
=
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
true
})
_dragAreas
.
push
(
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
false
}))
}
if
(
!
_dragLand
)
{
_dragLand
=
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
false
})
}
}
}
}
...
@@ -116,7 +104,6 @@ Item {
...
@@ -116,7 +104,6 @@ Item {
target
:
_missionItem
target
:
_missionItem
onIsCurrentItemChanged
:
{
onIsCurrentItemChanged
:
{
console
.
log
(
"
onIsCurrentItemChanged
"
,
_missionItem
.
isCurrentItem
)
if
(
_missionItem
.
isCurrentItem
)
{
if
(
_missionItem
.
isCurrentItem
)
{
if
(
_missionItem
.
landingCoordSet
)
{
if
(
_missionItem
.
landingCoordSet
)
{
showDragAreas
()
showDragAreas
()
...
@@ -172,7 +159,7 @@ Item {
...
@@ -172,7 +159,7 @@ Item {
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
bool
dragLoiter
property
bool
dragLoiter
property
var
mapQuickItem
:
dragLoiter
?
_
loiterPoint
:
_landPoint
property
var
mapQuickItem
:
dragLoiter
?
_
itemVisuals
[
_loiterPointIndex
]
:
_itemVisuals
[
_landPointIndex
]
property
bool
_preventCoordinateBindingLoop
:
false
property
bool
_preventCoordinateBindingLoop
:
false
onXChanged
:
liveDrag
()
onXChanged
:
liveDrag
()
...
@@ -216,7 +203,7 @@ Item {
...
@@ -216,7 +203,7 @@ Item {
MapPolyline
{
MapPolyline
{
z
:
QGroundControl
.
zOrderMapItems
-
1
// Under item indicators
z
:
QGroundControl
.
zOrderMapItems
-
1
// Under item indicators
line.color
:
"
white
"
line.color
:
"
#be781c
"
line.width
:
2
line.width
:
2
path
:
_missionItem
.
landingCoordSet
?
[
_missionItem
.
loiterCoordinate
,
_missionItem
.
landingCoordinate
]
:
undefined
path
:
_missionItem
.
landingCoordSet
?
[
_missionItem
.
loiterCoordinate
,
_missionItem
.
landingCoordinate
]
:
undefined
}
}
...
@@ -234,11 +221,25 @@ Item {
...
@@ -234,11 +221,25 @@ Item {
sourceItem
:
sourceItem
:
MissionItemIndexLabel
{
MissionItemIndexLabel
{
label
:
"
P
"
label
:
"
L
"
}
}
}
}
}
}
// Loiter radius visual
Component
{
id
:
loiterRadiusComponent
MapCircle
{
z
:
QGroundControl
.
zOrderMapItems
center
:
_missionItem
.
loiterCoordinate
radius
:
_missionItem
.
loiterRadius
.
value
border.width
:
2
border.color
:
"
green
"
color
:
"
transparent
"
}
}
// Land point
// Land point
Component
{
Component
{
id
:
landPointComponent
id
:
landPointComponent
...
@@ -252,6 +253,7 @@ Item {
...
@@ -252,6 +253,7 @@ Item {
sourceItem
:
sourceItem
:
MissionItemIndexLabel
{
MissionItemIndexLabel
{
label
:
"
L
"
label
:
"
L
"
checked
:
_missionItem
.
isCurrentItem
}
}
}
}
}
}
...
...
src/MissionManager/FWLandingPattern.FactMetaData.json
View file @
8f878ced
...
@@ -12,8 +12,10 @@
...
@@ -12,8 +12,10 @@
"shortDescription"
:
"Heading from land point to loiter point."
,
"shortDescription"
:
"Heading from land point to loiter point."
,
"type"
:
"double"
,
"type"
:
"double"
,
"units"
:
"deg"
,
"units"
:
"deg"
,
"min"
:
0.0
,
"max"
:
360.0
,
"decimalPlaces"
:
0
,
"decimalPlaces"
:
0
,
"defaultValue"
:
0.0
"defaultValue"
:
27
0.0
},
},
{
{
"name"
:
"Loiter altitude"
,
"name"
:
"Loiter altitude"
,
...
...
src/MissionManager/FixedWingLandingComplexItem.cc
View file @
8f878ced
...
@@ -230,7 +230,7 @@ void FixedWingLandingComplexItem::_recalcLoiterCoordFromFacts(void)
...
@@ -230,7 +230,7 @@ void FixedWingLandingComplexItem::_recalcLoiterCoordFromFacts(void)
QPointF
originPoint
(
east
,
north
);
QPointF
originPoint
(
east
,
north
);
north
+=
_loiterToLandDistanceFact
.
rawValue
().
toDouble
();
north
+=
_loiterToLandDistanceFact
.
rawValue
().
toDouble
();
QPointF
loiterPoint
(
east
,
north
);
QPointF
loiterPoint
(
east
,
north
);
QPointF
rotatedLoiterPoint
=
_rotatePoint
(
loiterPoint
,
originPoint
,
_landingHeadingFact
.
rawValue
().
toDouble
());
QPointF
rotatedLoiterPoint
=
_rotatePoint
(
loiterPoint
,
originPoint
,
-
_landingHeadingFact
.
rawValue
().
toDouble
());
convertNedToGeo
(
rotatedLoiterPoint
.
y
(),
rotatedLoiterPoint
.
x
(),
down
,
tangentOrigin
,
&
_loiterCoordinate
);
convertNedToGeo
(
rotatedLoiterPoint
.
y
(),
rotatedLoiterPoint
.
x
(),
down
,
tangentOrigin
,
&
_loiterCoordinate
);
...
@@ -276,7 +276,11 @@ void FixedWingLandingComplexItem::_recalcFactsFromCoords(void)
...
@@ -276,7 +276,11 @@ void FixedWingLandingComplexItem::_recalcFactsFromCoords(void)
QPointF
vector
(
eastLoiter
-
eastLand
,
northLoiter
-
northLand
);
QPointF
vector
(
eastLoiter
-
eastLand
,
northLoiter
-
northLand
);
double
radians
=
atan2
(
vector
.
y
(),
vector
.
x
());
double
radians
=
atan2
(
vector
.
y
(),
vector
.
x
());
double
degrees
=
qRadiansToDegrees
(
radians
);
double
degrees
=
qRadiansToDegrees
(
radians
);
degrees
-=
90
;
// north up
// Change angle to north up = 0 degrees
degrees
-=
90
;
// Reverse the angle direction to go from mathematic angle (counter-clockwise) to compass heading (clockwise)
degrees
*=
-
1.0
;
// Bring with 0-360 range
if
(
degrees
<
0.0
)
{
if
(
degrees
<
0.0
)
{
degrees
+=
360.0
;
degrees
+=
360.0
;
}
else
if
(
degrees
>
360.0
)
{
}
else
if
(
degrees
>
360.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