fix(perception): stabilize replay body frame

This commit is contained in:
DCCONSTRUCTIONS
2026-08-05 20:04:08 +03:00
parent de19229895
commit c70ad345ea
12 changed files with 783 additions and 256 deletions
@@ -32,6 +32,15 @@ export interface M4ThreatReplayResult {
providerLatencyP95Ms: number;
providerLatencyMaxMs: number;
};
bodyFrame: {
available: number;
qualified: number;
rejected: number;
cameraForwardAlignmentDeg: {
p95: number;
maximum: number;
};
};
reasonCounts: Readonly<Record<string, number>>;
};
configuration: {
@@ -39,6 +48,11 @@ export interface M4ThreatReplayResult {
nominalSensorHeightM: number;
forwardCorridorM: number;
predictionHorizonSeconds: number;
bodyFrame: {
origin: "local-surface-vertical-projection";
up: "vendor-slam-map-gravity-axis";
forward: "smoothed-slam-trajectory-validated-by-camera-axis";
};
};
limitations: readonly string[];
}
@@ -254,7 +268,13 @@ export async function fetchM4ThreatReplayResult({
const evidence = object(metrics.evidence, "M4.6 evidence");
const fixtures = object(metrics.fixtures, "M4.6 fixtures");
const runtime = object(metrics.runtime, "M4.6 runtime");
const bodyFrame = object(metrics.body_frame, "M4.6 body frame");
const cameraAlignment = object(
bodyFrame.camera_forward_alignment_deg,
"M4.6 camera alignment",
);
const configuration = object(item.configuration, "M4.6 configuration");
const configuredBodyFrame = object(configuration.body_frame, "M4.6 configured body frame");
const sourceResultIds = object(item.source_result_ids, "M4.6 sources");
return {
resultId: resultId(item.result_id),
@@ -290,6 +310,15 @@ export async function fetchM4ThreatReplayResult({
providerLatencyP95Ms: number(runtime.provider_latency_p95_ms, "M4.6 p95"),
providerLatencyMaxMs: number(runtime.provider_latency_max_ms, "M4.6 max"),
},
bodyFrame: {
available: integer(bodyFrame.available, "M4.6 available body frames"),
qualified: integer(bodyFrame.qualified, "M4.6 qualified body frames"),
rejected: integer(bodyFrame.rejected, "M4.6 rejected body frames"),
cameraForwardAlignmentDeg: {
p95: number(cameraAlignment.p95, "M4.6 body frame camera alignment p95"),
maximum: number(cameraAlignment.maximum, "M4.6 body frame camera alignment maximum"),
},
},
reasonCounts: Object.fromEntries(
Object.entries(object(metrics.reason_counts, "M4.6 reasons")).map(
([key, value]) => [key, integer(value, `M4.6 ${key}`)],
@@ -301,6 +330,23 @@ export async function fetchM4ThreatReplayResult({
nominalSensorHeightM: number(configuration.nominal_sensor_height_m, "M4.6 height"),
forwardCorridorM: number(configuration.forward_corridor_m, "M4.6 corridor"),
predictionHorizonSeconds: number(configuration.prediction_horizon_seconds, "M4.6 horizon"),
bodyFrame: {
origin: exact(
configuredBodyFrame.origin,
"local-surface-vertical-projection",
"M4.6 body frame origin",
),
up: exact(
configuredBodyFrame.up,
"vendor-slam-map-gravity-axis",
"M4.6 body frame up",
),
forward: exact(
configuredBodyFrame.forward,
"smoothed-slam-trajectory-validated-by-camera-axis",
"M4.6 body frame forward",
),
},
},
limitations: array(item.limitations, "M4.6 limitations").map((value) => text(value, "M4.6 limitation")),
};