test(e2e): add DatasetAdapter base interface + capability dataclass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yuzviak
2026-04-16 21:41:58 +03:00
parent a2620aee6c
commit 2f87621926
2 changed files with 137 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
"""DatasetAdapter — uniform interface for e2e harness over arbitrary UAV datasets."""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum
from typing import Iterator
class PlatformClass(str, Enum):
FIXED_WING = "fixed_wing"
ROTARY = "rotary"
INDOOR = "indoor"
SYNTHETIC = "synthetic"
class DatasetNotAvailableError(RuntimeError):
"""Raised when a dataset's expected files are missing. Tests should skip, not fail."""
@dataclass(frozen=True)
class DatasetCapabilities:
has_raw_imu: bool
has_rtk_gt: bool
has_loop_closures: bool
platform_class: PlatformClass
@dataclass(frozen=True)
class DatasetFrame:
frame_idx: int
timestamp_ns: int
image_path: str
@dataclass(frozen=True)
class DatasetIMU:
timestamp_ns: int
accel: tuple[float, float, float] # m/s^2 in body frame
gyro: tuple[float, float, float] # rad/s in body frame
@dataclass(frozen=True)
class DatasetPose:
timestamp_ns: int
lat: float
lon: float
alt: float
qx: float
qy: float
qz: float
qw: float
class DatasetAdapter(ABC):
"""Uniform read-only iteration over a UAV dataset."""
@property
@abstractmethod
def name(self) -> str: ...
@property
@abstractmethod
def capabilities(self) -> DatasetCapabilities: ...
@abstractmethod
def iter_frames(self) -> Iterator[DatasetFrame]: ...
@abstractmethod
def iter_imu(self) -> Iterator[DatasetIMU]: ...
@abstractmethod
def iter_ground_truth(self) -> Iterator[DatasetPose]: ...