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

+11
View File
@@ -100,6 +100,17 @@ if (oneway !== "-1") edges.push(makeEdge(way, refs, coords, "forward"));
if (!isOneWay(oneway)) edges.push(makeEdge(way, [...refs].reverse(), [...coords].reverse(), "backward"));
```
## 本地参与者调度校验
`scripts/lib/cesium-preview.js:createParticipantSimulation()` 使用固定种子的间隔到达、IDM 跟驰、
进口停止线约束和几何冲突占用。排队及占用检测仅包含已到达且仍活动的参与者;首次放行必须
同时更新路程和 committed 状态。进入路口后不再服从出口方向的信号灯,但仍让行前方过街者。
行人及自行车仅在配对方向红灯且剩余时间足够完成过街时进入,启动全红不放行过街者。
回归命令:`npm run test:participant-runtime`。可传真实生成数据进行 600 秒的放行、通行完成
及二维包围盒重叠检查:`node scripts/test-participant-runtime.js outputs/fengshu-er-road/_preview/fengshu-er-road-traffic-simulation.json`。
这是展示级调度校验,不代替 GLB 模型实际外形、车身原点和浏览器渲染的检查。
## 信号动态 GLB 契约
`traffic_signals.json` 的 `pose.*` 是 Blender 静态设施、动态灯珠和倒计时共享的锚点。Blender
@@ -184,6 +184,10 @@ registry.list() -> VehicleRecord[]
平滑:用 `Cesium.SampledPositionProperty` 按 `duration` 插值,替代当前的直接赋值跳变。
模型资产闭包:dashboard 的车辆模型已复制到本项目 `assets/models/v2x-vehicles/`,由
`scripts/lib/vehicle-library.js` 构建时复制到输出预览目录。运行时不访问
`/Users/que01/Project/wbza_web`;外部 dashboard 仅作为模型来源与契约参考。
### 4.5 宽松解析(R9)
源项目用 `saferEval`。浏览器端零依赖不能引入该库,也不应引入 `eval`。改为
@@ -59,7 +59,7 @@
### R8 车辆模型命名与资产对齐
- OBU 数据层标记为 `car_obu.glb`,但 dashboard 的实际 `CrossCars` 模板固定渲染 `11.glb`;预览必须遵从该最终渲染契约。目标识别车辆使用 `${type}${subType}.glb`。
- 预览包必须携带 dashboard 实际使用的车辆模型;包内缺少未知车型时回退到 `11.glb`,并在面板提示,不得静默显示错误车型。
- 预览包必须携带已复制到本项目 `assets/models/v2x-vehicles/` 的 dashboard 实际使用车辆模型;构建和运行时不得读取 dashboard 外部路径。包内缺少未知车型时回退到 `11.glb`,并在面板提示,不得静默显示错误车型。
### R9 推送体解析健壮性
- 源项目对两个车辆 socket 使用 `saferEval` 而非 `JSON.parse`,说明载荷不保证严格 JSON。