fix(GPS): correct GPS_RTCM_DATA fragmentation for MAVLink reassembly - #14772
Conversation
Match MAVLink/ArduPilot/PX4 rules: unfragmented packets up to 180 bytes, zero-length terminator for exact 180 multiples under 4 fragments, and stream oversized (>720) payloads as unfragmented chunks instead of overflowing the 2-bit fragment ID. Emit one UDP-validated RTCM frame per sequence.
RTCMUdpInput now emits one CRC-valid frame per signal instead of concatenating frames, which left extractValidFrames without callers. Concatenated multi-frame output is exactly the shape that broke GPS_RTCM_DATA sequencing, so drop it rather than leave it around.
Add RTCMUdpInputTest: raw passthrough with validation off, one signal per CRC-valid frame, bad-CRC frames dropped mid-stream, and parser state carried across split datagrams. RTCMUdpInput now resolves port 0 to the actual bound port so tests can bind ephemerally without racing for a fixed port. Also cover the 541..719 pack() range (four fragments with a non-full tail, no terminator).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14772 +/- ##
==========================================
+ Coverage 25.47% 32.72% +7.25%
==========================================
Files 769 784 +15
Lines 65912 67602 +1690
Branches 30495 31311 +816
==========================================
+ Hits 16788 22120 +5332
+ Misses 37285 30596 -6689
- Partials 11839 14886 +3047
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 471 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: 37 passed, 0 skipped Code Coverage
Artifact Sizes
Updated: 2026-08-07 03:26:44 UTC • Commit: 20a96c1 • Triggered by: Android |
There was a problem hiding this comment.
Pull request overview
Corrects RTCM-to-MAVLink packetization to satisfy ArduPilot and PX4 reassembly requirements.
Changes:
- Handles fragmentation boundaries, terminators, and oversized frames correctly.
- Emits validated UDP RTCM frames individually.
- Adds comprehensive packetization and UDP tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/GPS/RTCM/RTCMMavlink.h |
Defines packetization API and limits. |
src/GPS/RTCM/RTCMMavlink.cc |
Implements compliant fragmentation and streaming. |
src/GPS/RTCM/RTCMUdpInput.h |
Documents per-frame validated emission. |
src/GPS/RTCM/RTCMUdpInput.cc |
Emits each valid RTCM frame separately. |
src/GPS/RTCM/RTCMParser.h |
Removes obsolete extraction API. |
src/GPS/RTCM/RTCMParser.cc |
Removes concatenating extraction implementation. |
test/GPS/RTCMMavlinkTest.h |
Declares packetization tests. |
test/GPS/RTCMMavlinkTest.cc |
Tests fragmentation boundaries and flags. |
test/GPS/RTCMUdpInputTest.h |
Declares UDP input tests. |
test/GPS/RTCMUdpInputTest.cc |
Tests validation and per-frame emission. |
test/GPS/RTCMParserTest.h |
Removes obsolete test declarations. |
test/GPS/RTCMParserTest.cc |
Removes extraction tests. |
test/GPS/CMakeLists.txt |
Registers the new unit tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Summary
Make QGC's
GPS_RTCM_DATApacking match the MAVLink reassembly contract used by ArduPilot and PX4.Problem
RTCMMavlinktreated payloads of size 180 as fragmented without a completion marker, omitted the required zero-length terminator for exact multiples of 180 under four fragments, and could emit fragment IDs beyond 0–3 for RTCM frames larger than 720 bytes. ArduPilot discards incomplete sequences; PX4 carries an explicit compatibility workaround for older QGC senders.Solution
RTCMParser::extractValidFrames— concatenating frames back into one blob is the pattern that broke sequencing