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
312c2896
Commit
312c2896
authored
Apr 10, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vehicle heading to plan toolbar
Also work on plan toolbar readability
parent
09bde0c7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
35 deletions
+50
-35
MissionController.cc
src/MissionManager/MissionController.cc
+16
-5
MissionController.h
src/MissionManager/MissionController.h
+1
-0
VisualMissionItem.h
src/MissionManager/VisualMissionItem.h
+4
-4
PlanToolBar.qml
src/PlanView/PlanToolBar.qml
+29
-26
No files found.
src/MissionManager/MissionController.cc
View file @
312c2896
...
...
@@ -77,6 +77,7 @@ void MissionController::_resetMissionFlightStatus(void)
_missionFlightStatus
.
cruiseSpeed
=
_activeVehicle
?
_activeVehicle
->
defaultCruiseSpeed
()
:
std
::
numeric_limits
<
double
>::
quiet_NaN
();
_missionFlightStatus
.
hoverSpeed
=
_activeVehicle
?
_activeVehicle
->
defaultHoverSpeed
()
:
std
::
numeric_limits
<
double
>::
quiet_NaN
();
_missionFlightStatus
.
vehicleSpeed
=
_activeVehicle
?
(
_activeVehicle
->
multiRotor
()
||
_activeVehicle
->
vtol
()
?
_missionFlightStatus
.
hoverSpeed
:
_missionFlightStatus
.
cruiseSpeed
)
:
std
::
numeric_limits
<
double
>::
quiet_NaN
();
_missionFlightStatus
.
vehicleYaw
=
0.0
;
_missionFlightStatus
.
gimbalYaw
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
// Battery information
...
...
@@ -97,6 +98,17 @@ void MissionController::_resetMissionFlightStatus(void)
_missionFlightStatus
.
ampMinutesAvailable
=
(
double
)
_missionFlightStatus
.
mAhBattery
/
1000.0
*
60.0
*
((
100.0
-
batteryPercentRemainingAnnounce
)
/
100.0
);
}
}
emit
missionDistanceChanged
(
_missionFlightStatus
.
totalDistance
);
emit
missionTimeChanged
();
emit
missionHoverDistanceChanged
(
_missionFlightStatus
.
hoverDistance
);
emit
missionCruiseDistanceChanged
(
_missionFlightStatus
.
cruiseDistance
);
emit
missionHoverTimeChanged
();
emit
missionCruiseTimeChanged
();
emit
missionMaxTelemetryChanged
(
_missionFlightStatus
.
maxTelemetryDistance
);
emit
batteryChangePointChanged
(
_missionFlightStatus
.
batteryChangePoint
);
emit
batteriesRequiredChanged
(
_missionFlightStatus
.
batteriesRequired
);
}
void
MissionController
::
start
(
bool
editMode
)
...
...
@@ -322,6 +334,7 @@ void MissionController::removeAll(void)
_addMissionSettings
(
_activeVehicle
,
_visualItems
,
false
/* addToCenter */
);
_initAllVisualItems
();
_visualItems
->
setDirty
(
true
);
_resetMissionFlightStatus
();
}
}
...
...
@@ -953,8 +966,6 @@ void MissionController::_recalcMissionFlightStatus()
const
double
homePositionAltitude
=
_settingsItem
->
coordinate
().
altitude
();
minAltSeen
=
maxAltSeen
=
_settingsItem
->
coordinate
().
altitude
();
double
lastVehicleYaw
=
0
;
_resetMissionFlightStatus
();
bool
vtolInHover
=
true
;
...
...
@@ -1034,8 +1045,8 @@ void MissionController::_recalcMissionFlightStatus()
if
(
item
->
specifiesCoordinate
())
{
// Update vehicle yaw assuming direction to next waypoint
if
(
item
!=
lastCoordinateItem
)
{
lastV
ehicleYaw
=
lastCoordinateItem
->
exitCoordinate
().
azimuthTo
(
item
->
coordinate
());
lastCoordinateItem
->
setMissionVehicleYaw
(
lastV
ehicleYaw
);
_missionFlightStatus
.
v
ehicleYaw
=
lastCoordinateItem
->
exitCoordinate
().
azimuthTo
(
item
->
coordinate
());
lastCoordinateItem
->
setMissionVehicleYaw
(
_missionFlightStatus
.
v
ehicleYaw
);
}
// Keep track of the min/max altitude for all waypoints so we can show altitudes as a percentage
...
...
@@ -1115,7 +1126,7 @@ void MissionController::_recalcMissionFlightStatus()
lastCoordinateItem
=
item
;
}
}
lastCoordinateItem
->
setMissionVehicleYaw
(
lastV
ehicleYaw
);
lastCoordinateItem
->
setMissionVehicleYaw
(
_missionFlightStatus
.
v
ehicleYaw
);
if
(
_missionFlightStatus
.
mAhBattery
!=
0
&&
_missionFlightStatus
.
batteryChangePoint
==
-
1
)
{
_missionFlightStatus
.
batteryChangePoint
=
0
;
...
...
src/MissionManager/MissionController.h
View file @
312c2896
...
...
@@ -48,6 +48,7 @@ public:
double
cruiseSpeed
;
double
hoverSpeed
;
double
vehicleSpeed
;
///< Either cruise or hover speed based on vehicle type and vtol state
double
vehicleYaw
;
double
gimbalYaw
;
///< NaN signals yaw was never changed
int
mAhBattery
;
///< 0 for not available
double
hoverAmps
;
///< Amp consumption during hover
...
...
src/MissionManager/VisualMissionItem.h
View file @
312c2896
src/PlanView/PlanToolBar.qml
View file @
312c2896
...
...
@@ -39,9 +39,10 @@ Rectangle {
property
bool
_controllerValid
:
missionController
!=
undefined
property
bool
_manualUpload
:
QGroundControl
.
settingsManager
.
appSettings
.
automaticMissionUpload
.
rawValue
==
0
property
real
_dataFontSize
:
ScreenTools
.
isMobile
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
property
real
_dataFontSize
:
ScreenTools
.
defaultFontPointSize
property
real
_largeValueWidth
:
ScreenTools
.
defaultFontPixelWidth
*
8
property
real
_smallValueWidth
:
ScreenTools
.
defaultFontPixelWidth
*
4
property
real
_mediumValueWidth
:
ScreenTools
.
defaultFontPixelWidth
*
4
property
real
_smallValueWidth
:
ScreenTools
.
defaultFontPixelWidth
*
3
property
real
_labelToValueSpacing
:
ScreenTools
.
defaultFontPixelWidth
property
real
_rowSpacing
:
ScreenTools
.
isMobile
?
1
:
0
property
real
_distance
:
_statusValid
?
currentMissionItem
.
distance
:
NaN
...
...
@@ -49,6 +50,7 @@ Rectangle {
property
real
_gradient
:
_statusValid
&&
currentMissionItem
.
distance
>
0
?
Math
.
atan
(
currentMissionItem
.
altDifference
/
currentMissionItem
.
distance
)
:
NaN
property
real
_gradientPercent
:
isNaN
(
_gradient
)
?
NaN
:
_gradient
*
100
property
real
_azimuth
:
_statusValid
?
currentMissionItem
.
azimuth
:
NaN
property
real
_heading
:
_statusValid
?
currentMissionItem
.
missionVehicleYaw
:
NaN
property
real
_missionDistance
:
_missionValid
?
missionDistance
:
NaN
property
real
_missionMaxTelemetry
:
_missionValid
?
missionMaxTelemetry
:
NaN
property
real
_missionTime
:
_missionValid
?
missionTime
:
NaN
...
...
@@ -57,8 +59,9 @@ Rectangle {
property
string
_distanceText
:
isNaN
(
_distance
)
?
"
-.-
"
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_distance
).
toFixed
(
1
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
property
string
_altDifferenceText
:
isNaN
(
_altDifference
)
?
"
-.-
"
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_altDifference
).
toFixed
(
1
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
property
string
_gradientText
:
isNaN
(
_gradient
)
?
"
-.-
"
:
_gradientPercent
.
toFixed
(
0
)
+
"
%
"
property
string
_gradientText
:
isNaN
(
_gradient
)
?
"
-.-
"
:
_gradientPercent
.
toFixed
(
0
)
+
"
%
"
property
string
_azimuthText
:
isNaN
(
_azimuth
)
?
"
-.-
"
:
Math
.
round
(
_azimuth
)
property
string
_headingText
:
isNaN
(
_azimuth
)
?
"
-.-
"
:
Math
.
round
(
_heading
)
property
string
_missionDistanceText
:
isNaN
(
_missionDistance
)
?
"
-.-
"
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_missionDistance
).
toFixed
(
0
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
property
string
_missionMaxTelemetryText
:
isNaN
(
_missionMaxTelemetry
)
?
"
-.-
"
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_missionMaxTelemetry
).
toFixed
(
0
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
property
string
_batteryChangePointText
:
_batteryChangePoint
<
0
?
"
N/A
"
:
_batteryChangePoint
...
...
@@ -120,50 +123,55 @@ Rectangle {
GridLayout
{
anchors.verticalCenter
:
parent
.
verticalCenter
columns
:
5
columns
:
8
rowSpacing
:
_rowSpacing
columnSpacing
:
_labelToValueSpacing
QGCLabel
{
text
:
qsTr
(
"
Selected Waypoint
"
)
Layout.columnSpan
:
5
Layout.columnSpan
:
8
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
QGCLabel
{
text
:
qsTr
(
"
Distance
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
qsTr
(
"
Alt diff
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
_
dista
nceText
text
:
_
altDiffere
nceText
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_largeValueWidth
horizontalAlignment
:
Text
.
AlignRight
Layout.minimumWidth
:
_mediumValueWidth
}
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
Gradient
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
qsTr
(
"
Azimuth
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
_
gradient
Text
text
:
_
azimuth
Text
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_smallValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
QGCLabel
{
text
:
qsTr
(
"
Alt diff:
"
);
font.pointSize
:
_dataFontSize
;
}
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
Distance:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
_
altDiffere
nceText
text
:
_
dista
nceText
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_largeValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
QGCLabel
{
text
:
qsTr
(
"
Gradient:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
_gradientText
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_mediumValueWidth
}
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
Azimuth
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
qsTr
(
"
Heading
:
"
);
font.pointSize
:
_dataFontSize
;
}
QGCLabel
{
text
:
_
azimuth
Text
text
:
_
heading
Text
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_smallValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
}
...
...
@@ -184,7 +192,6 @@ Rectangle {
text
:
_missionDistanceText
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_largeValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
Item
{
width
:
1
;
height
:
1
}
...
...
@@ -194,7 +201,6 @@ Rectangle {
text
:
_missionMaxTelemetryText
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_largeValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
QGCLabel
{
text
:
qsTr
(
"
Time:
"
);
font.pointSize
:
_dataFontSize
;
}
...
...
@@ -202,7 +208,6 @@ Rectangle {
text
:
getMissionTime
()
font.pointSize
:
_dataFontSize
Layout.minimumWidth
:
_largeValueWidth
horizontalAlignment
:
Text
.
AlignRight
}
}
...
...
@@ -222,8 +227,7 @@ Rectangle {
QGCLabel
{
text
:
_batteriesRequiredText
font.pointSize
:
_dataFontSize
horizontalAlignment
:
Text
.
AlignRight
Layout.minimumWidth
:
_smallValueWidth
Layout.minimumWidth
:
_mediumValueWidth
}
Item
{
width
:
1
;
height
:
1
}
...
...
@@ -232,8 +236,7 @@ Rectangle {
QGCLabel
{
text
:
_batteryChangePointText
font.pointSize
:
_dataFontSize
horizontalAlignment
:
Text
.
AlignRight
Layout.minimumWidth
:
_smallValueWidth
Layout.minimumWidth
:
_mediumValueWidth
}
}
}
...
...
@@ -245,7 +248,7 @@ Rectangle {
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
missionController
?
(
missionController
.
dirty
?
qsTr
(
"
Upload Required
"
)
:
qsTr
(
"
Upload
"
))
:
""
enabled
:
_activeVehicle
visible
:
_manualUpload
visible
:
_
activeVehicle
&&
_
manualUpload
onClicked
:
missionController
.
upload
()
PropertyAnimation
on
opacity
{
...
...
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