重构RTK-IMU标定链路并完成机械先验工程验证
This commit is contained in:
@@ -16,6 +16,15 @@ from .rtk_imu_translation import TranslationCalibrationResult, solve_rtk_imu_tra
|
||||
from .rtk_io import load_rtk_csv
|
||||
|
||||
|
||||
DEFAULT_RTK_FRAME_DEFINITION = (
|
||||
"right-handed vehicle-fixed frame: +X ANT1(main,left)->ANT2(secondary,right), "
|
||||
"+Y vehicle forward/IMU +Y, +Z vehicle up/IMU +Z"
|
||||
)
|
||||
DEFAULT_RTK_REFERENCE_POINT = (
|
||||
"GGA ANT1/main-antenna phase center, 1.916499878 m above ground"
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class InventoryEntry:
|
||||
session_id: str
|
||||
@@ -82,6 +91,7 @@ def dataset_audit(sessions: list[RotationSession]) -> dict[str, Any]:
|
||||
rtk = session.rtk
|
||||
valid_position = rtk.position_valid
|
||||
valid_attitude = rtk.attitude_valid & valid_position
|
||||
float_attitude = rtk.attitude_float & valid_position
|
||||
rows.append(
|
||||
{
|
||||
"session_id": session.session_id,
|
||||
@@ -90,6 +100,8 @@ def dataset_audit(sessions: list[RotationSession]) -> dict[str, Any]:
|
||||
"rtk_samples": int(rtk.t_s.size),
|
||||
"fixed_position_ratio": float(np.mean(valid_position)),
|
||||
"fixed_attitude_ratio": float(np.mean(valid_attitude)),
|
||||
"float_attitude_ratio": float(np.mean(float_attitude)),
|
||||
"checksum_valid_ratio": float(np.mean(rtk.checksum_valid)),
|
||||
"common_time_span_s": [
|
||||
float(max(session.imu.t_s[0], rtk.t_s[0])),
|
||||
float(min(session.imu.t_s[-1], rtk.t_s[-1])),
|
||||
@@ -109,8 +121,8 @@ def run_calibration(
|
||||
rotation_only: bool = False,
|
||||
compute_loo: bool = True,
|
||||
knot_step_s: float = 2.0,
|
||||
rtk_frame_definition: str = '',
|
||||
rtk_reference_point: str = '',
|
||||
rtk_frame_definition: str = DEFAULT_RTK_FRAME_DEFINITION,
|
||||
rtk_reference_point: str = DEFAULT_RTK_REFERENCE_POINT,
|
||||
) -> tuple[RotationCalibrationResult, TranslationCalibrationResult | None]:
|
||||
"""Run calibration and publish human-readable JSON artifacts."""
|
||||
|
||||
@@ -118,7 +130,7 @@ def run_calibration(
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
rotation = solve_rtk_imu_rotation(sessions, compute_loo=compute_loo)
|
||||
translation = None
|
||||
if not rotation_only:
|
||||
if not rotation_only and rotation.ok:
|
||||
translation = solve_rtk_imu_translation(
|
||||
sessions,
|
||||
rotation,
|
||||
@@ -144,9 +156,9 @@ def run_calibration(
|
||||
)
|
||||
blockers = []
|
||||
if not rotation.ok:
|
||||
blockers.append('rotation quality gates failed')
|
||||
blockers.append('full RTK-to-IMU rotation is not observable from the lateral dual-antenna baseline')
|
||||
if translation is None or not translation.ok:
|
||||
blockers.append('translation quality gates failed or were not run')
|
||||
blockers.append('translation is frozen until a full rotation is observable and accepted')
|
||||
if not rtk_frame_definition.strip():
|
||||
blockers.append('RTK frame_definition is empty')
|
||||
if not rtk_reference_point.strip():
|
||||
|
||||
Reference in New Issue
Block a user