Skip to content

Add gps_ublox_assistnow_autonomous for u-blox orbit prediction - #11895

Open
Raffi1202 wants to merge 6 commits into
iNavFlight:maintenance-10.xfrom
Raffi1202:feature/ublox-assistnow-autonomous
Open

Raffi1202 wants to merge 6 commits into
iNavFlight:maintenance-10.xfrom
Raffi1202:feature/ublox-assistnow-autonomous

Conversation

@Raffi1202

@Raffi1202 Raffi1202 commented Sep 10, 2026

Copy link
Copy Markdown

Problem

No issue is linked. INAV's u-blox auto-configuration never touches the receiver's AssistNow Autonomous (AOP) orbit prediction and there is no setting for it, so a user with an M8/M9/M10 module cannot enable the receiver-side feature that gives a faster fix after a cold start without an internet download.

Cause

src/main/io/gps_ublox.c:1154-1174 on maintenance-10.x (gpsConfigure): the M8-and-newer block sends the constellation configuration (configureGNSS / configureGNSS10) and ends. The driver has no UBX-CFG-NAVX5 write and no CFG-ANA-USE_ANA key (src/main/io/gps_ublox.h), and gpsConfig_t (src/main/io/gps.h:103) has no field for it.

Change

Adds the bool setting gps_ublox_assistnow_autonomous (default OFF) to settings.yaml, the field ubloxAssistNowAutonomous to gpsConfig_t, and bumps PG_GPS_CONFIG 6 -> 7. gps_ublox.h gains MSG_CFG_NAVX5, a packed 40-byte ubx_cfg_navx5_t (version 2) in the payload union, and the CFG-ANA-USE_ANA / CFG-ANA-ORBMAXERR keys. In gpsConfigure, after the constellation step on M8 and newer, the driver writes the ON/OFF state explicitly: UBX-CFG-NAVX5 (mask1 bit 14, aopCfg, aopOrbMaxErr 100) on M8, CFG-ANA-USE_ANA via ubloxSendSetCfgBytes on VALSET receivers, then waits for ACK or NAK with the existing GPS_CFG_CMD_TIMEOUT_MS.

Test

Cause verified by reading gps_ublox.c:1154-1174 on maintenance-10.x. Fork CI on head f95088f, all green: Build firmware (all targets + SITL) https://github.com/Raffi1202/inav/actions/runs/34622271716, Parameter Group Version Check https://github.com/Raffi1202/inav/actions/runs/34622271454, docs check https://github.com/Raffi1202/inav/actions/runs/34622271460. SITL (inav-9.1.0-ci-20260910-5832f31_SITL-WIN from https://github.com/Raffi1202/inav/actions/runs/34438768670): setting present as bool, default 0, MSP2_COMMON_SET_SETTING + MSP_EEPROM_WRITE store 1 and it reads back after reconnect. Not run on hardware: the UBX-CFG-NAVX5 / CFG-ANA-USE_ANA exchange with a real M8 or M10 and the effect on cold-start fix time are unverified. Configurator switch: iNavFlight/inav-configurator#2748.

Flash / RAM

Not measured yet. The upstream firmware CI has not been released for this PR, so no size report exists.

Docs

docs/Settings.md, regenerated from the new settings.yaml entry. No other file under docs/ on maintenance-10.x describes the u-blox auto-configuration sequence.

New bool setting (default OFF) that enables AssistNow Autonomous during
u-blox auto-configuration: UBX-CFG-NAVX5 with the AOP fields on M8,
CFG-ANA-USE_ANA over VALSET on M9/M10. The receiver then predicts
satellite orbits from its own earlier observations and fixes faster
after a cold start without an internet download. PG_GPS_CONFIG 6 -> 7,
Settings.md regenerated.
@Raffi1202

Copy link
Copy Markdown
Author

