feat: add participant runtime simulation with traffic signal scheduling

- Implement deterministic participant simulation in cesium-preview.js with
  fixed-seed arrival, IDM car-following, stop-line constraints, and
  geometric conflict occupancy detection
- Build native traffic simulation participants from road package data
  including signal phase mapping, crosswalk centerlines, and lane routing
- Add participant runtime regression test covering 600 s simulation,
  green-only releases, and 2D bounding box overlap checks
- Update model URI prefix to _preview/ so simulation JSON resolves assets
  relative to area output directory
- Sync Trellis spec and task docs for participant scheduling contract
This commit is contained in:
que01 committed 2026-10-10 16:07:00 +08:00
1 parent c1277af16a
commit 7ce412e52e
10 files changed
+1587 -43

No files matched your search

+23 -1
View File
@@ -297,7 +297,29 @@ assert.match(v2xRuntime, /\/network\/ws\/network\/targetPosition/);
assert.match(v2xRuntime, /headingPitchRollQuaternion/);
assert.match(v2xRuntime, /model:/);
assert.match(previewRuntime, /createLiveTrafficSignals\(/);
assert.match(previewRuntime, /addTrafficSignals\(viewer, signalData, trafficStart, assets\)/);
assert.match(previewRuntime, /addTrafficSignals\(viewer, signalData, trafficStart, assets, routeData\?\.signalPlan, trafficEpochMs\)/,
"native lamps must use the same route signal plan and epoch as the local participant simulation");
assert.match(previewRuntime, /createParticipantSimulation\(viewer, templates, start, speed, routeData\.settings \|\| \{\}, routeData\.signalPlan, trafficEpochMs\)/,
"local participant decisions must use the plan that drives the lamps");
assert.match(previewRuntime, /elapsed < initialAllRedSeconds/,
"the startup clearance must hold every signal group and participant before release");
assert.match(previewRuntime, /phaseState\.initialClearance/,
"pedestrians and bicycles must not treat the startup all-red clearance as a walk phase");
assert.match(previewRuntime, /crossingUsersById/, "vehicles must yield while a pedestrian or bicycle occupies a conflicting zebra crossing");
assert.match(previewRuntime, /if \(isCrossing\(agent\) && state\.distance >= 0\) state\.committed = true/,
"crossing users retain permission once physically entering the zebra");
assert.match(previewRuntime, /const gapBuffer = crossingAgent \? 1\.5 : minimumGapMeters/,
"pedestrian and bicycle queues use a short physical gap");
assert.match(previewRuntime, /const requiredGap = \(leader\.length \+ agent\.length\) \/ 2 \+ gapBuffer/,
"queue spacing must account for both vehicles' physical lengths");
assert.match(previewRuntime, /leaderAgent\.state\.distance - physicalGap/,
"a following vehicle must be hard-clamped before its leader's physical envelope");
assert.match(previewRuntime, /crossingYieldDistance - agent\.length \/ 2 - 2/,
"crossing yield includes the front bumper and a safety margin");
assert.match(previewRuntime, /state\.respawnDelay = arrivalDelay\(agent\)/,
"participants return according to their arrival headway");
assert.match(previewRuntime, /stopReason: stop\.stopReason \|\| "traffic-signal"/,
"participant control must preserve the type of its controlling stop point");
// The lamp dictionary lives only in the overlay, which hands the preview
// already-normalized {nodeKeys, color, countDown} entries. Two copies of the