fix(lab): stabilize replay and densify LiDAR overlay
This commit is contained in:
@@ -170,7 +170,8 @@ export interface M4ThreatTimeline {
|
||||
pointSampleLimit: number;
|
||||
maximumSourcePointsPerFrame: number;
|
||||
pointDelivery: "exact-current-increment";
|
||||
cameraPointDelivery: "factory-kb4-projected-current-increment" | null;
|
||||
cameraPointDelivery: "factory-kb4-causal-registered-accumulation" | null;
|
||||
cameraPointWindowSeconds: number;
|
||||
cameraPointSampleLimit: number;
|
||||
worldStateDelivery: "source-paced-latest-wins" | null;
|
||||
worldStateFrameCount: number;
|
||||
@@ -189,6 +190,21 @@ export interface M4ThreatTimeline {
|
||||
corridor: M4ThreatVisualFrame["corridor"];
|
||||
}
|
||||
|
||||
export interface M4ThreatCameraPointOverlay {
|
||||
resultId: string;
|
||||
sequence: number;
|
||||
sourceTimeNs: number;
|
||||
pointsXyd: readonly (readonly [number, number, number])[];
|
||||
sourceFrameCount: number;
|
||||
sourcePointCount: number;
|
||||
frontPointCount: number;
|
||||
projectedPointCount: number;
|
||||
sampleCount: number;
|
||||
windowSeconds: number;
|
||||
projection: "factory-kb4-causal-registered-accumulation";
|
||||
authority: "visual-derived";
|
||||
}
|
||||
|
||||
export interface M4ThreatTimelineChunk {
|
||||
resultId: string;
|
||||
startSequence: number;
|
||||
@@ -651,9 +667,12 @@ export async function fetchM4ThreatTimeline(
|
||||
? null
|
||||
: exact(
|
||||
payload.camera_point_delivery,
|
||||
"factory-kb4-projected-current-increment",
|
||||
"factory-kb4-causal-registered-accumulation",
|
||||
"M4.6 camera point delivery",
|
||||
),
|
||||
cameraPointWindowSeconds: payload.camera_point_window_seconds === undefined
|
||||
? 0
|
||||
: number(payload.camera_point_window_seconds, "M4.6 camera point window"),
|
||||
cameraPointSampleLimit: payload.camera_point_sample_limit === undefined
|
||||
? 0
|
||||
: integer(payload.camera_point_sample_limit, "M4.6 camera point limit"),
|
||||
@@ -760,6 +779,62 @@ export async function fetchM4ThreatTimelineChunk(
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchM4ThreatCameraPointOverlay(
|
||||
result: string,
|
||||
sequence: number,
|
||||
{
|
||||
fetcher = fetch,
|
||||
signal,
|
||||
endpointRoot = M4_THREAT_TIMELINE_ENDPOINT_ROOT,
|
||||
}: {
|
||||
fetcher?: LaboratoryFetch;
|
||||
signal?: AbortSignal;
|
||||
endpointRoot?: string;
|
||||
} = {},
|
||||
): Promise<M4ThreatCameraPointOverlay> {
|
||||
const response = await fetcher(
|
||||
`${endpointRoot}/${result}/timeline/frames/${sequence}/camera-points`,
|
||||
{ headers: { Accept: "application/json" }, signal },
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new M4ThreatContractError(`M4.6 camera points: HTTP ${response.status}.`);
|
||||
}
|
||||
const payload = object(await response.json(), "M4.6 camera points");
|
||||
exact(
|
||||
payload.schema_version,
|
||||
"missioncore.m48s-camera-point-overlay/v1",
|
||||
"M4.6 camera point schema",
|
||||
);
|
||||
exact(payload.result_id, result, "M4.6 camera point result");
|
||||
exact(payload.sequence, sequence, "M4.6 camera point sequence");
|
||||
exact(payload.authority, "visual-derived", "M4.6 camera point authority");
|
||||
const points = array(payload.points_xyd, "M4.6 accumulated camera points").map(
|
||||
(point) => vector(point, 3, "M4.6 accumulated camera point") as [number, number, number],
|
||||
);
|
||||
const sampleCount = integer(payload.sample_count, "M4.6 camera point sample count");
|
||||
if (points.length !== sampleCount) {
|
||||
throw new M4ThreatContractError("M4.6 camera point sample count: нарушен контракт.");
|
||||
}
|
||||
return {
|
||||
resultId: result,
|
||||
sequence,
|
||||
sourceTimeNs: integer(payload.source_time_ns, "M4.6 camera point source time"),
|
||||
pointsXyd: points,
|
||||
sourceFrameCount: integer(payload.source_frame_count, "M4.6 camera source frames"),
|
||||
sourcePointCount: integer(payload.source_point_count, "M4.6 camera source points"),
|
||||
frontPointCount: integer(payload.front_point_count, "M4.6 camera front points"),
|
||||
projectedPointCount: integer(payload.projected_point_count, "M4.6 camera projected points"),
|
||||
sampleCount,
|
||||
windowSeconds: number(payload.window_seconds, "M4.6 camera point window"),
|
||||
projection: exact(
|
||||
payload.projection,
|
||||
"factory-kb4-causal-registered-accumulation",
|
||||
"M4.6 camera point projection",
|
||||
),
|
||||
authority: "visual-derived",
|
||||
};
|
||||
}
|
||||
|
||||
function parseTimelineFrame(
|
||||
value: unknown,
|
||||
result: string,
|
||||
|
||||
Reference in New Issue
Block a user