Configuration path checked with the CI-built SITL of this branch (fork run https://github.com/Raffi1202/inav/actions/runs/34438768670, inav-9.1.0-ci-20260910-5832f31_SITL-WIN): the setting exists as uint8_t bool, defaults to 0, MSP2_COMMON_SET_SETTING + MSP_EEPROM_WRITE store 1 and it reads back after a reconnect. The configurator switch for it is iNavFlight/inav-configurator#2748.

What the SITL cannot show is the receiver side: the UBX-CFG-NAVX5 / CFG-ANA-USE_ANA messages need a real M8 and M10 on the bench (u-center UBX-NAV-AOPSTATUS shows whether AOP is on). I will do that as soon as a module is on the desk; anyone with a module handy is welcome to confirm earlier.

@Raffi1202
Raffi1202 marked this pull request as ready for review September 11, 2026 16:06
@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add u-blox AssistNow Autonomous and harden PG version CI

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds optional u-blox orbit prediction for faster offline cold starts.
• Configures M8 through NAVX5 and newer receivers through VALSET, tolerating unsupported hardware.
• Hardens parameter-group version checks for arrays, conditionals, and workflow failures.
Diagram

graph TD
  A["CLI setting"] --> B["GPS config v7"] --> C["u-blox auto-config"] --> D{"Protocol support"} -->|M8| E["NAVX5 command"] --> G["u-blox receiver"]
  D -->|M9/M10| F["VALSET command"] --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Separate the shared CI repair

Recommendation: Merge PR #11885 first, then rebase this branch and remove the duplicated PG checker changes. The AssistNow implementation itself should retain separate NAVX5 and VALSET paths because receiver generations expose different configuration protocols, while explicit ON and OFF writes ensure deterministic auto-configuration.

Files changed (9) +150 / -10

Enhancement (4) +70 / -1
gps.cInitialize AssistNow configuration and bump the GPS PG version +2/-1

Initialize AssistNow configuration and bump the GPS PG version

• Adds the generated default for the new GPS configuration field and increments PG_GPS_CONFIG from version 6 to 7 for the changed persisted layout.

src/main/io/gps.c

gps.hPersist the AssistNow Autonomous option in GPS configuration +1/-0

Persist the AssistNow Autonomous option in GPS configuration

• Adds ubloxAssistNowAutonomous to gpsConfig_t so the setting is retained and available during receiver initialization.

src/main/io/gps.h

gps_ublox.cConfigure autonomous orbit prediction across u-blox generations +33/-0

Configure autonomous orbit prediction across u-blox generations

• Adds UBX-CFG-NAVX5 configuration for M8 and CFG-ANA-USE_ANA VALSET configuration for supported newer receivers. Auto-configuration applies the selected state after constellation setup and tolerates ACK, NAK, or timeout without blocking initialization.

src/main/io/gps_ublox.c

gps_ublox.hDefine u-blox AssistNow keys and NAVX5 payload +34/-0

Define u-blox AssistNow keys and NAVX5 payload

• Adds AssistNow Autonomous VALSET keys, the packed 40-byte UBX-CFG-NAVX5 version 2 payload, its union member, and the NAVX5 message identifier.

src/main/io/gps_ublox.h

Bug fix (1) +30 / -8
check-pg-versions.shHandle all PG registration forms and checker scope correctly +30/-8

Handle all PG registration forms and checker scope correctly

• Extracts versions from the final registration argument, ignores macro definitions and invalid struct tokens, and compares every conditional registration between commits. It also removes an invalid top-level local declaration that could abort the checker.

.github/scripts/check-pg-versions.sh

Tests (1) +20 / -0
test-check-pg-versions.pyAdd regression fixtures for the PG version checker +20/-0

Add regression fixtures for the PG version checker

• Creates temporary Git repositories to verify unchanged, missing, bumped, array, and conditional PG registrations. It also ensures checker execution avoids shell integer-expression failures.

.github/scripts/test-check-pg-versions.py

Documentation (1) +10 / -0
Settings.mdDocument AssistNow Autonomous behavior and requirements +10/-0

Document AssistNow Autonomous behavior and requirements

• Adds generated documentation for the new setting, including its default-off behavior, offline orbit prediction purpose, and receiver backup-power requirement.

docs/Settings.md

Other (2) +20 / -1
pg-version-check.ymlTest the PG checker and safely propagate workflow output +15/-1

Test the PG checker and safely propagate workflow output

• Runs checker regression tests when the script or workflow changes and treats incomplete or abnormal checker runs as failures. Multi-line checker output is passed to JavaScript through an environment variable to prevent syntax errors.

.github/workflows/pg-version-check.yml

settings.yamlExpose the AssistNow Autonomous boolean setting +5/-0

Expose the AssistNow Autonomous boolean setting

• Defines gps_ublox_assistnow_autonomous as an OFF-by-default boolean mapped to ubloxAssistNowAutonomous. The description clarifies that OFF explicitly disables the feature during auto-configuration.

src/main/fc/settings.yaml

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 11, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Valid conditional changes fail checks ✓ Resolved 🐞 Bug ≡ Correctness
Description
check_file_for_pg_changes requires every registration for a type to increase even when conditional
compilation gives those registrations different stored layouts. When a field behind
USE_AUTO_TRANSITION changes and only its corresponding version is correctly bumped, the unchanged
alternative makes the workflow fail and prevents the valid pull request from merging.
Code

.github/scripts/check-pg-versions.sh[R149-151]

+                        for version_index in "${!old_versions[@]}"; do
+                            if [ "${new_versions[$version_index]}" -le "${old_versions[$version_index]}" ]; then
+                                versions_increased=false
Evidence
The repository explicitly keeps two systemConfig_t versions because USE_AUTO_TRANSITION changes
the stored layout, and the structure shows those fields exist only under that condition. The new
loop nevertheless compares both registrations and marks the result as failed whenever either
unchanged alternative does not increase.

.github/scripts/check-pg-versions.sh[139-155]
src/main/fc/config.c[106-110]
src/main/fc/config.h[75-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The parameter-group checker compares every conditional registration positionally and requires all versions to increase, even when each registration represents a different compiled structure layout. A change confined to one conditional layout therefore fails unless an unaffected layout is also version-bumped, which would unnecessarily reset settings on those targets.
## Fix Focus Areas
- .github/scripts/check-pg-versions.sh[139-155]
- .github/scripts/test-check-pg-versions.py[3-19]
- src/main/fc/config.c[106-110]
- src/main/fc/config.h[75-100]
## Recommended Fix
Associate structure changes and registrations with their relevant preprocessor conditions, then require a bump only for registrations whose compiled layout changed. Add a regression fixture where a field exists only in one conditional branch and verify that bumping only that branch's registration passes while failing to bump that branch still fails.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread .github/scripts/check-pg-versions.sh Outdated
Raffi1202 and others added 2 commits September 11, 2026 18:29
Those files belong to iNavFlight#11885, which replaces check-pg-versions.sh with a
Python checker. Carrying a copy here only produces a conflict once either
lands, and it is unrelated to this change.
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.

1 participant