Repository navigation
nav: the belief-material controller's contract and inputs (C1) - #1071
Merged
Merged
Conversation
C1 of docs/roadmap/NAV-BELIEF-MATERIAL-CONTROLLER-ROADMAP.md: the C++ twin of
GRL-SNAM's BeliefMaterialController, up to the model inputs. Joe settled
decisions E1-E10 on the recommended column ("Yes, start C1"), and the spec now
records them as settled.
inc/cvc/nav/belief_material_controller.h (built with -ffp-contract=off):
- belief_material_contract: the .cvcnm meta record (grl_snam.belief_material).
from_meta parses it with a small JSON reader that behaves like Python's
json.loads: NaN/Infinity, last duplicate key wins, locale-free numbers. It
accepts only JSON numbers and a string frame (E6). to_meta writes
byte-for-byte what Python's json.dumps(sort_keys=True) writes, using Python's
float repr.
- belief_header_mismatches: the .cvcnm v2 belief block against the belief and
patch settings, within 1e-6 (E7).
- belief_runtime_mismatches: a material_config against the contract.
- material_config_for: the config a contract implies on a grid. The gate
horizon is Python's 25 m rounded half-even to cells; libcvc's 12-cell
default would look 180 m ahead on the Austin 15 m grid.
- belief_material_controller: a loaded net that passed those checks, with
check_runtime.
- build_belief_material_controller_inputs: robot-relative float32 tokens in
numpy's operation order, and the 3-channel patch centred on the float32
position.
- visible_obstacles: the twin of scan_visible_geometry. Equal distances are
kept in row-major order (E5).
The golden (G1-G5) is written by GRL-SNAM
(grl_snam.tools.belief_material_controller_golden, CVC-Lab/GRL-SNAM#164, on
#163's E5/E6 changes) and committed in src/cvc/tests/data.
nav_belief_material_controller_test reproduces it bit for bit; the goal
token's dist may differ by 1 ulp because numpy's norm can go through BLAS. The
planes the tokens are cropped from hash to belief_material_golden.json's
values, so they are libcvc's own belief planes.
pycvc gains nav_belief_material_contract, nav_belief_material_contract_to_meta,
nav_belief_material_check_cvcnm, nav_visible_obstacles and
nav_belief_material_controller_inputs; refusals raise ValueError.
test_pycvc_nav_belief_controller.py checks them against the same golden.
…erial-controller-c1
clang-tsan's build (clang with libstdc++ 13) refused json_value's std::vector<std::pair<std::string, json_value>>: the pair needs json_value complete inside its own definition. A vector of an incomplete type is fine in C++17, so the object now holds obj_keys and obj_vals side by side.
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 C1 of
docs/roadmap/NAV-BELIEF-MATERIAL-CONTROLLER-ROADMAP.md(spec merged in #1053): the C++ twin of GRL-SNAM'sBeliefMaterialController, up to the model inputs. On "Yes, start C1", the spec's decisions E1–E10 are settled on the recommended column, and the spec now records that (§9).What's in it
inc/cvc/nav/belief_material_controller.his compiled with-ffp-contract=off(/fp:preciseon MSVC), likebelief_material.cpp. It has:belief_material_contract, the.cvcnmmetarecord (grl_snam.belief_material).from_metauses a small JSON reader that behaves like Python'sjson.loads: it acceptsNaN/Infinity, the last of duplicate keys wins,\uescapes decode, numbers are read locale-free, and trailing text is refused.to_metawrites exactly the bytes of Python'sjson.dumps(sort_keys=True), with Python's float repr (20.0,1e-05,1e+16,5e-324).belief_header_mismatches/belief_runtime_mismatches: the §1.2 and §1.3 checks. They compare within 1e-6 (E7) and use Python's field names.material_config_for: thematerial_configa contract implies on a grid. The gate horizon is Python's 25 m rounded half-even to cells. libcvc's 12-cell default would look 180 m ahead on the Austin 15 m grid.belief_material_controller: a loaded net that passed those checks, infrom_cvcnm's order, pluscheck_runtime.build_belief_material_controller_inputs: robot-relative float32 tokens in numpy's operation order, and the 3-channel patch centred on the float32 position.visible_obstacles: the twin ofscan_visible_geometry. Distances are computed in f64 from the f32 centres; equal distances keep row-major order (E5).pycvc gains
nav_belief_material_contract,nav_belief_material_contract_to_meta,nav_belief_material_check_cvcnm,nav_visible_obstaclesandnav_belief_material_controller_inputs. Refusals raiseValueError.The golden comes from Python
src/cvc/tests/data/belief_material_controller_golden.{json,cvcnm}is written by GRL-SNAM'sgrl_snam.tools.belief_material_controller_golden(CVC-Lab/GRL-SNAM#164). That generator is stacked on CVC-Lab/GRL-SNAM#163, the E5 stable sort and E6 strict types. Every float32 is stored as raw bits.nav_belief_material_controller_test(11 tests) reproduces it:to_metafor the 10 accepted, a refusal for the 18 others.cvcnmagainst 12 belief/patch settingsmaterial_configs, plusmaterial_config_foron 8 cell widthsdist: 1 ulp, numpy's norm may use BLAS)max_obstacles36 and 5, and a 9 × 9 scene of equal distancesThe golden carries the planes the tokens are cropped from. The test checks that their SHA-256 equals
belief_material_golden.json's, so they are the planes libcvc's own belief kernels build.bindings/pycvc/test_pycvc_nav_belief_controller.pychecks the bindings against the same golden.Checked locally
Windows, MSVC 19.44, Release, deps from the
.depscvcpkg prefix, master merged in:nav_belief_material_controller_test: 11/11;nav_belief_material_test: 19/19;pycvc_nav_belief_controller,pycvc_nav_beliefandpycvc_nav_train: passed;Default-off and additive: nothing existing calls the new code.
Next
C2 (
decide,decide_batch,rollout,material_drive_for, goldens G6–G7) extends the GRL-SNAM generator first. C2 is not started.