Repository navigation
sim_world::set_truth, and the fog-of-war surface in pycvc - #986
Merged
Merged
Conversation
sim_world::set_truth replaces the world as it is (a wall raised or taken down, a moving vehicle's footprint each tick). truth() reads it back at once; the agents learn it by sensing, from the next sense tick, where a ray reaches it. What was derived from the truth before keeps it (the material gate surface). pycvc gains the read and write surface a fog-of-war story needs: nav_sim_world_truth / set_truth, the fog tiers nav_sim_world_ever_seen and last_visible, nav_sim_world_add_obstacle (the decaying marks) and nav_sim_world_dynamic_stamps (when each cell was last marked). Tests: NavSimWorld.SetTruthIsSensedFromTheNextSenseTick (a wall raised east of an agent in an open field is believed after a sense tick and not before, and clears once taken down); test_pycvc_nav_fog.py (the fog tiers out to the sensor's range, a wall raised and taken down, a mark believed then expired, argument checks).
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Nov 3, 2026
grl-snam fog record|all --plant kinematic|dynamic[:preset]|jolt[:preset] runs a story's one agent on libcvc's sim_world (tools/fog_plant.record_on_plant) and writes the same trace the Python scenario does. It keeps the native world honest to the story: a wall raised mid-run goes into the truth (sim_world::set_truth, transfix/libcvc#986) and, on a physics plant, the physics world; a unit's marks are the world's decaying marks; moving vehicles join the truth each tick and are kinematic boxes; a moving target is retargeted. All six stories record (the fog CLI now takes city, traffic and pursuit too). record()'s trace writing moved into _write_trace so both paths share it. grl-snam material-demo --plant runs both stories on the native world with the material's forces and witness gate (NativeSimWorld.set_material_grid); Squad(plant=..., material=...) and sim_world_from_swarm(material=...) attach it too, where Squad used to refuse it. PlantNavigator gains a prior map, the sensing schedule, the unknown policy, the marks' ttl, a material grid and track_goal; both plants gain add_box / move_box for walls and movers. docs/PLANTS.md documents both, with what they measure; tests/test_fog_plant.py covers the CLI and, with the bindings, a raised wall, decaying marks, traffic, a moving goal, a squad with material and the material demo on a plant.
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.
What
sim_world::set_truth(const uint8_t *truth)replaces the world as it is: a wall raised or taken down, or a moving vehicle's footprint each tick.truth()reads it back at once.freeze_sensethey never learn it.set_materialagain to refresh it.pycvc gains the fog-of-war read and write surface:
nav_sim_world_truth(h)andnav_sim_world_set_truth(h, truth);nav_sim_world_ever_seen(h, m)andnav_sim_world_last_visible(h, m), as (H, W) uint8;nav_sim_world_add_obstacle(h, r0, r1, c0, c1): the decaying marks, whichsim_worldhad and pycvc did not bind;nav_sim_world_dynamic_stamps(h, m): when each cell was last marked, (H, W) float64,-inffor never.Why
GRL-SNAM's
grl-snam fog record --plant ...puts the fog-of-war stories on a vehicle plant through the native world. The stories change the world mid-run:blockerraises a wall;unitdrops decaying marks;trafficmoves two vehicles.The recorder also writes the fog tiers and the truth into the trace the renderer replays. None of that was reachable from Python, and the world's truth was fixed at construction. CVC-Lab/GRL-SNAM#145 is that PR.
Tests
NavSimWorld.SetTruthIsSensedFromTheNextSenseTick. A wall raised east of an agent in an open field reads back fromtruth()at once. It is not believed before a sense tick, and it is believed after one. Once taken down, the belief clears.test_pycvc_nav_fog.py, registered with the other pycvc tests, 15 checks:ttl_s;Local run: Windows, MSVC 14.44 Release, Jolt on.
nav_sim_world_testpasses 4/4,test_pycvc_nav_fog.pypasses 15 checks, andtest_pycvc_physics.pystill passes. clang-format 18 is clean on the changed lines.