Skip to content

fix(gps): release base position when selecting GPS output - #238

Closed
HTRamsey wants to merge 1 commit into
PX4:mainfrom
HTRamsey:fix/receiver-position-mode
Closed

HTRamsey wants to merge 1 commit into
PX4:mainfrom
HTRamsey:fix/receiver-position-mode

Conversation

@HTRamsey

@HTRamsey HTRamsey commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Receivers previously configured as fixed or surveying bases can remain in that state when switched to navigation output. Release the base position during configuration so navigation can resume.

  • UBX: disable time mode on detected M8P, F9P, and X20 receivers for both GPS and GPS+RTCM output, including heading-rover and moving-base configurations. Require survey-stop confirmation before reporting readiness or enabling GPS+RTCM correction output.
  • Septentrio: restore Rover PVT mode for navigation and avoid enabling RTCM output in GPS-only mode.
  • Femto: stop position averaging and clear the fixed position before enabling navigation output. Buffer fragmented acknowledgments and stop promptly on I/O errors.

PX4 Autopilot impact

PX4 normally selects OutputMode::GPS; its main receiver uses GPSAndRTCM when RTCM communication dumping is selected. Both paths now release stale UBX time mode. This also applies to the rover and moving-base receivers used for GPS heading: they must compute their positions rather than retain a stationary base position. See PX4's output-mode selection.

The additional checks run during receiver configuration, including startup and reconfiguration. UBX requires an acknowledged disable command and stop confirmation, with a roughly three-second confirmation deadline. Femto requires acknowledgments for POSAVE OFF and FIX NONE. If these checks fail, configuration returns an error and PX4 retries or continues protocol detection. Receiver/firmware compatibility with these stricter checks still needs physical validation.

The Femto changes apply when PX4 builds and selects that protocol. The SBF changes do not affect PX4's generic GPS module, which does not compile this repository's sbf.cpp; see its driver source selection.

No PX4 caller API, parameter, or build-system changes were identified as necessary for this PR. Adoption requires updating the GPSDrivers submodule and rebuilding. The PX4 revision linked above pins 1b27986, so it does not yet contain this change. Explicit RTCM base-station configuration retains its existing fixed-position/survey behavior.

Validation

Linux CMake build and all 9 CTest tests passed; git diff --check passed. Regression coverage exercises GPS and GPS+RTCM navigation, stop-before-RTCM ordering, legacy and modern UBX protocols, rejected commands, stop timeouts, read cancellation, and fragmented Femto replies with binary noise.

PX4 firmware builds and physical receiver validation were not performed for this PR.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

UBX GPS+RTCM navigation still leaves previously configured time mode enabled.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Releases stale GNSS base-station configuration when returning receivers to navigation output.

Changes:

  • Disables UBX, Septentrio, and Femto base-position modes.
  • Improves fragmented Femto acknowledgment handling.
  • Adds receiver-mode regression coverage.
File summaries
File Description
src/ubx.cpp Disables UBX time mode and confirms survey stop.
src/ubx.h Adds UBX time-mode state and helper declaration.
src/sbf.cpp Restores rover mode and limits RTCM output.
src/femtomes.cpp Clears base mode and buffers acknowledgments.
tests/gps-ubx-test.cpp Covers UBX navigation transitions and failures.
tests/gps-receiver-mode-test.cpp Tests Septentrio and Femto mode changes.
tests/CMakeLists.txt Registers the new receiver-mode test.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ubx.cpp Outdated
@HTRamsey
HTRamsey force-pushed the fix/receiver-position-mode branch from c130f3d to 8894022 Compare September 9, 2026 01:01
@HTRamsey
HTRamsey requested a review from dakejahl September 9, 2026 01:08
@HTRamsey
HTRamsey force-pushed the fix/receiver-position-mode branch from 8894022 to b5a128b Compare September 9, 2026 01:36
@HTRamsey

HTRamsey commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

just copying these in to QGC manually instead

@HTRamsey HTRamsey closed this Sep 9, 2026
@HTRamsey
HTRamsey deleted the fix/receiver-position-mode branch September 9, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants