Skip to content

GNSS RTK: Add basic integration #90890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ubieda
Copy link
Member

@ubieda ubieda commented May 30, 2025

Description

This PR introduces RTK (Real Time Kinematics) to GNSS modems by providing a path to feed RTK correction data (proposed on #90363).

Detailed changes:

  • Add APIs so RTK clients can be added (basic Serial client is added to demo).
  • Add APIs to allow RTK clients to publish correction data, and for GNSS drivers to feed such data to their modems (applied to UBX F9P driver).
  • Add RTCM3 protocol decoder (framing detection, validated with unit-test suite).
  • Add GNSS RTK sample with python script to convert a PC in a Base-Station (requires a F9P module USB-connected), which feeds data to a Zephyr-powered board (over Serial port).

Note

  1. This PR depends on F9P driver introduction: gnss: Add UBX F9P driver #90027
  2. This PR will be submitted to present at the Architecture WG.
    Adding DNM until both conditions are resolved.

@ubieda ubieda added the DNM This PR should not be merged (Do Not Merge) label May 30, 2025
@ubieda ubieda force-pushed the gnss/rtk-integration branch 5 times, most recently from e333b76 to a7984f5 Compare June 4, 2025 19:51
Copy link

sonarqubecloud bot commented Jun 4, 2025

Copy link
Member Author

@ubieda ubieda left a comment

Choose a reason for hiding this comment

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

Comments captured from Arch WG review 250701

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggestion: Move to drivers/gnss/*

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to subsys/gnss instead.

@ubieda ubieda force-pushed the gnss/rtk-integration branch 2 times, most recently from 9f187bf to 799ef56 Compare July 7, 2025 17:38
@ubieda ubieda removed the DNM This PR should not be merged (Do Not Merge) label Jul 7, 2025
@ubieda ubieda force-pushed the gnss/rtk-integration branch 3 times, most recently from 175d489 to 9e8bc2c Compare July 7, 2025 20:03
@ubieda ubieda force-pushed the gnss/rtk-integration branch from 9e8bc2c to 5a345fa Compare July 7, 2025 20:37
@ubieda ubieda marked this pull request as ready for review July 7, 2025 21:22
@ubieda ubieda force-pushed the gnss/rtk-integration branch from ff6359a to e365290 Compare July 9, 2025 16:15
@ubieda ubieda requested a review from fabiobaltieri July 9, 2025 16:30
bperseghetti
bperseghetti previously approved these changes Jul 9, 2025
Copy link
Member

@bperseghetti bperseghetti left a comment

Choose a reason for hiding this comment

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

This is a really great contribution!

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates basic Real Time Kinematics (RTK) support into the GNSS subsystem by adding RTCM3 decoding, an RTK publish/subscribe API, and a serial client, along with corresponding driver updates, tests, and samples.

  • Added RTCM3 CRC-24Q checksumming and frame-extraction API with unit tests.
  • Introduced gnss_rtk_publish_data and iterable callbacks to distribute correction data, plus a serial client to feed corrections.
  • Extended the UBX F9P driver and GNSS samples to consume and display RTK data, and added necessary Kconfig/CMake updates.

Reviewed Changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/crc/main.c Added test_crc24q_rtcm3 unit test
tests/subsys/gnss/rtk/rtcm3/testcase.yaml Defined native_sim test harness for RTCM3 decoder
tests/subsys/gnss/rtk/rtcm3/src/main.c Implemented frame-detection and CRC tests
subsys/gnss/rtk/decoder.h Declared RTK decoder API
subsys/gnss/rtk/rtk.c Implemented gnss_rtk_publish_data semaphore logic
subsys/gnss/rtk/protocol/rtcm3.c RTCM3 framing, length parsing, and CRC check
subsys/gnss/rtk/serial/serial.c Serial client ISR, ring buffer, work handler
include/zephyr/gnss/rtk/rtk.h Defined RTK data callback macros and types
include/zephyr/modem/ubx/protocol.h Added UBX DGNSS/RTK mode and flag constants
drivers/gnss/gnss_u_blox_f9p.c Hooked RTK data callback into UBX F9P init sequence
samples/drivers/gnss/src/main.c Updated sample to count and print RTK-corrected sats

* it or not depending on the RTCM3 message type and its alignment with what the
* GNSS modem has observed.
*/
(void)ubx_f9p_msg_send(dev, (const void *)data->data, data->len, false);
Copy link
Preview

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

The cast to const void * may conflict with the expected const struct ubx_frame * parameter of ubx_f9p_msg_send. Use (const struct ubx_frame *)data->data to avoid pointer-type mismatch warnings.

Suggested change
(void)ubx_f9p_msg_send(dev, (const void *)data->data, data->len, false);
(void)ubx_f9p_msg_send(dev, (const struct ubx_frame *)data->data, data->len, false);

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we should cast this to an UBX frame, as it's an RTCM3 msg. See commit:
modem: ubx: Change request buffer to be void

Incorporate the basic RTK API as well as a basic client integration
(serial) as a way to receive and publish the RTK data.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
@ubieda ubieda force-pushed the gnss/rtk-integration branch 2 times, most recently from 5bfe1a8 to 6167f47 Compare July 10, 2025 12:58
@ubieda ubieda force-pushed the gnss/rtk-integration branch from 6167f47 to a1b1bb3 Compare July 10, 2025 13:26
fabiobaltieri
fabiobaltieri previously approved these changes Jul 10, 2025
ubieda added 5 commits July 10, 2025 09:35
To be covered by existing Drivers: GNSS, as per requested during the
review process. Added myself as a collaborator to follow-up with
RTK-related changes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
To capture framing capabilities (only API so far).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
So this API can be used to send frames with a different encoding than
UBX. This enables UBX drivers to send RTCM3 correction frames using UBX
API, without having to switch over modem pipes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
Enable driver to consume RTK data-correction messages published
in order to enhance GNSS Navigation results.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
Expand this sample to also work with GNSS_RTK through a serial client.

Make this compatible to work with VMU_RT1170 which requires using the
F9P, instead of the M8 UBX module.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
Copy link

Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen left a comment

Choose a reason for hiding this comment

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

Nice work!

@danieldegrasse danieldegrasse added this to the v4.3.0 milestone Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants