fix(viewer): preserve operator camera across AI layers

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 10:51:18 +03:00
parent a0706fd5d8
commit 3a64f54dea
12 changed files with 425 additions and 109 deletions
+48 -1
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
import hashlib
import json
import re
import struct
import subprocess
import sys
@@ -35,7 +36,12 @@ from k1link.device_plugins.xgrids_k1.rrd_export import (
export_k1mqtt_to_rrd,
recorded_blueprint_rrd,
)
from k1link.viewer.recorded import recorded_blueprint as viewer_recorded_blueprint
from k1link.viewer.recorded import (
recorded_blueprint as viewer_recorded_blueprint,
)
from k1link.viewer.recorded import (
recorded_blueprint_rrd as viewer_recorded_blueprint_rrd,
)
from k1link.viewer.rerun_bridge import RerunSceneSettings
@@ -410,6 +416,47 @@ def test_viewer_blueprint_reset_is_bounded_and_recreates_render_views() -> None:
assert perception_behavior.visible.as_arrow_array().to_pylist() == [False]
def test_recorded_blueprint_layer_updates_preserve_store_until_explicit_reset() -> None:
session_id = "b" * 32
initial = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
)
layers_enabled = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
unified_perception=True,
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
)
reset = viewer_recorded_blueprint_rrd(
RerunSceneSettings(accumulation_seconds=12.0),
recording_id="stable-camera",
blueprint_session_id=session_id,
view_reset_generation=1,
unified_perception=True,
show_detections_2d=True,
show_segmentation=True,
show_cuboids_3d=True,
)
store_pattern = rb"rec_[0-9a-f]{32}"
initial_store_ids = set(re.findall(store_pattern, initial))
layer_store_ids = set(re.findall(store_pattern, layers_enabled))
reset_store_ids = set(re.findall(store_pattern, reset))
assert len(initial_store_ids) == 1
assert layer_store_ids == initial_store_ids
assert len(reset_store_ids) == 1
assert reset_store_ids.isdisjoint(initial_store_ids)
assert len(initial) < 350_000
assert len(layers_enabled) < 350_000
assert len(reset) < 350_000
def test_viewer_blueprint_unifies_original_video_and_independent_ai_layers() -> None:
blueprint = viewer_recorded_blueprint(
RerunSceneSettings(accumulation_seconds=12.0),