RemoteID/PositionManager: fix GCS Live GNSS position#14587
Conversation
The freshness check in _sendSystem() compared update.timestamp() (the position source's own clock) against the local wall clock. On Android that timestamp is offset from the system clock, and when the offset sat near the 5s ALLOWED_GPS_DELAY threshold the computed age swept across it every send cycle, flapping gcsGPSGood green/red at 1 Hz despite a healthy 1 Hz fix. Record the local arrival time instead, so the check measures the true time since the last valid fix and is immune to GPS-vs-system clock skew.
Altitude was dropped whenever the fix's vertical accuracy exceeded a strict 10m gate (or wasn't reported), which the Android position source almost never meets, leaving gcsPosition.altitude() as NaN. Remote ID in FAA regions mandates an operator altitude, so this made Live GNSS unusable there. Accept the altitude on any 3D fix when the vertical accuracy is within threshold or not reported at all, and raise the vertical threshold to 100m to match the horizontal one.
|
|
||
| static constexpr qreal kMinHorizonalAccuracyMeters = 100.; | ||
| static constexpr qreal kMinVerticalAccuracyMeters = 10.; | ||
| static constexpr qreal kMinVerticalAccuracyMeters = 100.; |
There was a problem hiding this comment.
This might need discussion. It solved the problem for me with Herelink but might not be generic.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (20.00%) is below the target coverage (30.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #14587 +/- ##
==========================================
+ Coverage 25.47% 30.62% +5.15%
==========================================
Files 769 785 +16
Lines 65912 66780 +868
Branches 30495 30940 +445
==========================================
+ Hits 16788 20452 +3664
+ Misses 37285 32389 -4896
- Partials 11839 13939 +2100
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 434 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 0 passed, 0 failed, 0 skipped. Test Resultslinux-coverage-integration: 25 passed, 0 skipped Code CoverageCoverage: 66.3% No baseline available for comparison Artifact Sizes
Updated: 2026-07-06 03:18:21 UTC • Commit: fced979 • Triggered by: Android |
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of the Remote ID “Live GNSS” GCS position pipeline, primarily for Android and FAA-region requirements, by addressing timestamp freshness handling and altitude retention for 3D coordinates.
Changes:
- Stamp GCS GNSS “last update” using local arrival time (UTC) instead of the source-provided timestamp to prevent freshness flapping on platforms with offset provider clocks (e.g. Android).
- Increase the vertical accuracy gate from 10 m → 100 m and accept altitude when vertical accuracy is acceptable or not reported, to avoid dropping altitude and failing FAA 3D coordinate requirements.
- Adjust altitude-setting logic in
QGCPositionManagerto use the new vertical-accuracy behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Vehicle/RemoteIDManager.cc | Changes freshness timestamping for Live GNSS updates to use local arrival time. |
| src/PositionManager/PositionManager.h | Raises the vertical accuracy threshold constant to 100 m. |
| src/PositionManager/PositionManager.cpp | Updates altitude acceptance logic to retain altitude under broader (and Android-compatible) conditions. |
| if ((update.coordinate().type() == QGeoCoordinate::Coordinate3D) && verticalAccuracyOk) { | ||
| newGCSPosition.setAltitude(update.coordinate().altitude()); | ||
| } |
| 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(); |
|
@julianoes Can you look at the review? |
PR #14587 — Implications of the
|
|
2 and 3 are the main problems. 3 was already a bit whacky, but 2 will lead to real problems. |
Two fixes so the Live GNSS Remote ID GCS position works on Android / in FAA regions.
_updateLastGCSPositionInfo()storedupdate.timestamp()(the source's clock), which on Android is offset from the system clock the freshness check compares against — makinggcsGPSGoodflap at 1 Hz near the 5 s threshold. Now stamps local arrival time.