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
4f285701
Commit
4f285701
authored
Dec 07, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch back to item #, plus alt display
parent
cc5689ba
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
112 additions
and
121 deletions
+112
-121
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
MissionItemIndicator.qml
src/FlightMap/MapItems/MissionItemIndicator.qml
+1
-20
MissionItemView.qml
src/FlightMap/MapItems/MissionItemView.qml
+0
-4
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+7
-53
MissionController.cc
src/MissionManager/MissionController.cc
+64
-26
MissionItem.cc
src/MissionManager/MissionItem.cc
+11
-0
MissionItem.h
src/MissionManager/MissionItem.h
+8
-3
MissionItemIndexLabel.qml
src/QmlControls/MissionItemIndexLabel.qml
+17
-15
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+1
-0
ScreenTools.qml
src/QmlControls/ScreenTools.qml
+2
-0
No files found.
qgroundcontrol.qrc
View file @
4f285701
...
...
@@ -48,6 +48,7 @@
<file alias="QGroundControl/Controls/MainToolBarIndicators.qml">src/ui/toolbar/MainToolBarIndicators.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemStatus.qml">src/MissionEditor/MissionItemStatus.qml</file>
<file alias="QGroundControl/Controls/MissionCommandDialog.qml">src/QmlControls/MissionCommandDialog.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
...
...
src/FlightMap/MapItems/MissionItemIndicator.qml
View file @
4f285701
...
...
@@ -39,30 +39,11 @@ MapQuickItem {
anchorPoint.x
:
sourceItem
.
width
/
2
anchorPoint.y
:
sourceItem
.
height
/
2
Connections
{
target
:
missionItem
onCoordinateChanged
:
recalcLabel
()
onRelativeAltitudeChanged
:
recalcLabel
()
}
Component.onCompleted
:
recalcLabel
()
function
recalcLabel
()
{
var
label
=
Math
.
round
(
object
.
coordinate
.
altitude
)
if
(
!
object
.
relativeAltitude
)
{
label
=
"
=
"
+
label
}
if
(
object
.
homePosition
)
{
label
=
"
H
"
+
label
}
_label
.
label
=
label
}
sourceItem
:
MissionItemIndexLabel
{
id
:
_label
isCurrentItem
:
missionItem
.
isCurrentItem
label
:
missionItem
.
sequenceNumber
onClicked
:
_item
.
clicked
()
}
}
src/FlightMap/MapItems/MissionItemView.qml
View file @
4f285701
...
...
@@ -70,9 +70,6 @@ MapItemView {
}
}
/*
Turned off for now
// These are the non-coordinate child mission items attached to this item
Row
{
anchors.top
:
parent
.
top
...
...
@@ -90,6 +87,5 @@ MapItemView {
}
}
}
*/
}
}
src/MissionEditor/MissionEditor.qml
View file @
4f285701
...
...
@@ -347,9 +347,6 @@ QGCView {
onCommandChanged
:
updateItemIndicator
()
}
/*
Disabled for now: Not sure if they will come back
// These are the non-coordinate child mission items attached to this item
Row
{
anchors.top
:
parent
.
top
...
...
@@ -367,7 +364,6 @@ QGCView {
}
}
}
*/
}
}
...
...
@@ -486,16 +482,6 @@ QGCView {
}
}
/*
Home Position manager temporarily disable
RoundButton {
id: homePositionManagerButton
buttonImage: "/qmlimages/MapHome.svg"
//exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
}
*/
DropButton
{
id
:
syncButton
dropDirection
:
dropRight
...
...
@@ -620,48 +606,16 @@ QGCView {
}
}
Rectangle
{
MissionItemStatus
{
id
:
waypointValuesDisplay
anchors.margins
:
margins
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
width
:
distanceLabel
.
width
+
(
margins
*
2
)
height
:
valuesColumn
.
height
+
(
margins
*
2
)
radius
:
ScreenTools
.
defaultFontPixelWidth
color
:
qgcPal
.
window
opacity
:
0.80
visible
:
_currentMissionItem
?
_currentMissionItem
.
distance
!=
-
1
:
false
readonly
property
real
margins
:
ScreenTools
.
defaultFontPixelWidth
property
real
_altDifference
:
_currentMissionItem
?
_currentMissionItem
.
altDifference
:
0
property
real
_azimuth
:
_currentMissionItem
?
_currentMissionItem
.
azimuth
:
0
property
real
_distance
:
_currentMissionItem
?
_currentMissionItem
.
distance
:
0
Column
{
id
:
valuesColumn
anchors.leftMargin
:
parent
.
margins
anchors.topMargin
:
parent
.
margins
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
QGCLabel
{
id
:
distanceLabel
color
:
qgcPal
.
text
text
:
"
Distance:
"
+
Math
.
round
(
waypointValuesDisplay
.
_distance
)
+
"
meters
"
}
QGCLabel
{
color
:
qgcPal
.
text
text
:
"
Alt diff:
"
+
Math
.
round
(
waypointValuesDisplay
.
_altDifference
)
+
"
meters
"
}
QGCLabel
{
color
:
qgcPal
.
text
text
:
"
Azimuth:
"
+
Math
.
round
(
waypointValuesDisplay
.
_azimuth
)
}
}
z
:
QGroundControl
.
zOrderTopMost
currentMissionItem
:
_currentMissionItem
missionItems
:
controller
.
missionItems
expandedWidth
:
missionItemEditor
.
x
-
(
ScreenTools
.
defaultFontPixelWidth
*
2
)
homePositionValid
:
liveHomePositionAvailable
}
}
// FlightMap
}
// Item - split view container
...
...
src/MissionManager/MissionController.cc
View file @
4f285701
...
...
@@ -341,9 +341,15 @@ void MissionController::_recalcWaypointLines(void)
// both relative altitude.
// No values for first item
lastCoordinateItem
->
setAltDifference
(
0.0
);
lastCoordinateItem
->
setAzimuth
(
0.0
);
lastCoordinateItem
->
setDistance
(
-
1.0
);
double
minAltSeen
=
0.0
;
double
maxAltSeen
=
0.0
;
double
homePositionAltitude
=
homeItem
->
coordinate
().
altitude
();
minAltSeen
=
maxAltSeen
=
homeItem
->
coordinate
().
altitude
();
_waypointLines
.
clear
();
for
(
int
i
=
1
;
i
<
_missionItems
->
count
();
i
++
)
{
...
...
@@ -353,35 +359,62 @@ void MissionController::_recalcWaypointLines(void)
item
->
setAzimuth
(
0.0
);
item
->
setDistance
(
-
1.0
);
if
(
item
->
specifiesCoordinate
()
&&
!
item
->
standaloneCoordinate
())
{
if
(
firstCoordinateItem
)
{
if
(
item
->
command
()
==
MavlinkQmlSingleton
::
MAV_CMD_NAV_TAKEOFF
)
{
// The first coordinate we hit is a takeoff command so link back to home position if valid
if
(
homePositionValid
)
{
double
azimuth
,
distance
,
altDifference
;
_waypointLines
.
append
(
new
CoordinateVector
(
homeItem
->
coordinate
(),
item
->
coordinate
()));
_calcPrevWaypointValues
(
homePositionValid
,
homeAlt
,
item
,
homeItem
,
&
azimuth
,
&
distance
,
&
altDifference
);
item
->
setAltDifference
(
altDifference
);
item
->
setAzimuth
(
azimuth
);
item
->
setDistance
(
distance
);
if
(
item
->
specifiesCoordinate
())
{
double
absoluteAltitude
=
item
->
coordinate
().
altitude
();
if
(
item
->
relativeAltitude
()
&&
homePositionValid
)
{
absoluteAltitude
+=
homePositionAltitude
;
}
minAltSeen
=
std
::
min
(
minAltSeen
,
absoluteAltitude
);
maxAltSeen
=
std
::
max
(
maxAltSeen
,
absoluteAltitude
);
if
(
!
item
->
standaloneCoordinate
())
{
if
(
firstCoordinateItem
)
{
if
(
item
->
command
()
==
MavlinkQmlSingleton
::
MAV_CMD_NAV_TAKEOFF
)
{
// The first coordinate we hit is a takeoff command so link back to home position if valid
if
(
homePositionValid
)
{
double
azimuth
,
distance
,
altDifference
;
_waypointLines
.
append
(
new
CoordinateVector
(
homeItem
->
coordinate
(),
item
->
coordinate
()));
_calcPrevWaypointValues
(
homePositionValid
,
homeAlt
,
item
,
homeItem
,
&
azimuth
,
&
distance
,
&
altDifference
);
item
->
setAltDifference
(
altDifference
);
item
->
setAzimuth
(
azimuth
);
item
->
setDistance
(
distance
);
}
}
else
{
// First coordiante is not a takeoff command, it does not link backwards to anything
}
}
else
{
// First coordiante is not a takeoff command, it does not link backwards to anything
firstCoordinateItem
=
false
;
}
else
if
(
!
lastCoordinateItem
->
homePosition
()
||
lastCoordinateItem
->
homePositionValid
())
{
double
azimuth
,
distance
,
altDifference
;
// Subsequent coordinate items link to last coordinate item. If the last coordinate item
// is an invalid home position we skip the line
_calcPrevWaypointValues
(
homePositionValid
,
homeAlt
,
item
,
lastCoordinateItem
,
&
azimuth
,
&
distance
,
&
altDifference
);
item
->
setAltDifference
(
altDifference
);
item
->
setAzimuth
(
azimuth
);
item
->
setDistance
(
distance
);
_waypointLines
.
append
(
new
CoordinateVector
(
lastCoordinateItem
->
coordinate
(),
item
->
coordinate
()));
}
firstCoordinateItem
=
false
;
}
else
if
(
!
lastCoordinateItem
->
homePosition
()
||
lastCoordinateItem
->
homePositionValid
())
{
double
azimuth
,
distance
,
altDifference
;
// Subsequent coordinate items link to last coordinate item. If the last coordinate item
// is an invalid home position we skip the line
_calcPrevWaypointValues
(
homePositionValid
,
homeAlt
,
item
,
lastCoordinateItem
,
&
azimuth
,
&
distance
,
&
altDifference
);
item
->
setAltDifference
(
altDifference
);
item
->
setAzimuth
(
azimuth
);
item
->
setDistance
(
distance
);
_waypointLines
.
append
(
new
CoordinateVector
(
lastCoordinateItem
->
coordinate
(),
item
->
coordinate
()));
lastCoordinateItem
=
item
;
}
}
}
// Walk the list again calculating altitude percentages
double
altRange
=
maxAltSeen
-
minAltSeen
;
for
(
int
i
=
0
;
i
<
_missionItems
->
count
();
i
++
)
{
MissionItem
*
item
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
i
));
if
(
item
->
specifiesCoordinate
())
{
double
absoluteAltitude
=
item
->
coordinate
().
altitude
();
if
(
item
->
relativeAltitude
()
&&
homePositionValid
)
{
absoluteAltitude
+=
homePositionAltitude
;
}
if
(
altRange
==
0.0
)
{
item
->
setAltPercent
(
0.0
);
}
else
{
item
->
setAltPercent
((
absoluteAltitude
-
minAltSeen
)
/
altRange
);
}
lastCoordinateItem
=
item
;
}
}
...
...
@@ -448,6 +481,11 @@ void MissionController::_initAllMissionItems(void)
}
homeItem
->
setCommand
(
MAV_CMD_NAV_WAYPOINT
);
homeItem
->
setFrame
(
MAV_FRAME_GLOBAL
);
if
(
!
homeItem
->
homePositionValid
())
{
QGeoCoordinate
homeCoord
=
homeItem
->
coordinate
();
homeCoord
.
setAltitude
(
0.0
);
homeItem
->
setCoordinate
(
homeCoord
);
}
for
(
int
i
=
0
;
i
<
_missionItems
->
count
();
i
++
)
{
_initMissionItem
(
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
i
)));
...
...
src/MissionManager/MissionItem.cc
View file @
4f285701
...
...
@@ -81,6 +81,8 @@ MissionItem::MissionItem(QObject* parent)
,
_dirty
(
false
)
,
_sequenceNumber
(
0
)
,
_isCurrentItem
(
false
)
,
_altDifference
(
0.0
)
,
_altPercent
(
0.0
)
,
_azimuth
(
0.0
)
,
_distance
(
0.0
)
,
_homePositionSpecialCase
(
false
)
...
...
@@ -140,6 +142,7 @@ MissionItem::MissionItem(int sequenceNumber,
,
_sequenceNumber
(
sequenceNumber
)
,
_isCurrentItem
(
isCurrentItem
)
,
_altDifference
(
0.0
)
,
_altPercent
(
0.0
)
,
_azimuth
(
0.0
)
,
_distance
(
0.0
)
,
_homePositionSpecialCase
(
false
)
...
...
@@ -198,6 +201,7 @@ MissionItem::MissionItem(const MissionItem& other, QObject* parent)
,
_sequenceNumber
(
0
)
,
_isCurrentItem
(
false
)
,
_altDifference
(
0.0
)
,
_altPercent
(
0.0
)
,
_azimuth
(
0.0
)
,
_distance
(
0.0
)
,
_homePositionSpecialCase
(
false
)
...
...
@@ -243,6 +247,7 @@ const MissionItem& MissionItem::operator=(const MissionItem& other)
setAutoContinue
(
other
.
autoContinue
());
setIsCurrentItem
(
other
.
_isCurrentItem
);
setAltDifference
(
other
.
_altDifference
);
setAltPercent
(
other
.
_altPercent
);
setAzimuth
(
other
.
_azimuth
);
setDistance
(
other
.
_distance
);
setHomePositionSpecialCase
(
other
.
_homePositionSpecialCase
);
...
...
@@ -734,6 +739,12 @@ void MissionItem::setAltDifference(double altDifference)
emit
altDifferenceChanged
(
_altDifference
);
}
void
MissionItem
::
setAltPercent
(
double
altPercent
)
{
_altPercent
=
altPercent
;
emit
altPercentChanged
(
_altPercent
);
}
void
MissionItem
::
setAzimuth
(
double
azimuth
)
{
_azimuth
=
azimuth
;
...
...
src/MissionManager/MissionItem.h
View file @
4f285701
...
...
@@ -69,6 +69,7 @@ public:
const
MissionItem
&
operator
=
(
const
MissionItem
&
other
);
Q_PROPERTY
(
double
altDifference
READ
altDifference
WRITE
setAltDifference
NOTIFY
altDifferenceChanged
)
///< Change in altitude from previous waypoint
Q_PROPERTY
(
double
altPercent
READ
altPercent
WRITE
setAltPercent
NOTIFY
altPercentChanged
)
///< Percent of total altitude change in mission altitude
Q_PROPERTY
(
double
azimuth
READ
azimuth
WRITE
setAzimuth
NOTIFY
azimuthChanged
)
///< Azimuth to previous waypoint
Q_PROPERTY
(
QString
category
READ
category
NOTIFY
commandChanged
)
Q_PROPERTY
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
READ
command
WRITE
setCommand
NOTIFY
commandChanged
)
...
...
@@ -100,6 +101,7 @@ public:
// Property accesors
double
altDifference
(
void
)
const
{
return
_altDifference
;
}
double
altPercent
(
void
)
const
{
return
_altPercent
;
}
double
azimuth
(
void
)
const
{
return
_azimuth
;
}
QString
category
(
void
)
const
;
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
(
void
)
const
{
return
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
)
_commandFact
.
cookedValue
().
toInt
();
};
...
...
@@ -139,9 +141,10 @@ public:
void
setHomePositionValid
(
bool
homePositionValid
);
void
setHomePositionSpecialCase
(
bool
homePositionSpecialCase
)
{
_homePositionSpecialCase
=
homePositionSpecialCase
;
}
void
setAltDifference
(
double
altDifference
);
void
setAzimuth
(
double
azimuth
);
void
setDistance
(
double
distance
);
void
setAltDifference
(
double
altDifference
);
void
setAltPercent
(
double
altPercent
);
void
setAzimuth
(
double
azimuth
);
void
setDistance
(
double
distance
);
// C++ only methods
...
...
@@ -180,6 +183,7 @@ public slots:
signals:
void
altDifferenceChanged
(
double
altDifference
);
void
altPercentChanged
(
double
altPercent
);
void
azimuthChanged
(
double
azimuth
);
void
commandChanged
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
);
void
coordinateChanged
(
const
QGeoCoordinate
&
coordinate
);
...
...
@@ -220,6 +224,7 @@ private:
int
_sequenceNumber
;
bool
_isCurrentItem
;
double
_altDifference
;
///< Difference in altitude from previous waypoint
double
_altPercent
;
///< Percent of total altitude change in mission
double
_azimuth
;
///< Azimuth to previous waypoint
double
_distance
;
///< Distance to previous waypoint
bool
_homePositionSpecialCase
;
///< true: This item is being used as a ui home position indicator
...
...
src/QmlControls/MissionItemIndexLabel.qml
View file @
4f285701
import
QtQuick
2.
2
import
QtQuick
2.
5
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
...
...
@@ -8,31 +8,33 @@ import QGroundControl.Palette 1.0
Rectangle
{
property
alias
label
:
_label
.
text
property
bool
isCurrentItem
:
false
property
bool
small
:
false
signal
clicked
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
4
QGCPalette
{
id
:
qgcPal
}
width
:
_label
.
width
+
(
_margin
*
2
)
height
:
_label
.
height
+
(
_margin
*
2
)
radius
:
_margin
border.width
:
1
width
:
_width
height
:
_width
radius
:
_width
/
2
border.width
:
small
?
1
:
2
border.color
:
"
white
"
color
:
isCurrentItem
?
"
green
"
:
qgcPal
.
mapButtonHighlight
property
real
_width
:
small
?
ScreenTools
.
smallFontPixelSize
*
1.5
:
ScreenTools
.
mediumFontPixelSize
*
1.5
QGCPalette
{
id
:
qgcPal
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
parent
.
clicked
()
anchors.fill
:
parent
onClicked
:
parent
.
clicked
()
}
QGCLabel
{
id
:
_label
anchors.
margins
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
anchors.
fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
color
:
"
white
"
font.pixelSize
:
ScreenTools
.
default
FontPixelSize
font.pixelSize
:
small
?
ScreenTools
.
smallFontPixelSize
:
ScreenTools
.
medium
FontPixelSize
}
}
src/QmlControls/QGroundControl.Controls.qmldir
View file @
4f285701
...
...
@@ -9,6 +9,7 @@ MainToolBar 1.0 MainToolBar.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemStatus 1.0 MissionItemStatus.qml
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml
ParameterEditor 1.0 ParameterEditor.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml
...
...
src/QmlControls/ScreenTools.qml
View file @
4f285701
...
...
@@ -13,6 +13,8 @@ Item {
readonly
property
real
defaultFontPixelHeight
:
defaultFontPixelSize
readonly
property
real
defaultFontPixelWidth
:
_textMeasure
.
fontWidth
readonly
property
real
smallFontPixelSize
:
defaultFontPixelSize
*
ScreenToolsController
.
smallFontPixelSizeRatio
readonly
property
real
smallFontPixelHeight
:
smallFontPixelSize
readonly
property
real
smallFontPixelWidth
:
defaultFontPixelWidth
*
ScreenToolsController
.
smallFontPixelSizeRatio
// To proportionally scale fonts
...
...
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