Skip to content

feat(data): generalize lidar model_element to flexible shapes and dtypes#156

Open
janickm wants to merge 1 commit into
NVIDIA:mainfrom
janickm:dev/janickm/lidar-model-element-flexible-shape-dtype
Open

feat(data): generalize lidar model_element to flexible shapes and dtypes#156
janickm wants to merge 1 commit into
NVIDIA:mainfrom
janickm:dev/janickm/lidar-model-element-flexible-shape-dtype

Conversation

@janickm

@janickm janickm commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

What

Generalize the per-ray model_element of the V4 LidarSensorComponent from a fixed (N, 2) uint16 layout to flexible shapes and dtypes, in a backwards-compatible way.

New contract for model_element:

  • Shape: a leading per-ray dimension N followed by any trailing shape -- flat (N,), the legacy (N, 2) (row, col), or arbitrary (N, A, B, ...).
  • Dtype: any integer type (discrete model index) or any floating type up to float32 (continuous model sampling coordinate, e.g. float16 / float32); float64 (and wider) is rejected as too storage-heavy.

Why

This is groundwork for solid-state / semi-solid-state lidar model support (#125). Such sensors do not fit the current spinning (row, col) grid: their elements may need extra dimensions (e.g. zone, scan-direction / frame parity) or continuous sampling coordinates into a to-be-derived model.

The zarr storage backend is already self-describing for shape and dtype, so only the writer-side validation was restrictive -- relaxing it lets the abstract lidar model carry richer per-ray indices without changing the on-disk data format.

Backwards compatibility

  • Existing (N, 2) uint16 data reads/writes unchanged.
  • All existing consumers index the leading two columns (model_element[:, 0] / [:, 1]), so they are unaffected.
  • The LidarSensorProtocol / V4 reader return type is broadened to Optional[NDArray[Any]].

Tests

Added round-trip coverage for: flat (N,), legacy (N, 2) uint16, higher-dim (N, A, B), and float16 / float32 sampling coordinates; plus rejection of float64, 0-d arrays, and mismatched leading dimension. The existing test_reload integration test now also exercises a multi-column model_element.

All affected Bazel test targets pass:

  • //ncore/impl/data/v4:pytest_components_3_11
  • //ncore/impl/data/v4:pytest_compat_3_11
  • //ncore/impl/sensors:pytest_lidar_3_11, pytest_rolling_shutter_3_11
  • //tools/data_converter:pytest_structured_lidar_model_3_11
  • nuScenes / KITTI converter tests

Formatter (bazel run format) clean.

The per-ray model_element of the V4 LidarSensorComponent was previously
fixed to shape (N, 2) and dtype uint16. Generalize it to support arbitrary
per-ray model indexing / sampling coordinates while staying
backwards-compatible (zarr storage is already self-describing for shape and
dtype; only the writer-side validation was restrictive).

New contract:
- Shape: a leading per-ray dimension N followed by any trailing shape --
  flat (N,), the legacy (N, 2) (row, col), or arbitrary (N, A, B, ...).
- Dtype: any integer type (discrete model index) or any floating type up to
  float32 (continuous model sampling coordinate, e.g. float16 / float32);
  float64 (and wider) is rejected as too storage-heavy.

This is groundwork for solid-state / semi-solid-state lidar models (NVIDIA#125),
whose elements may need extra dimensions (e.g. zone, scan-direction / frame
parity) or continuous sampling coordinates, without changing the on-disk
data format. Existing (N, 2) uint16 data and all consumers (which index the
leading two columns) are unaffected.

Broaden the LidarSensorProtocol / V4 reader return type to NDArray[Any] and
update docstrings accordingly. Add round-trip tests for flat (N,), legacy
(N, 2) uint16, higher-dim (N, A, B), and float16 / float32 sampling
coordinates, plus rejection of float64, 0-d, and mismatched leading dim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant