fix(lab): seal RAV004 spatial replay transport
This commit is contained in:
@@ -3,14 +3,17 @@ from __future__ import annotations
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
import k1link.sessions.canonical_lab_spatial as spatial_module
|
||||
from k1link.sessions.canonical_lab_spatial import (
|
||||
_TimedPoints,
|
||||
_TimedPoses,
|
||||
_bounded_local_slam,
|
||||
_estimate_sensor_height,
|
||||
_CanonicalSpatialIndex,
|
||||
_estimate_local_sensor_height,
|
||||
_estimate_sensor_height,
|
||||
_gravity_stable_basis_map_from_body,
|
||||
_ground_origin_map,
|
||||
_TimedPoints,
|
||||
_TimedPoses,
|
||||
canonical_lab_spatial_playback_points,
|
||||
)
|
||||
|
||||
|
||||
@@ -127,3 +130,43 @@ def test_sensor_height_tracks_current_source_window_instead_of_fixed_mount() ->
|
||||
assert high == pytest.approx(1.05, abs=0.03)
|
||||
assert low_samples >= 3 and high_samples >= 3
|
||||
assert low_source == high_source == "local-source-cloud-ground-quantile-median"
|
||||
|
||||
|
||||
def test_playback_track_binds_sparse_map_increments_to_dense_camera_timeline(
|
||||
tmp_path,
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
recording = tmp_path / "recording.rrd"
|
||||
recording.write_bytes(b"sealed")
|
||||
points = _TimedPoints(
|
||||
times_ns=(10, 20),
|
||||
values=(
|
||||
np.asarray([[1.0, 2.0, 3.0]], dtype=np.float32),
|
||||
np.asarray([[4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], dtype=np.float32),
|
||||
),
|
||||
)
|
||||
empty_poses = _TimedPoses(times_ns=(), translations=(), quaternions_xyzw=())
|
||||
index = _CanonicalSpatialIndex(
|
||||
points=points,
|
||||
poses=empty_poses,
|
||||
trajectories=_TimedPoints(times_ns=(), values=()),
|
||||
sensor_height_m=0.4,
|
||||
sensor_height_sample_count=0,
|
||||
sensor_height_mad_m=0.0,
|
||||
)
|
||||
monkeypatch.setattr(spatial_module, "_load_index", lambda *_args: index)
|
||||
|
||||
track, offsets = canonical_lab_spatial_playback_points(
|
||||
recording,
|
||||
"a" * 64,
|
||||
(10, 15, 20, 25),
|
||||
)
|
||||
|
||||
assert offsets == (0, 1, 1, 3, 3)
|
||||
assert track.tolist() == [
|
||||
[1.0, 2.0, 3.0],
|
||||
[4.0, 5.0, 6.0],
|
||||
[7.0, 8.0, 9.0],
|
||||
]
|
||||
assert track.dtype == np.dtype("<f4")
|
||||
assert not track.flags.writeable
|
||||
|
||||
Reference in New Issue
Block a user