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
212022fc
Commit
212022fc
authored
Sep 02, 2014
by
Thomas Gubler
Browse files
flightgear: restrict distance sensor to sane values
parent
b52e4403
Changes
1
Show whitespace changes
Inline
Side-by-side
src/comm/QGCFlightGearLink.cc
View file @
212022fc
...
@@ -432,7 +432,11 @@ void QGCFlightGearLink::readBytes()
...
@@ -432,7 +432,11 @@ void QGCFlightGearLink::readBytes()
// qDebug() << "sensorHilGpsChanged " << lat << lon << alt << vel;
// qDebug() << "sensorHilGpsChanged " << lat << lon << alt << vel;
// Send Optical Flow message. For now we set the flow quality to 0 and just write the ground_distance field
// Send Optical Flow message. For now we set the flow quality to 0 and just write the ground_distance field
float
distanceMeasurement
=
(
float
)(
1.0
/
cosPhi
*
1.0
/
cosThe
*
alt_agl
);
//asuming planar ground
float
distanceMeasurement
=
-
1.0
;
// -1 means invalid value
if
(
fabsf
(
roll
)
<
0.87
&&
fabsf
(
pitch
)
<
0.87
)
// return a valid value only for decent angles
{
distanceMeasurement
=
fabsf
((
float
)(
1.0
/
cosPhi
*
1.0
/
cosThe
*
alt_agl
));
// assuming planar ground
}
emit
sensorHilOpticalFlowChanged
(
QGC
::
groundTimeUsecs
(),
0
,
0
,
0.0
f
,
emit
sensorHilOpticalFlowChanged
(
QGC
::
groundTimeUsecs
(),
0
,
0
,
0.0
f
,
0.0
f
,
0.0
f
,
distanceMeasurement
);
0.0
f
,
0.0
f
,
distanceMeasurement
);
}
else
{
}
else
{
...
...
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