Repository navigation
pycvc: CoPH's kernels, NavCophAgent and NavCophFleet (C6 part 1) - #1504
Merged
Merged
Conversation
bindings/pycvc/pycvc_nav_coph.i puts cvc::nav's CoPH in pycvc. It only marshals between Python
values and the library.
- Kernels: nav_coph_flow, nav_coph_balance, nav_coph_risk, nav_coph_potential,
nav_coph_grad_potential, nav_coph_command, nav_coph_shaping and nav_coph_allocate. A packet's
bytes are NavCophPacket.bytes(), its json()'s length (D9).
- Configurations are dicts over the demos' profile, keyed by coph_config's field names. An unknown
key is an error, and validate() runs on the result. nav_coph_profile() and
nav_coph_communication_profile() return the whole of each.
- NavCophAgent is one learner, a crossing one or a car's (network="none"): observe, advance,
action, last_control, update, export_to (a NavCophPacket) and assimilate.
- NavCophFleet is the runner's fleet:
- run_crossing() on the crossing world, with the GIL released; the sensor noise may be a Python
callable, which takes the GIL back for each call;
- boundary() for a world of the caller's;
- samples, controls, updates, events and the energy accounts.
test_pycvc_nav_coph.py (ctest pycvc_nav_coph) checks:
- G2, G3 and G11 from coph_golden.json at its tier;
- the configuration dicts;
- a learner driven on the plant kernel exporting a packet that a second learner assimilates;
- a car's learner;
- the fleet on G12's crossing world and noise, as CophFleet.TheEnergyAccountStaysAtRoundOffOverALongRun
runs it: both agents reach their goals, in 767 and 784 steps, with residuals at 7e-15.
transfix
enabled auto-merge (squash)
November 23, 2026 21:34
…ion-local static pycvc-linux's writable-data scan (tools/singleton_scan) flagged config_fields()' static std::map and its guard variable as new process-wide state in pycvcPYTHON_wrap.cxx. The table is now a constexpr array of names and plain function pointers, which the compiler places in read-only data (.data.rel.ro under PIC) with nothing initialised at run time; a lookup walks it. Behaviour is unchanged: test_pycvc_nav_coph.py still passes its 1278 checks, as do test_pycvc_ph.py and test_pycvc_nav_lab.py.
This was referenced Nov 24, 2026
transfix
added a commit
that referenced
this pull request
Nov 24, 2026
This was referenced Nov 24, 2026
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.
C6 part 1 of
docs/roadmap/NAV-COPH-ROADMAP.md(§4.6): cvc::nav's CoPH in pycvc. The newbindings/pycvc/pycvc_nav_coph.ionly marshals between Python values and the library.The surface
nav_coph_flow,nav_coph_balance,nav_coph_risk,nav_coph_potential,nav_coph_grad_potential,nav_coph_command,nav_coph_shapingandnav_coph_allocate.{"centers", "weights", "width", "obstacles"}.(x, y, r)for a disk, or(x, y, r, hx, hy)for a slab.coph_profile(), D7), keyed bycoph_config's field names.validate()runs on the result.nav_coph_profile()andnav_coph_communication_profile()return the whole of each.NavCophAgent: one learner, either a crossing one or a car's (network="none"). It hasobserve,advance,action,last_control,update,export_to(which returns aNavCophPacket),assimilateandstate.NavCophPacket:json(),bytes()(D9),identity(),sender(),recipient(),version()andanchors().NavCophFleet: the runner's fleet.run_crossing(world)runs on the crossing world with the GIL released. The sensor noise can be a Python callable, which takes the GIL back for each call.boundary()serves a world of the caller's.samples,controls,updates,eventsandenergy.Checked on Windows (Release, MSVC 19.44, Python 3.11, SWIG from the cvcpkg tools prefix)
test_pycvc_nav_coph.py(ctestpycvc_nav_coph) passes 1278 checks:src/cvc/tests/data/coph_golden.json, the same file the C++ tests read.bytes()is its JSON's length, the keys are sorted, and a second learner assimilates it. A car's learner routes without a network.CophFleet.TheEnergyAccountStaysAtRoundOffOverALongRun: both agents reach their goals, in 767 and 784 steps, with residuals of 7.5e-15 and 7.0e-15. Packets were sent and delivered.test_pycvc_ph.py(35 checks) andtest_pycvc_nav_lab.py(147 checks) still pass. The build hadCVC_BUILD_PYCVC_GL=OFF, since this box has no cvcGL; this PR doesn't touch pycvc_gl.Next
C6 part 2 is
--controller cophin the cars template, then the browser demo.