perf(perception): reuse local surface cell observations

This commit is contained in:
DCCONSTRUCTIONS
2026-09-02 02:03:09 +03:00
parent a3c67e249c
commit d9ea7c1129
3 changed files with 40 additions and 5 deletions
+25
View File
@@ -26,6 +26,11 @@ from k1link.compute.lidar_local_surface import (
from k1link.compute.lidar_local_surface_geometry import (
DEFAULT_K1_LOCAL_SURFACE_PROFILE as WORKER_LOCAL_SURFACE_PROFILE,
)
from k1link.compute.lidar_local_surface_geometry import (
cloud_cell_observations,
update_cache,
update_cache_observations,
)
from k1link.web.lidar_api import build_lidar_router
from k1link.web.lidar_local_surface_service import K1LocalSurfaceReadService
@@ -48,6 +53,26 @@ def test_replay_and_minimal_worker_pin_the_same_local_surface_profile() -> None:
assert WORKER_LOCAL_SURFACE_PROFILE.to_dict() == REPLAY_LOCAL_SURFACE_PROFILE.to_dict()
def test_precomputed_local_surface_observations_preserve_cache_update() -> None:
cloud = np.asarray(
[
[0.1, 0.1, 0.8],
[0.2, 0.2, 0.2],
[1.1, 0.1, 0.5],
[-0.2, -0.2, -0.1],
],
dtype=np.float64,
)
baseline: dict[tuple[int, int], tuple[float, float]] = {}
optimized: dict[tuple[int, int], tuple[float, float]] = {}
update_cache(baseline, cloud, 4.25, WORKER_LOCAL_SURFACE_PROFILE)
keys, points = cloud_cell_observations(cloud, WORKER_LOCAL_SURFACE_PROFILE)
update_cache_observations(optimized, keys, points, 4.25)
assert optimized == baseline
def _source_pack(root: Path) -> Path:
frame_count = 8
available = np.asarray([True, True, True, True, True, True, True, False])