Repository navigation
nav: CoPH's packets, their assimilation and the channel (C4; G9-G10) - #1410
Merged
Merged
Conversation
C4 of docs/roadmap/NAV-COPH-ROADMAP.md (section 4.4), additive and default-off: nothing calls it
yet; C5's fleet driver will.
- coph_packet.h: the demos' packet (cooperative.Packet, then MazePacket's geometry), and bytes():
the length of its compact, key-sorted JSON, with Python's repr for floats (coph_repr, from
std::to_chars's shortest digits) (D9). coph_exchange_state holds the received packets, the
route evidence and its cells, and the reported geometry.
- coph_exchange.h:
- coph_export: CooperativeLearner's bootstrap and candidate anchors, TerrainLearner's
risk-ordered anchors and second bootstrap, MazeLearner's geometry. The resample indices are
injected, or drawn from a seeded std::mt19937 through detail::pick_below (D8).
- coph_assimilate: MazeLearner's geometry checks; CooperativeLearner's schema, provenance, age,
order, payload and received cap; TerrainLearner's route evidence.
- coph_expire and the two refreshes.
- coph_fit_messages: the legacy receiver's whitened Gauss-Newton step, which coph_update now
commits when packets are held.
- coph_channel.h: the transport interface and coph_ideal_channel (seeded delay and jitter, drops,
duplicates, an optional range).
- detail/coph_math.h: the features, Cholesky and slab distance that coph_learner.cpp and
coph_exchange.cpp share (moved out of coph_learner.cpp unchanged).
nav_coph_exchange_test reproduces GRL-SNAM's G9 and G10 (CVC-Lab/GRL-SNAM#201;
data/coph_golden.json is its fixture). Every decision and byte count matches exactly, and the
values come within 0.074 of the tier's allowance on Windows. It also checks the channel's
statistics, production draws and JSON escapes.
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.
C4 of
docs/roadmap/NAV-COPH-ROADMAP.md(§4.4): the demos' packets in C++, their assimilation, and the channel they travel through. Additive and default-off: nothing calls it yet; C5's fleet driver will.Depends on CVC-Lab/GRL-SNAM#201 (the G9–G10 generator).
src/cvc/tests/data/coph_golden.jsonis that PR's fixture, the same blob (5bb26ee9). G1–G8 and G11 are unchanged. #201 merges first.What lands
inc/cvc/nav/coph_packet.hcoph_packetis the demos' packet:cooperative.Packet's fields in order, thenMazePacket's geometry.bytes()is the length of its compact, key-sorted JSON (D9). Floats usecoph_repr, which writes Python'sreprfromstd::to_chars's shortest digits, with ansnprintf/strtodfallback where floatingto_charsis missing.coph_exchange_stateholds:(timestamp, stage);TerrainLearner's route evidence and its 0.2 m cells;MazeLearner's local and remote geometry reports.inc/cvc/nav/coph_exchange.hcoph_exportruns all three layers:CooperativeLearnerfits the 8-member block bootstrap and anchors at candidates around the agent;TerrainLearnerre-anchors at the riskiest supported readings with a second bootstrap;MazeLearneradds the geometry.The resample indices are inputs (D8). The golden injects the Python's; in production,
coph_draw_blocksdraws them from a seededstd::mt19937throughdetail::pick_below, the same on every standard library.coph_assimilateruns:MazeLearner's geometry checks;CooperativeLearner's convention, provenance, age, order and payload checks, and the received cap;TerrainLearner's route evidence, including theremote_route_onlyscope.coph_expire,coph_refresh_terrain,coph_refresh_geometry.coph_fit_messages: the legacy receiver's Gauss–Newton step per stage, with an analytic Jacobian, whitened bychol(C + (0.01 + 0.005 age) I)and clamped to ±0.5.coph_updatenow expires the held packets first and commits this step's weights when packets are held. With nothing received it is unchanged, and G5–G8 still pass bit for bit where they did.inc/cvc/nav/coph_channel.h: thecoph_channelinterface (send(from, to, packet, bytes, at_s),poll(agent, now_s)) andcoph_ideal_channel, with seeded delay and jitter, drops, duplicates and an optional range. libcvc gains no dependency on cvcdbg.inc/cvc/nav/detail/coph_math.h: the RBF features, Cholesky and its solves, and the slab distance, moved unchanged out ofcoph_learner.cppsocoph_exchange.cppshares them.src/cvc/tests/nav_coph_exchange_test.cpp: G9, the repr and byte cases, and G10. It also has C++-only tests:Results on Windows (MSVC 19.44, Release)
json()writes export 0's packet character for character. All 43 repr cases match.nav_coph_learner_test(G5–G8, unchanged numbers),nav_coph_test(12) andnav_coph_model_test(10) still pass. clang-format 18 is clean on the touched files.Where the spec met the code
The roadmap's §4.4 now has a Landed note recording these:
MazePacket, and export and assimilation run three layers, not one.coph_learner_stategains it, along with the agent id, the clock and the exchange state.Joe approved merging C4 when green ("merge C4 when green and continue", 2026-11-20). It merges once every check has passed, after #201.