|
|
|
@ -13,12 +13,6 @@
@@ -13,12 +13,6 @@
|
|
|
|
|
|
|
|
|
|
QGCPositionManager::QGCPositionManager(QGCApplication* app, QGCToolbox* toolbox) |
|
|
|
|
: QGCTool (app, toolbox) |
|
|
|
|
, _updateInterval (0) |
|
|
|
|
, _gcsHeading (NAN) |
|
|
|
|
, _currentSource (nullptr) |
|
|
|
|
, _defaultSource (nullptr) |
|
|
|
|
, _nmeaSource (nullptr) |
|
|
|
|
, _simulatedSource (nullptr) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -34,6 +28,9 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox)
@@ -34,6 +28,9 @@ void QGCPositionManager::setToolbox(QGCToolbox *toolbox)
|
|
|
|
|
QGCTool::setToolbox(toolbox); |
|
|
|
|
//-- First see if plugin provides a position source
|
|
|
|
|
_defaultSource = toolbox->corePlugin()->createPositionSource(this); |
|
|
|
|
if (_defaultSource) { |
|
|
|
|
_usingPluginSource = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (qgcApp()->runningUnitTests()) { |
|
|
|
|
// Units test on travis fail due to lack of position source
|
|
|
|
@ -91,7 +88,14 @@ void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update)
@@ -91,7 +88,14 @@ void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update)
|
|
|
|
|
_gcsPosition = newGCSPosition; |
|
|
|
|
emit gcsPositionChanged(_gcsPosition); |
|
|
|
|
} |
|
|
|
|
if (newGCSHeading != _gcsHeading) { |
|
|
|
|
|
|
|
|
|
// At this point only plugins support gcs heading. The reason is that the quality of heading information from a local
|
|
|
|
|
// position device (not a compass) is unknown. In many cases it can only be trusted if the GCS location is moving above
|
|
|
|
|
// a certain rate of speed. When it is not, or the gcs is standing still the heading is just random. We don't want these
|
|
|
|
|
// random heading to be shown on the fly view. So until we can get a true compass based heading or some smarted heading quality
|
|
|
|
|
// information which takes into account the speed of movement we normally don't set a heading. We do use the heading though
|
|
|
|
|
// if the plugin overrides the position source. In that case we assume that it hopefully know what it is doing.
|
|
|
|
|
if (_usingPluginSource && newGCSHeading != _gcsHeading) { |
|
|
|
|
_gcsHeading = newGCSHeading; |
|
|
|
|
emit gcsHeadingChanged(_gcsHeading); |
|
|
|
|
} |
|
|
|
|