Files
NODEDC_MISSION_CORE/src/k1link/datasets/rellis_profile.py
T

105 lines
4.0 KiB
Python

"""Train-calibrated, algorithm-scoped RELLIS OS1 Patchwork++ profile."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any, Final
RELLIS_PATCHWORK_PROFILE_SCHEMA: Final = "missioncore.rellis-patchwork-profile/v1"
RELLIS_URDF_URL: Final = (
"https://raw.githubusercontent.com/unmannedlab/RELLIS-3D/"
"c17a118fcaed1559f03cc32cc3a91dedc557f8b8/"
"catkin_ws/src/platform_description/urdf/warthog.urdf.xacro"
)
RELLIS_URDF_SHA256: Final = (
"bcb66a05b8818f06479bb4a17ce93e9d66cb8fdaab726c437596807288116ac3"
)
@dataclass(frozen=True, slots=True)
class RellisPatchworkProfile:
"""Frozen provider profile derived without looking at validation labels."""
patchwork_sensor_height_proxy_m: float
calibration_identity_sha256: str
calibration_frame_count: int
calibration_median_absolute_deviation_m: float
patchwork_minimum_range_m: float = 2.7
patchwork_maximum_range_m: float = 80.0
profile_id: str = "rellis-warthog-os1-patchwork/v1"
def __post_init__(self) -> None:
values = (
self.patchwork_sensor_height_proxy_m,
self.calibration_median_absolute_deviation_m,
self.patchwork_minimum_range_m,
self.patchwork_maximum_range_m,
)
if (
not self.profile_id
or not all(math.isfinite(value) for value in values)
or not 0.5 <= self.patchwork_sensor_height_proxy_m <= 3.0
or not 5 <= self.calibration_frame_count <= 256
or self.calibration_median_absolute_deviation_m < 0
or not 0 < self.patchwork_minimum_range_m < self.patchwork_maximum_range_m
or len(self.calibration_identity_sha256) != 64
or any(
character not in "0123456789abcdef"
for character in self.calibration_identity_sha256
)
):
raise ValueError("RELLIS Patchwork++ profile is invalid")
def to_dict(self) -> dict[str, Any]:
return {
"schema_version": RELLIS_PATCHWORK_PROFILE_SCHEMA,
"profile_id": self.profile_id,
"source_id": "rellis-3d/v1.1",
"representation": "native-scan",
"sensor_frame": {
"frame_id": "sensor/lidar/os1",
"handedness": "right",
"x": "forward",
"y": "left",
"z": "up",
"one_revolution": True,
},
"height": {
"sensor_above_ground_m": self.patchwork_sensor_height_proxy_m,
"evidence": "train-split-ground-label-calibration",
"calibration_frame_count": self.calibration_frame_count,
"median_absolute_deviation_m": (
self.calibration_median_absolute_deviation_m
),
"calibration_identity_sha256": self.calibration_identity_sha256,
"validation_labels_used": False,
},
"patchworkpp": {
"provider_id": "patchworkpp/v1.4.1",
"minimum_range_m": self.patchwork_minimum_range_m,
"maximum_range_m": self.patchwork_maximum_range_m,
"enable_rnr": True,
"enable_rvpf": True,
"enable_tgr": True,
},
"evidence": {
"vehicle_urdf": {
"url": RELLIS_URDF_URL,
"sha256": RELLIS_URDF_SHA256,
"use": "topology-cross-check-only",
"exact_physical_height_claimed": False,
}
},
"scope": {
"patchworkpp_eligible": True,
"normalized_scan_produced": False,
"complete_vehicle_transform_known": False,
"deskew_claimed": False,
},
"authority": {
"qualification_only": True,
"navigation_or_safety_accepted": False,
},
}