fix(GPS): correct GPS_RTCM_DATA fragmentation for MAVLink reassembly (5.1 backport) - #14779
Conversation
…links RTCM corrections were sent once per vehicle over each vehicle's primary link. When multiple vehicles share a single UDP link, each write is also fanned out to every connected endpoint on the link, resulting in N^2 duplicate GPS_RTCM_DATA packets for N vehicles. Deduplicate by link: send each RTCM message exactly once per unique primary link, directly on the link, so the send is not tied to whichever vehicle happens to be first on a shared link. Fixes mavlink#14765
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).
There was a problem hiding this comment.
Pull request overview
Backports the GPS RTCM fragmentation and shared-link delivery fixes to Stable_V5.1.
Changes:
- Corrects MAVLink fragmentation, terminators, sequence IDs, and oversized payload handling.
- Emits validated UDP RTCM frames individually and removes concatenation.
- Deduplicates RTCM transmission per link and adds boundary-focused 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.cc |
Implements corrected packing and per-link sending. |
src/GPS/RTCM/RTCMMavlink.h |
Defines packet and packing interfaces. |
src/GPS/RTCM/RTCMParser.cc |
Removes obsolete frame concatenation. |
src/GPS/RTCM/RTCMParser.h |
Removes the obsolete parser API. |
src/GPS/RTCM/RTCMUdpInput.cc |
Emits each validated frame separately. |
src/GPS/RTCM/RTCMUdpInput.h |
Documents updated UDP behavior. |
test/GPS/CMakeLists.txt |
Registers new GPS tests. |
test/GPS/RTCMMavlinkTest.cc |
Tests fragmentation boundaries and flags. |
test/GPS/RTCMMavlinkTest.h |
Declares MAVLink packing tests. |
test/GPS/RTCMParserTest.cc |
Removes obsolete API tests. |
test/GPS/RTCMParserTest.h |
Removes obsolete test declarations. |
test/GPS/RTCMUdpInputTest.cc |
Tests UDP validation and frame emission. |
test/GPS/RTCMUdpInputTest.h |
Declares UDP input tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## Stable_V5.1 #14779 +/- ##
==============================================
Coverage ? 32.71%
==============================================
Files ? 784
Lines ? 67602
Branches ? 31311
==============================================
Hits ? 22119
Misses ? 30595
Partials ? 14888
Flags with carried forward coverage won't be shown. Click here to find out more.
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-08 16:44:28 UTC • Commit: e334abc • Triggered by: Android |
Backport of #14772 to Stable_V5.1.
Also includes its dependency 9faca48 (fix(GPS): send RTCM once per link to avoid duplicate sends on shared links), which #14772 builds on and was not yet in 5.1.
All four commits cherry-picked cleanly; RTCMParserTest, RTCMMavlinkTest, and RTCMUdpInputTest pass locally.