diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 91d6c7d..b099505 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -58,7 +58,9 @@ shape removes independent per-kind storage from the live foundation. OpenGL or OpenCV requirement. - The Python/OpenGL Spout publisher and launcher have been deleted. Production Spout2 publication belongs to Aquarium. - - `scripts/diagnostic_live_sensor_fusion.py` writes fused render frames into `calibration/runs/visual-state.msgpack`. This is diagnostic/migration code, not production runtime. + - `localcast.diagnostics.visual_producer` contains the old Python visual + producer code. It is diagnostic/migration code, not production runtime, and + no longer has a script launcher. - The live visual producer writes a multi-LOD scene cache with source kind and priority. Real Leap frames are promoted as the highest-priority visual timing/spatial evidence; Leap fallback frames remain lower-priority diagnostics. - Live clap calibration is wired into the visual producer. It keeps a rolling frame window from the Kiyo pair plus Leap, reads the live spatial audio frame for transient candidates, publishes `clap-events.msgpack`, injects clap calibration markers into the render frame, and writes clap evidence into the LOD cache. Kiyo stereo owns the current rough 3D solve; Leap owns the best visual timing witness until its geometric model is calibrated. - Clap peaks now update a per-camera clock sync model. The point-cloud builder can sample camera history buffers at `oracle_time - camera_offset` instead of using whichever frame arrived last. @@ -67,7 +69,7 @@ shape removes independent per-kind storage from the live foundation. - The Spout/audio overlay boundary clamps stale visual packets to the current audio reservoir edge. If camera geometry ages out, it is dropped instead of being broadcast out of sync. - Live fallback-only RGB/Leap mode exists for deadline operation when OpenCV/MSMF/DirectShow reads block longer than the five-second reservoir. It keeps the reservoir and OBS output alive while real camera capture is moved to nonblocking ingress. - OpenCV camera reads now run behind `LatestFramePump` workers so blocking drivers cannot freeze the fusion hot loop. The live deadline command uses lower per-frame sample density (`--rgb-room-step 16 --leap-step 16 --points 64`) so the reservoir/TAA path stays fresh enough for Spout to render visual points inside the five-second budget. - - `localcast.sensor_fusion.chirp_pose` converts live phase-field delay meaning for Kiyo/PS Eye microphone sources into camera-body range constraints and per-camera pose-correction estimates. It can load camera-mic and speaker geometry from the audio-field profile, with the example profile used as the live fallback until measured local geometry exists. `scripts/diagnostic_live_sensor_fusion.py` injects those constraints as `camera-chirp:*` and `camera-pose-correction:*` render points plus `chirp-camera-pose` LOD evidence. + - `localcast.sensor_fusion.chirp_pose` converts live phase-field delay meaning for Kiyo/PS Eye microphone sources into camera-body range constraints and per-camera pose-correction estimates. It can load camera-mic and speaker geometry from the audio-field profile, with the example profile used as the live fallback until measured local geometry exists. The diagnostic visual producer can inject those constraints as `camera-chirp:*` and `camera-pose-correction:*` render points plus `chirp-camera-pose` LOD evidence. - Diagnostic render math still has a named `kiyo-mid-deru` virtual camera preset and point budget for CPU tests. Aquarium should own the production version of that policy. @@ -107,7 +109,7 @@ shape removes independent per-kind storage from the live foundation. ## Next -1. Delete remaining production dependence on `scripts/diagnostic_live_sensor_fusion.py`, +1. Delete remaining production dependence on `localcast.diagnostics.visual_producer`, diagnostic JSON render-frame adapters, diagnostic JSON LOD adapters, and Python reservoir-window clipping. 2. Bind Aquarium/Faust to the rolling-buffer `LocalcastRuntime`. diff --git a/docs/native-rebuild-plan.md b/docs/native-rebuild-plan.md index 13aa91b..4705f1e 100644 --- a/docs/native-rebuild-plan.md +++ b/docs/native-rebuild-plan.md @@ -136,9 +136,8 @@ Delete or quarantine these before adding new live features: 4. Add the minimal Aquarium/Faust C ABI over the rolling buffer. 5. Move any remaining useful Python packet/schema code into diagnostics or contract tests. -6. Keep the Python visual producer named `scripts/diagnostic_live_sensor_fusion.py` - and compatibility adapters under `localcast.diagnostics` only until they can - be deleted. +6. Keep the Python visual producer and compatibility adapters under + `localcast.diagnostics` only until they can be deleted. 7. Build the Aquarium-owned Spout publisher. Do not revive the Python/OpenGL path. 8. Move audio hot path into Faust/native DSP behind typed reservoir handles. diff --git a/docs/sensor-fusion-architecture.md b/docs/sensor-fusion-architecture.md index 0dece2b..fc864cf 100644 --- a/docs/sensor-fusion-architecture.md +++ b/docs/sensor-fusion-architecture.md @@ -196,7 +196,10 @@ The Spout/audio overlay applies the same rule at the consumer boundary. If the v 1. Capture ChArUco intrinsics for each camera with `scripts/charuco_calibration.py calibrate`. 2. Capture fixed-board observations from every camera and solve shared extrinsics with `scripts/solve_common_camera_space.py`. 3. Use `scripts/triangulate_surface_features.py` on calibrated image pairs to prove real cross-view surface tracks before promoting the matcher into the live producer. -4. Replace the synthetic stochastic transient observations in `scripts/diagnostic_live_sensor_fusion.py` with real native/Aquarium ORB/flow observations from PS3 Eye/Kiyo frames, then delete the Python diagnostic producer. +4. Replace the synthetic stochastic transient observations in + `localcast.diagnostics.visual_producer` with real native/Aquarium ORB/flow + observations from PS3 Eye/Kiyo frames, then delete the Python diagnostic + producer. 5. Move dense matching and LOD reconciliation from CPU block search/JSON to GPU-resident stereo/flow and compute-shader cache reduction so the million-sample target is not murdered by Python loops. 6. If a Tuya light is available on the local network, run `scripts/pulse_tuya_light.py` with its local key and align pulse timestamps against camera brightness response. 7. Add detector adapters that turn PS3 Eye frames into `Observation2D` marker detections. diff --git a/docs/typed-visual-state.md b/docs/typed-visual-state.md index 053f692..49f95ed 100644 --- a/docs/typed-visual-state.md +++ b/docs/typed-visual-state.md @@ -14,7 +14,7 @@ not be owned by this Python file adapter. ```mermaid flowchart TD - A["diagnostic_live_sensor_fusion.py"] --> B["SensorRig.fuse"] + A["diagnostics.visual_producer"] --> B["SensorRig.fuse"] B --> C["RenderFramePacket"] C --> D["CultRenderFrame"] X["audio-state.msgpack"] --> Y["audio event overlay"] diff --git a/scripts/diagnostic_live_sensor_fusion.py b/localcast/diagnostics/visual_producer.py similarity index 99% rename from scripts/diagnostic_live_sensor_fusion.py rename to localcast/diagnostics/visual_producer.py index 560c3a8..1ce04a1 100644 --- a/scripts/diagnostic_live_sensor_fusion.py +++ b/localcast/diagnostics/visual_producer.py @@ -6,7 +6,7 @@ from typing import BinaryIO import numpy as np -ROOT = Path(__file__).resolve().parents[1] +ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) diff --git a/notes/current-system-map.md b/notes/current-system-map.md index 33a27be..4df34dd 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -144,7 +144,7 @@ Ownership: lowering, render budgeting, and Spout2 publication. - CultNet typed documents carry status/control/process state. JSON is schema or diagnostic export only. -- `scripts/diagnostic_live_sensor_fusion.py`, Python fallback producers, and +- `localcast.diagnostics.visual_producer`, Python fallback producers, and diagnostic CultCache/JSON file adapters are diagnostics/migration fossils. They must not be extended as production surfaces. - `localcast.diagnostics.render_frame_json` and diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index d1bc5be..42c16c8 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -47,7 +47,7 @@ Get-Content .\state\evidence.jsonl -Tail 8 The useful next work is foundation surgery, not hardware feature expansion: - bind Aquarium/Faust/native workers to the rolling-buffer `LocalcastRuntime` -- delete production dependence on `scripts/diagnostic_live_sensor_fusion.py` +- delete production dependence on `localcast.diagnostics.visual_producer` and diagnostic file adapters - bind Aquarium/Faust against the native runtime instead of reviving the deleted Python/OpenGL publisher diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 7032337..8ae6f15 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -64,3 +64,4 @@ {"ts": "2026-05-19T10:02:00+01:00", "type": "implementation", "status": "ok", "note": "Native reservoir tightened sample provenance: live samples must have flags == 0, so diagnostic and unknown future flags are rejected at both raw reservoir and LocalcastRuntime typed producer boundaries. Unknown flags no longer slip through as speculative metadata."} {"ts": "2026-05-19T10:20:00+01:00", "type": "implementation", "status": "ok", "note": "Diagnostic render math split away from the OpenGL Spout publisher: localcast.diagnostics.render_math owns pure budget/projection/brush/rasterization code and tests import it directly, while spout_output is reduced to frame sources, status writers, and the disposable OpenGL/Spout shell."} {"ts": "2026-05-19T10:35:00+01:00", "type": "implementation", "status": "ok", "note": "Deleted the Python/OpenGL Spout publisher and diagnostic_stream_spout launcher. The only surviving visual render code in LocalCastBridge is pure diagnostic render_math plus typed visual cache adapters; production OBS publication is now exclusively an Aquarium responsibility."} +{"ts": "2026-05-19T10:48:00+01:00", "type": "implementation", "status": "ok", "note": "Removed the Python visual producer from the scripts command surface by moving it to localcast.diagnostics.visual_producer and updating tests/docs to import it as diagnostic code. It remains a fossil to delete after native/Aquarium equivalents own the behavior."} diff --git a/state/map.yaml b/state/map.yaml index b893d05..14cc0d2 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -301,7 +301,8 @@ current_status: points into `localcast.sensor_fusion.render_frame.v1` packets carrying source time ranges, intended visual presentation time, audio-alignment time, target render size, Spout sender name, and point draw metadata for - Aquarium/Spout. `scripts/diagnostic_live_sensor_fusion.py` writes fused render frames into + Aquarium/Spout. `localcast.diagnostics.visual_producer` contains the old + Python visual producer that writes fused render frames into diagnostic typed CultCache state at `calibration/runs/visual-state.msgpack`. The old Python/OpenGL diagnostic Spout sender has been deleted; only pure diagnostic render math remains under `localcast.diagnostics.render_math`. diff --git a/tests/test_sensor_fusion.py b/tests/test_sensor_fusion.py index e48fed3..0587e77 100644 --- a/tests/test_sensor_fusion.py +++ b/tests/test_sensor_fusion.py @@ -63,7 +63,7 @@ from localcast.diagnostics.render_math import ( point_prefix_counts, rasterize_frame_rgba, ) -from scripts.diagnostic_live_sensor_fusion import ( +from localcast.diagnostics.visual_producer import ( DEFAULT_RESERVOIR_NS, LiveClapCalibrator, evidence_in_reservoir,