feat(lab): publish full TGS shadow evidence
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { after, before, test } from "node:test";
|
||||
|
||||
import { createServer } from "vite";
|
||||
|
||||
let server;
|
||||
let fetchM49TgsFullShadowSpatialChunk;
|
||||
|
||||
const resultId = `m49-tgs-full-shadow-${"a".repeat(64)}`;
|
||||
|
||||
before(async () => {
|
||||
server = await createServer({
|
||||
appType: "custom",
|
||||
logLevel: "silent",
|
||||
server: { middlewareMode: true },
|
||||
});
|
||||
({ fetchM49TgsFullShadowSpatialChunk } = await server.ssrLoadModule(
|
||||
"/src/core/laboratory/m49TgsFullShadow.ts",
|
||||
));
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await server?.close();
|
||||
});
|
||||
|
||||
test("M4.9T5 chunk keeps every missing-LiDAR cell explicitly UNOBSERVED", async () => {
|
||||
let requestedUrl = "";
|
||||
const centers = Array.from({ length: 2244 }, (_, index) => [index * 0.45, 0]);
|
||||
const unobserved = Array.from({ length: 2244 }, () => 0);
|
||||
const zBounds = Array.from({ length: 2244 }, () => [null, null]);
|
||||
const metrics = {
|
||||
eligible_point_count: 0,
|
||||
ground_point_count: 0,
|
||||
nonground_point_count: 0,
|
||||
rejected_point_count: 0,
|
||||
occupied_cell_count: 0,
|
||||
};
|
||||
const chunk = await fetchM49TgsFullShadowSpatialChunk(resultId, 7, 1, {
|
||||
fetcher: async (url) => {
|
||||
requestedUrl = String(url);
|
||||
return new Response(JSON.stringify({
|
||||
schema_version: "missioncore.m49-tgs-full-shadow-spatial-chunk/v1",
|
||||
result_id: resultId,
|
||||
start: 7,
|
||||
count: 1,
|
||||
coordinate_frame: "map-gravity-local",
|
||||
costmap: {
|
||||
cell_size_m: 0.45,
|
||||
radius_m: 12,
|
||||
centers_xy_m: centers,
|
||||
},
|
||||
frames: [{
|
||||
source_sequence: 7,
|
||||
source_frame_index: 7,
|
||||
session_seconds: 36.119857292,
|
||||
sample_available: false,
|
||||
states: unobserved,
|
||||
z_bounds_m: zBounds,
|
||||
metrics,
|
||||
}],
|
||||
}), { status: 200, headers: { "Content-Type": "application/json" } });
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
requestedUrl,
|
||||
`/api/v1/laboratory/m49/tgs-full-shadow/${resultId}/spatial/chunk?start=7&count=1`,
|
||||
);
|
||||
assert.equal(chunk.count, 1);
|
||||
assert.equal(chunk.frames[0].sampleAvailable, false);
|
||||
assert.equal(chunk.frames[0].costmap.states.length, 2244);
|
||||
assert.deepEqual(new Set(chunk.frames[0].costmap.states), new Set([0]));
|
||||
});
|
||||
|
||||
test("M4.9T5 viewer prefetches 24-frame immutable chunks", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../src/workspaces/laboratory/M49TgsFullShadowEvidence.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
assert.match(source, /const CHUNK_FRAMES = 24/);
|
||||
assert.match(source, /activeChunkStart \+ CHUNK_FRAMES/);
|
||||
assert.match(source, /fetchM49TgsFullShadowSpatialChunk/);
|
||||
assert.match(source, /sampleAvailable: spatial\.sampleAvailable/);
|
||||
});
|
||||
@@ -801,12 +801,13 @@ test("M4.6 viewer keeps media and spatial panes on one playback clock", async ()
|
||||
assert.match(visual, /showLocalSurface/);
|
||||
assert.match(
|
||||
visual,
|
||||
/pointCloudBodyXyzM=\{classifiedSpatialFrame[\s\S]*\? classifiedPointsBody[\s\S]*: spatialFrame\.pointCloudBodyXyzM\}/,
|
||||
/pointCloudBodyXyzM=\{classifiedSpatialFrame && replaceClassifiedPointCloud[\s\S]*\? classifiedPointsBody[\s\S]*: activeSpatialFrame\?\.pointCloudBodyXyzM \?\? \[\]\}/,
|
||||
);
|
||||
assert.match(
|
||||
visual,
|
||||
/const classifiedSpatialFrame = !displayingBufferedFrame[\s\S]*classifiedSpatialLayer\?\.frame\?\.sourceSequence === frame\?\.sequence[\s\S]*spatialFrame\?\.sequence === frame\?\.sequence/,
|
||||
/const activeSpatialFrame = spatialFrame\?\.sequence === timelineFrame\.activeSequence[\s\S]*const classifiedSpatialFrame = classifiedSpatialLayer\?\.frame\?\.sourceSequence === timelineFrame\.activeSequence/,
|
||||
);
|
||||
assert.match(visual, /все 2 244 TGS-ячейки явно UNOBSERVED/);
|
||||
assert.match(
|
||||
visual,
|
||||
/mapGravityLocalSensorToBodyGround[\s\S]*rotated\[2\] \+ nominalSensorHeightM/,
|
||||
|
||||
Reference in New Issue
Block a user