feat(viewer): add recorded point colors and trajectory follow

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 13:33:08 +03:00
parent 9f712bf353
commit ecd95a22f0
16 changed files with 1218 additions and 36 deletions
@@ -25,6 +25,9 @@ let resolveRecordedBlueprintUrl;
let fetchRecordedBlueprintRrd;
let resolveRecordedPerceptionUrl;
let fetchRecordedPerceptionRrd;
let resolveRecordedPointColorsUrl;
let fetchRecordedPointColorsRrd;
let recordedPointColorKey;
let isRecordedPlaybackFullyBuffered;
let recordedObservationSources;
let selectRecordedMediaEpoch;
@@ -66,6 +69,9 @@ before(async () => {
fetchRecordedBlueprintRrd,
resolveRecordedPerceptionUrl,
fetchRecordedPerceptionRrd,
resolveRecordedPointColorsUrl,
fetchRecordedPointColorsRrd,
recordedPointColorKey,
isRecordedPlaybackFullyBuffered,
} = await server.ssrLoadModule(
"/src/components/RerunViewport.tsx",
@@ -263,6 +269,7 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
showPoints: true,
showTrajectory: false,
pointSize: 4.5,
colorMode: "height",
palette: "custom",
customColor: "#35d7c1",
},
@@ -272,6 +279,7 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
blueprintSessionId: "a".repeat(32),
activeView: "perception3d",
viewResetGeneration: 1,
followTrajectory: true,
perceptionLayers: {
enabled: true,
detections2d: true,
@@ -299,10 +307,12 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
show_points: true,
show_trajectory: false,
point_size: 4.5,
color_mode: "height",
palette: "custom",
custom_color: "#35d7c1",
active_view: "perception3d",
view_reset_generation: 1,
follow_trajectory: true,
unified_perception: true,
show_detections_2d: true,
show_segmentation: false,
@@ -317,6 +327,7 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
showPoints: true,
showTrajectory: true,
pointSize: 2.5,
colorMode: "intensity",
palette: "turbo",
customColor: "#ffffff",
},
@@ -351,6 +362,7 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
showPoints: true,
showTrajectory: false,
pointSize: 4.5,
colorMode: "height",
palette: "custom",
customColor: "#35d7c1",
},
@@ -365,6 +377,73 @@ test("recorded blueprint fetch is bounded, strict and sends only display setting
);
});
test("recorded point colors use one strict same-origin component overlay", async () => {
const endpoint = resolveRecordedPointColorsUrl(
"/api/v1/observation-sessions/session-1/recording.rrd",
"http://127.0.0.1:5174",
);
assert.equal(
endpoint,
"http://127.0.0.1:5174/api/v1/observation-sessions/session-1/point-colors.rrd",
);
assert.equal(
resolveRecordedPointColorsUrl(
"https://outside.invalid/api/v1/observation-sessions/session-1/recording.rrd",
"http://127.0.0.1:5174",
),
null,
);
assert.equal(
recordedPointColorKey({
colorMode: "intensity",
palette: "turbo",
customColor: "#112233",
}),
"intensity|turbo|-",
);
assert.equal(
recordedPointColorKey({
colorMode: "class",
palette: "turbo",
customColor: "#112233",
}),
"class|turbo|#112233",
);
const calls = [];
const payload = Uint8Array.from([0x52, 0x52, 0x46, 0x32, 0x01]);
const result = await fetchRecordedPointColorsRrd(
endpoint,
{
colorMode: "distance",
palette: "viridis",
customColor: "#35d7c1",
},
{ applicationId: "nodedc_mission_core_recorded", recordingId: "recording-001" },
{
origin: "http://127.0.0.1:5174",
fetcher: async (input, init) => {
calls.push({ input: String(input), init, body: JSON.parse(String(init.body)) });
return new Response(payload, {
status: 200,
headers: {
"Content-Type": "application/vnd.rerun.rrd",
"Content-Length": String(payload.byteLength),
},
});
},
},
);
assert.deepEqual([...result], [...payload]);
assert.deepEqual(calls[0].body, {
application_id: "nodedc_mission_core_recorded",
recording_id: "recording-001",
color_mode: "distance",
palette: "viridis",
custom_color: "#35d7c1",
});
});
test("recorded perception fetch admits one complete same-origin RRD or no layer", async () => {
const endpoint = resolveRecordedPerceptionUrl(
"/api/v1/observation-sessions/session-1/recording.rrd",