Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cba2a722
Commit
cba2a722
authored
Nov 15, 2016
by
Don Gagne
Browse files
Correct altitude usage for Change Altitude
parent
bdc3dff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
cba2a722
...
...
@@ -365,7 +365,7 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
void
PX4FirmwarePlugin
::
guidedModeGotoLocation
(
Vehicle
*
vehicle
,
const
QGeoCoordinate
&
gotoCoord
)
{
if
(
qIsNaN
(
vehicle
->
altitude
Relative
()
->
rawValue
().
toDouble
()))
{
if
(
qIsNaN
(
vehicle
->
altitude
AMSL
()
->
rawValue
().
toDouble
()))
{
qgcApp
()
->
showMessage
(
QStringLiteral
(
"Unable to go to location, vehicle position not known."
));
return
;
}
...
...
@@ -397,8 +397,12 @@ void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoord
void
PX4FirmwarePlugin
::
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeRel
)
{
if
(
qIsNaN
(
vehicle
->
altitudeRelative
()
->
rawValue
().
toDouble
()))
{
qgcApp
()
->
showMessage
(
QStringLiteral
(
"Unable to change altitude, vehicle altitude not known."
));
if
(
!
vehicle
->
homePositionAvailable
())
{
qgcApp
()
->
showMessage
(
QStringLiteral
(
"Unable to change altitude, home position unknown."
));
return
;
}
if
(
qIsNaN
(
vehicle
->
homePosition
().
altitude
()))
{
qgcApp
()
->
showMessage
(
QStringLiteral
(
"Unable to change altitude, home position altitude unknown."
));
return
;
}
...
...
@@ -413,7 +417,7 @@ void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitu
cmd
.
param4
=
NAN
;
cmd
.
param5
=
NAN
;
cmd
.
param6
=
NAN
;
cmd
.
param7
=
vehicle
->
altitudeAMSL
()
->
rawValue
().
toDoubl
e
()
+
altitudeRel
;
cmd
.
param7
=
vehicle
->
homePosition
().
altitud
e
()
+
altitudeRel
;
cmd
.
target_system
=
vehicle
->
id
();
cmd
.
target_component
=
vehicle
->
defaultComponentId
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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