Repository navigation
cvcGL: belief/fog raster bridge for realtime nav-stats viz (Track 3b-2) - #426
Merged
Merged
Conversation
Add publish_nav_rasters() to cvc::gl::nav_stats_publish + sim_world::plane_version(m). Publishes the belief/fog rasters into <prefix>.nav_stats.rasters.* for realtime visualization (the cvcdbg#127 raster design): each plane's truth/belief/ever_seen/ last_visible is wrapped as a z=1 cvc::volume and stored on the node's data() lane (a shallow-share handle VolumeNode renders directly), with paired .version + .dims scalars on the value lane. The cvc::volume raw-pointer ctor deep-copies the raster ONCE per publish (an immutable snapshot); the handoff is then a refcount bump. Version-gated by sim_world's per-plane version_[m] (new plane_version accessor) so an unchanged plane skips the deep wrap; truth is static (published once). Same-process only (the data() lane doesn't cross a process boundary — a remote viewer escalates to the brick path behind the identical version/dims contract). Storing a cvc::volume VALUE (not shared_ptr<const volume>) matches VolumeNode's onDataChanged as-is (no VolumeNode change) and is cheap because voxels/volume are shallow-copy (boost::shared_array). Test extended: dims + version scalars, the data() lane holds a cvc::volume with z=1 dims + round-tripped voxels, and the version gate skips an unchanged plane while re-publishing a bumped one.
…tr (3b-2 review) Adversarial review of the raster bridge surfaced four defects; all fixed + a regression test added: - VolumeNode::onDataChanged bound a reference into the boost::any returned BY VALUE from state::data() -> use-after-free the moment the raster feature (its first real producer) wires a VolumeNode to a data-lane plane. Copy the volume out by value via data<cvc::volume>() (a cheap shared_array bump). - publish_nav_rasters used `long` for cells / plane offset -> truncates on LLP64 (Windows long is 32-bit); a fog-of-war twin with O(N) planes over a large grid would wrap the offset and read OOB. Widened to std::size_t (matches the int64 discipline already used for i2s). - The per-plane "never published" sentinel was -1, colliding with sim_world::plane_version()'s out-of-range -1 -> a -1 version was frozen out forever. Sentinel is now INT_MIN, so a -1 still publishes once. - versions == nullptr captured each plane once then froze the fog (0 == 0 skip). Now un-gated when versions is null: every plane re-publishes each call. Test adds a nullptr-versions no-freeze case (mutate source between calls, assert the stored volume tracks it). Local cvcgl_nav_stats_publish: OK.
transfix
added a commit
that referenced
this pull request
Sep 26, 2026
…b-3 PRs open (#427) Reflect actual state: Track 1 (a-d) MERGED (#421-#424), Track 2 MERGED (GRL-SNAM#96), Track 3a MERGED (cvcdbg#128/#129), Track 3b-1 MERGED (#425). Track 3b-2 (raster bridge, #426) + Track 3b-3 (RF publisher + demo3 wiring, cvcdbg#130) PRs open in CI. Document the 3b split (3b-1 base/formation, 3b-2 version-gated volume rasters, 3b-3 RF+demo) and the Track-4 reserved RF fields (composite_score / cvar_jam_loss / worst_jam_loss).
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.
Stacked on Track 3b-1 (#425, merged). Adds the belief/fog raster bridge so a realtime viewer (ImGui panel / cvcGL UI DSL / VolRover3) can render the nav belief planes live — the piece the user flagged: "make sure the rasters are stored in the state tree in an efficient way because we will likely be visualizing them in realtime."
What
cvc::gl::publish_nav_rasters(app, pub, prefix, dims, truth, belief, everseen, lastvis, versions, st):[rows*cols]uint8 plane as a z=1cvc::volumestored on the state node's data() lane (the handle laneVolumeNoderenders) — the raw-ptr ctor deep-copies once into aboost::shared_array, so the source rasters may be freed/reused and re-publishing a plane refcount-drops the old buffer.nav_raster_pub_state, one per scene): an unchanged plane skips the deep wrap entirely — only planes whosesim_world::plane_version(m)changed are re-wrapped. Truth is published once. This is the "efficient" path for realtime..version+.dimsscalars go on the coalesced value lane through thestate_publisher.sim_world::plane_version(int m)accessor added (out-of-range → -1).Same-process only (the data() lane doesn't cross a process boundary; a remote viewer opts into brick escalation behind the identical version/dims).
Review (adversarial, pre-merge) — 4 defects found + fixed
VolumeNode::onDataChangedbound aconst volume&into theboost::anythatstate::data()returns by value → dangles at the semicolon. This raster bridge is its first real producer; fixed by copying out by value (data<cvc::volume>()).longplane offset truncates on Windows → widened tosize_t.-1clashed withplane_version()'s out-of-range-1→ nowINT_MIN.versions==nullptr.Test
cvcgl_nav_stats_publishextended: dims/version scalars,data<cvc::volume>()holds the z=1 volume with round-tripped voxels, version-gate skips an unchanged plane, and a nullptr-versions no-freeze case (mutate source between calls, assert the stored volume tracks it). Local:cvcgl_nav_stats_publish: OK.Additive / off nothing: no existing behavior changes. Next: downstream extension-layer publisher + app wiring (Track 3b-3).