perf(perception): reuse local surface cell observations
This commit is contained in:
@@ -166,6 +166,16 @@ def update_cache(
|
||||
profile: K1LocalSurfaceProfile,
|
||||
) -> None:
|
||||
keys, points = cloud_cell_observations(cloud, profile)
|
||||
update_cache_observations(cache, keys, points, session_seconds)
|
||||
|
||||
|
||||
def update_cache_observations(
|
||||
cache: dict[tuple[int, int], tuple[float, float]],
|
||||
keys: npt.NDArray[np.int64],
|
||||
points: npt.NDArray[np.float64],
|
||||
session_seconds: float,
|
||||
) -> None:
|
||||
"""Update a surface cache from already aggregated cell observations."""
|
||||
for key, point in zip(keys, points, strict=True):
|
||||
cache[(int(key[0]), int(key[1]))] = (float(point[2]), session_seconds)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ from .lidar_local_surface_geometry import (
|
||||
step_candidate_keys as _step_candidate_keys,
|
||||
)
|
||||
from .lidar_local_surface_geometry import (
|
||||
update_cache as _update_cache,
|
||||
update_cache_observations as _update_cache_observations,
|
||||
)
|
||||
from .live_perception import LatestWinsQueue
|
||||
|
||||
@@ -489,7 +489,7 @@ class K1LocalSurfaceShadowEstimator:
|
||||
position,
|
||||
self.profile,
|
||||
)
|
||||
_, current_cell_points = _cloud_cell_observations(
|
||||
current_cell_keys, current_cell_points = _cloud_cell_observations(
|
||||
local_cloud,
|
||||
self.profile,
|
||||
)
|
||||
@@ -499,11 +499,11 @@ class K1LocalSurfaceShadowEstimator:
|
||||
position,
|
||||
self.profile,
|
||||
)
|
||||
_update_cache(
|
||||
_update_cache_observations(
|
||||
self._cache,
|
||||
local_cloud,
|
||||
current_cell_keys,
|
||||
current_cell_points,
|
||||
value.session_seconds,
|
||||
self.profile,
|
||||
)
|
||||
cell_keys, cell_points, cell_times = _local_cache_records(
|
||||
self._cache,
|
||||
|
||||
Reference in New Issue
Block a user