Repository navigation
coph_golden: the golden libcvc's C++ twin of grl_snam.coph reproduces (CoPH T5: G1, G4) - #168
Merged
Merged
Conversation
… (G1, G4) T5 of libcvc's NAV-COPH-ROADMAP.md (§3.4, §5). python -m grl_snam.tools.coph_golden --out DIR writes coph_golden.json, with every double as its raw bits (16 hex digits). It covers the C1 cases: - G1: 74 Config and 5 CommunicationConfig cases. Accepted ones record every field after __post_init__ and the fields outside the demos' profile; refused ones record the message. Every refusal is covered, plus check order. - G4: the stage ledger of the demos' own learner (CrossingLearner) along a 360-tick scripted path, under three configurations, as per-tick deltas. The file states the rules; the test rebuilds every tick from them in plain Python. The demos' MazeLearner advances along either axis, pools every kept stage's readings and never sets anchors, so the overlap continuity rows are empty in the profile. G4 pins that rule, not Learner.advance. The generator refuses a script whose BLAS-dot decisions sit within 1e-9 of a threshold. tests/test_coph_golden.py regenerates the file and compares bytes with tests/fixtures/coph_golden; .gitattributes keeps its line endings.
This was referenced Nov 13, 2026
transfix
added a commit
to transfix/libcvc
that referenced
this pull request
Nov 15, 2026
C1 of docs/roadmap/NAV-COPH-ROADMAP.md: the C++ twin of GRL-SNAM's grl_snam.coph (CoPH-Stagewise, vendored at c1f1ff3), up to the stage ledger. inc/cvc/nav/coph_config.h: - coph_config and coph_communication_config: every field of Config and CommunicationConfig, with Python's defaults; modes are strings, as in Python. validate() is __post_init__: the same refusals with the same messages, in the same order, and it fills replay_update_cap the same way. Python's min() is mirrored, so NaN scales pass where upstream's do. - outside_profile() and require_profile(): the mode fields that differ from the demos' profile, which the twin refuses (D7). coph_profile() and coph_communication_profile() are the demos' configurations. inc/cvc/nav/coph_ledger.h (built with -ffp-contract=off): - coph_shape (disk or slab), coph_reading, coph_transition, coph_footprint, coph_observation, coph_stage (new_stage, contains) and coph_intersects. - coph_ledger: the current stage and the previous cfg.previous, with observe, advance and set_geometry. The geometry store comes from the navigation layer. The demos' learner is crossing_demo.CrossingLearner, a MazeLearner, and its rule is not Learner.advance's, which the roadmap first described. It advances along whichever axis left the inner box, in either direction (y steps are 2.8 m), pools the readings and footprints of every kept stage, and never sets Stage.anchors, so _field_fit's overlap continuity rows are always empty in the demos. The ledger implements that rule; the roadmap's §1, §4.1, §4.3 and G4 now say so. The golden is written by GRL-SNAM (grl_snam.tools.coph_golden, CVC-Lab/GRL-SNAM#168) and committed in src/cvc/tests/data, the same blob as GRL-SNAM's tests/fixtures copy. nav_coph_test reproduces it bit for bit: - G1: all 74 Config and 5 CommunicationConfig cases (acceptance, Python's message, every value, the fields outside the profile, and that the ledger refuses those); - G4: every tick of the 360-tick script under its three configurations: each advance and its axis, each new stage's fixed fields, and each kept stage's readings, transitions, footprints and obstacles. C++-only tests cover upstream's NaN behaviour, require_profile's message, a sensor-less observation and a repeated uid across stages. * nav: coph_profile_modes returns its list by value (the singleton scan) The function-local static in coph_profile_modes() is process-wide state, which libcvc does not keep; package-linux's singleton scan refused it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is T5 of libcvc's CoPH roadmap (
docs/roadmap/NAV-COPH-ROADMAP.md§3.4 and §5): the golden that libcvc's C++ twin ofgrl_snam.cophwill be pinned to. It builds on T1 (#166) and lands before C1.python -m grl_snam.tools.coph_golden --out DIR # writes DIR/coph_golden.jsonEvery double is its raw bits: 16 hex digits of the uint64, most significant first. The file is the same bytes on every run and OS. libcvc commits it in
src/cvc/tests/data, and GRL-SNAM keeps a copy intests/fixtures/coph_golden..gitattributeskeeps git from converting its line endings.It covers the C1 cases, the records and the stage ledger (G1 and G4). Later C steps add theirs, the way the belief-material controller's golden (#164) did.
G1: the configuration
Configand 5CommunicationConfigcases.__post_init__, which fillsreplay_update_cap;__post_init__'s message.__post_init__and checks that the golden's messages are exactly itsraise ValueErrorset;replay_update_capgets filled, and modes__post_init__accepts that lie outside the profile;G4: the stage ledger, and a correction for C1
The demos' learner is
crossing_demo.CrossingLearner, amaze_learning.MazeLearner. Its stage rule is notlearner.Learner.advance's, which is the rule the roadmap's §1 and C1 describe:delta > size * (1 - overlap) / 2), bysize * (1 - overlap)in either direction. So y steps are 2.8 m, not 2.1 m.sample_cap. It also pools their footprints.Stage.anchors._field_fit's overlap continuity rows read those anchors, so they are always empty in the demos.G4 pins the demos' rule, and C1 should implement that one.
The case. One scripted path of 360 ticks, run under three configurations:
previous3 andoverlap0.5;previous0 with no overlap and 2.5 × 3.5 m stages.The path runs out along the middle row to the door, waits there 20 ticks, comes back, then goes down the west column, along the south row, up the east column and along a diagonal. So stages advance along both axes in both directions, and on the diagonal the axis comes from
delta / size.What each tick records:
Each stage's fixed fields are recorded once, when it is made: centre, entry, target, RBF centres, weights and version. Every cap fills: 240 readings and 120 footprints in the profile, and all three small caps.
The rules. The file states them in full (
stage_rules).tests/test_coph_golden.pyrebuilds every tick of all three configurations from the file's inputs and those rules alone, in plain Python, so the rules the C++ follows are complete.Cross-platform. Most of the ledger's arithmetic is single IEEE operations. The tests that go through a BLAS dot (
intersects'd @ d, the store's distance filter, slab visibility) could differ in the last bit between platforms. So the generator refuses a script where any of them sits within 1e-9 of its threshold. The first script it refused had a real tie: an obstacle exactly 1.25 m from a path point.Size
444 KB: the configuration cases 55 KB, the script 105 KB, and the three ledgers 67 to 123 KB each. Recording deltas rather than full lists brought it down from 1.18 MB.
Tests and checks
tests/test_coph_golden.py, 9 tests:VENDORED.mdgains a Goldens section, and a step in Re-syncing to regenerate the golden. No vendored module changes.