Skip to content

Round time mode accuracies in the direction that keeps their meaning - #510

Open
jclark wants to merge 5 commits into
masterfrom
tmode-acc-rounding
Open

jclark wants to merge 5 commits into
masterfrom
tmode-acc-rounding

Conversation

@jclark

@jclark jclark commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Stacked on #509.

Receivers that store the survey accuracy limit and fixed position accuracy in coarser units than requested round to nearest. The survey limit is a threshold the survey must reach, so rounding it up lets the survey accept a worse accuracy than requested; the fixed position accuracy is a claim about the position, so rounding it down makes the receiver state a better accuracy than requested.

The survey limit now rounds down, to at least one unit when positive, the strictest the receiver can express; the fixed position accuracy rounds up. Each conversion is a pair: ubx tmodeAcc and tmodeAccLimit (to 0.1 mm) and tmodeAccMm and tmodeAccLimitMm (0.1 mm to mm), and casic tmode2Acc and tmode2AccLimit (mm). A preliminary commit keeps the casic accuracies as Length until encoding, so that CFG-TMODE2 can round in a given direction without float error.

A last commit applies the same rule to the ubx CFG-VALSET path's way of forcing a new survey: it changed an unchanged survey limit by increasing it 0.1 mm, and now decreases it unless it is already 0.1 mm.

make test passes.

tmodeTarget held the fixed position accuracy and survey accuracy limit
as float meters, a form suited to V5 CFG-TMODE, which sends them as
float variances. V6 CFG-TMODE2 sends them as integer millimeters, so it
converted the floats back with math.Round. Keep them as Length, convert
to float meters only for V5, and convert to millimeters for V6 with
integer arithmetic, so that V6 can round in a given direction without
float error. V5 is unchanged; V6 differs only for some exact
half-millimeter lengths from 500.5 mm up, which the float version
rounded down by float error.
Receivers that store the survey accuracy limit and fixed position
accuracy in coarser units than requested rounded to nearest. The survey
limit is a threshold the survey must reach, so rounding it up made the
survey accept a worse accuracy than requested; the fixed position
accuracy is a claim about the position, so rounding it down made the
receiver state a better accuracy than requested.

The survey limit now rounds down, to at least one unit when positive,
the strictest the receiver can express; the fixed position accuracy
rounds up. Each conversion is a pair: ubx tmodeAcc and tmodeAccLimit
(to 0.1 mm), tmodeAccMm and tmodeAccLimitMm (0.1 mm to mm, which gives
the same result as rounding the original value once), and casic
tmode2Acc and tmode2AccLimit (mm).
On receivers configured with CFG-VALSET, SurveyAgain forces a new
survey by changing the survey accuracy limit by 0.1 mm when it would
otherwise be unchanged. It increased the limit, so the new survey could
be satisfied by a slightly worse accuracy than requested. Decrease it
instead, unless it is already 0.1 mm, the strictest limit the receiver
can express.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T03:37:59.087515Z c35e6d2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	gps/internal/ubx/ubxcfgtmode.go
Base automatically changed from tmode-min-acc to master October 23, 2026 08:16

This branch has not been deployed

No deployments
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