Repository navigation
nav: CoPH's plant, potential, command and allocation (C2; G2, G3, G11) - #1228
Merged
Merged
Conversation
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.
The function-local static in coph_profile_modes() is process-wide state, which libcvc does not keep; package-linux's singleton scan refused it.
C2 of docs/roadmap/NAV-COPH-ROADMAP.md: the C++ twin of GRL-SNAM's grl_snam.coph.model and grl_snam.coph.allocation. inc/cvc/nav/coph_model.h (coph_model.cpp, built with -ffp-contract=off): - coph_flow and coph_balance: the exact held-force flow and its energy balance, in the Python's order. At small damping the closed forms are ill-conditioned (dt - I cancels to about d dt^2 / 2; the heat sums terms of size |u|^2 / d), and one ULP of expm1 moves q_after by about 1e-8. So the plant uses coph_exp and coph_expm1, correctly rounded (double-double, rounded once), not std::expm1, which MSVC's CRT misses at most of G2's arguments. - coph_risk, coph_potential and coph_grad_potential (analytic, replacing autograd), legacy and progress shaping, the barrier over disks and slabs; coph_shaping_parameters and coph_shaping_for (alpha and its bound, once per stage); coph_command (-grad V - 1.4 v, scaled to the limit, applied and proposed). Templated on the scalar and instantiated in coph_model.cpp (double here; C3 adds its duals). No Wendland term: the demos never set Stage.local_residual (D7). Transcendentals are cvc::algo::det's. - coph_energy: work, heat, kinetic change and residual summed by step, the shaping jumps, and the unallocated work e . dq. Its plant_ledger items come with C5, which attaches CoPH to a vehicle (D11). inc/cvc/nav/coph_allocation.h: coph_allocate, the Ackermann allocation of §3.3.2 (speed floor 0.5 m/s, as GRL-SNAM's SPEED_FLOOR), which C5 will use. The golden in src/cvc/tests/data is now GRL-SNAM main's (CVC-Lab/GRL-SNAM#170, blob b96cc0c), with G2, G3 and G11 beside C1's G1 and G4. nav_coph_model_test reproduces them at the FLOAT64 tier (rtol 1e-12, atol 1e-12): on Windows, G2 bit for bit in all 320 values, G3 and G11 within 0.1 % of the allowance. It also checks coph_exp and coph_expm1 bit for bit against mpmath at 198 arguments (G2's 71 among them), the analytic gradient against central differences, and that the energy account closes over 2,000 steps (summed residual 2e-16 against 3.8 of work). nav_coph_test passes on the new golden. The roadmap's §3.3.2 (the speed floor), §3.4 (the tiered golden), §4.1, §4.2 and §5 (G3's scenes, atol) now say what landed.
Conflicts: the roadmap, coph_golden.json and both CMakeLists.txt; each takes C2's side, which already held C1's lines. The diff from master is C2's own.
transfix
enabled auto-merge (squash)
November 15, 2026 20:36
transfix
added a commit
that referenced
this pull request
Nov 16, 2026
- script_engine.cpp: #1283 factors the sliced form's process lookup into calling_process, which run_as_program_work (a client's WebAssembly guest, run as its client's program) shares. The lookup keeps this branch's group: the calling process is on the group whose pump runs the call (an isolated document's), else on group 0. - STATE_EXEC_THREADED.md: notes that run_as_program_work shares the lookup.
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.
C2 of
docs/roadmap/NAV-COPH-ROADMAP.md: CoPH's plant, potential, command and allocation in C++, the twin of GRL-SNAM'sgrl_snam.coph.modelandgrl_snam.coph.allocation. They are checked against GRL-SNAM's golden cases G2, G3 and G11 (CVC-Lab/GRL-SNAM#170).C1 landed first as #1210 (squash 5b5b3bf). Master is merged in (1975173), so this diff is C2's alone. The merge's conflicts (the roadmap,
coph_golden.json, bothCMakeLists.txt) each take C2's side, which already held C1's lines.What lands
inc/cvc/nav/coph_model.h(coph_model.cpp, built with-ffp-contract=off):coph_flow,coph_balance. The exact held-force flow and its energy balance, in the Python's order.coph_exp,coph_expm1. Correctly rounded: evaluated in double-double, rounded once, using only IEEE operations, so they give the same bits on every platform. The plant needs them (below).coph_risk,coph_potential<T>,coph_grad_potential<T>.coph_shaping_parameterscomputes alpha and its bound once per stage;coph_shaping_forpicks byshaping_mode).coph_model.cpp, so they compile under its flags. Onlydoublehere; C3 adds its duals.coph_command<T>.−∇V − 1.4 v, scaled to the limit; it returns the applied force and the proposed one.coph_energy. Per agent:e · Δq.inc/cvc/nav/coph_allocation.h.coph_allocate, §3.3.2's Ackermann allocation, which C5 will use. The speed floor is 0.5 m/s, as GRL-SNAM'sSPEED_FLOOR.src/cvc/tests/data/coph_golden.json. Now GRL-SNAM main's (blob b96cc0c1), which adds G2, G3 and G11 to C1's G1 and G4.nav_coph_model_test. New; see Checks.atol.Decisions in it
Correctly rounded
expm1, notstd::expm1. At small damping the closed forms are ill-conditioned:dt − Icancels to aboutd dt²/2;|u|²/d.One ULP of
expm1movesq_afterby about 1e-8 at d = 1e-8, a thousand times the tier; a test pins that. torch'sexpm1is correctly rounded at all of G2's arguments; MSVC's CRT misses at most of them. §4.2 saidstd::expm1, and now says this.No Wendland term. The demos never set
Stage.local_residual, so the local residual is outside the profile (D7).The potential's transcendentals are
cvc::algo::det's, which give the same bits on every platform.log1pis built ondet::log(Goldberg's form).coph_energy'splant_ledgeritems come with C5, which attaches CoPH to a vehicle (D11). This PR has only the account.Checks
nav_coph_model_testpasses all 10 tests.coph_expandcoph_expm1: bit for bit against mpmath at 198 arguments, G2's 71 among them, plus the special values.nav_coph_test: passes its 12 tests on the new golden.-ffp-contract=off) and Windows among them. CI re-runs on 1975173; the merged tree also passes both test binaries locally.