Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/PositionManager/PositionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,18 @@ void QGCPositionManager::_positionUpdated(const QGeoPositionInfo &update)
}
}

// Accept the altitude when the fix carries one and the vertical accuracy is either
// acceptable or not reported at all. The Android position source typically reports a
// vertical accuracy well above the old 10m gate (or none), which used to drop the
// altitude entirely and leave consumers such as Remote ID (which mandates an operator
// altitude in FAA regions) with a NaN.
bool verticalAccuracyOk = true;
if (update.hasAttribute(QGeoPositionInfo::VerticalAccuracy)) {
_gcsPositionVerticalAccuracy = update.attribute(QGeoPositionInfo::VerticalAccuracy);
if (_gcsPositionVerticalAccuracy <= kMinVerticalAccuracyMeters) {
newGCSPosition.setAltitude(update.coordinate().altitude());
}
verticalAccuracyOk = (_gcsPositionVerticalAccuracy <= kMinVerticalAccuracyMeters);
}
if ((update.coordinate().type() == QGeoCoordinate::Coordinate3D) && verticalAccuracyOk) {
newGCSPosition.setAltitude(update.coordinate().altitude());
}
Comment on lines +132 to 134

_gcsPositionAccuracy = sqrt(pow(_gcsPositionHorizontalAccuracy, 2) + pow(_gcsPositionVerticalAccuracy, 2));
Expand Down
2 changes: 1 addition & 1 deletion src/PositionManager/PositionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ private slots:
QGCCompass *_compass = nullptr;

static constexpr qreal kMinHorizonalAccuracyMeters = 100.;
static constexpr qreal kMinVerticalAccuracyMeters = 10.;
static constexpr qreal kMinVerticalAccuracyMeters = 100.;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need discussion. It solved the problem for me with Herelink but might not be generic.

static constexpr qreal kMinDirectionAccuracyDegrees = 30.;
};
6 changes: 5 additions & 1 deletion src/Vehicle/RemoteIDManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ void RemoteIDManager::setEmergency(bool declare)
void RemoteIDManager::_updateLastGCSPositionInfo(QGeoPositionInfo update)
{
if (update.isValid()) {
_lastGeoPositionTimeStamp = update.timestamp().toUTC();
// Stamp the local arrival time rather than update.timestamp(). The freshness
// check in _sendSystem() compares this against the local wall clock, and on some
// platforms (e.g. Android) the position source's own timestamp is offset from the
// system clock, which made gcsGPSGood flap green/red even with a healthy fix.
_lastGeoPositionTimeStamp = QDateTime::currentDateTimeUtc();
Comment on lines 490 to +495
}
}
Loading