fix: use live V2X vehicles only in preview
This commit is contained in:
@@ -307,6 +307,66 @@ npm run build:area -- --config config/areas/<area>.json --stages cesium
|
||||
|
||||
---
|
||||
|
||||
## 实时 V2X 车辆仅数据源
|
||||
|
||||
### 1. Scope / Trigger
|
||||
|
||||
适用于开启 `v2xPreview.enabled` 的 Cesium 运营预览。触发:修改
|
||||
`v2x-cesium-overlay.js`、preview descriptor 的 `routeName`、或实时车辆展示。
|
||||
|
||||
### 2. Signatures
|
||||
|
||||
```text
|
||||
WS /network/ws/network/obuPosition?authorization=<token>
|
||||
WS /network/ws/network/targetPosition?authorization=<token>
|
||||
```
|
||||
|
||||
OBU 消息使用 `carCode|obuCode`、`lon`、`lat`、`angle`、`speed`;目标识别消息使用
|
||||
`data[deviceId][]` 内的 `id`、`longitude`、`latitude`、`type`、`subType`、`angle`、`speed`。
|
||||
|
||||
### 3. Contracts
|
||||
|
||||
- 两条流均为 GCJ-02,必须在实体创建前恰好调用一次 `gcj02ToWgs84`。
|
||||
- 本预览的 `routeName`、`vehicleModelName` 必须为 `null`,`vehicleModelNames` 必须为空;
|
||||
原生 preview 不得生成 `trafficSimulation` 描述符。
|
||||
- 每辆实时车保留最多 24 个已转换的位置作为实际轨迹;轨迹不是推测路径。
|
||||
|
||||
### 4. Validation & Error Matrix
|
||||
|
||||
| 条件 | 结果 |
|
||||
|---|---|
|
||||
| 未登录、令牌失效、REST/WS 不可用 | 静态路口继续显示,车辆层为空,并显示实时数据不可用状态 |
|
||||
| 消息不是 JSON、心跳、坐标无效 | 忽略该消息,不创建车辆 |
|
||||
| 收到有效车辆坐标 | 创建或更新真实车辆与实际轨迹 |
|
||||
|
||||
### 5. Good / Base / Bad Cases
|
||||
|
||||
- Good:OBU 和感知目标连续推送,页面只显示对应车辆的实际行驶轨迹。
|
||||
- Base:服务无数据,页面没有车辆或线路。
|
||||
- Bad:将旧路线 JSON 或 `native-preview-traffic-simulation` 用作回退展示。
|
||||
|
||||
### 6. Tests Required
|
||||
|
||||
- `npm run test:v2x-cesium-preview`:校验两类消息解析与 GCJ-02 转换。
|
||||
- `npm run test:preview-assets`:断言两条 WebSocket 存在,且 runtime 不调用
|
||||
`addVehicleCruises`、不显示 simulation 诊断。
|
||||
- 对目标区域运行 `npm run build:area -- --config config/areas/<area>.json --stages preview`,
|
||||
检查 descriptor 中 route/vehicle 字段为空,且不存在 traffic-simulation 文件。
|
||||
|
||||
### 7. Wrong vs Correct
|
||||
|
||||
错误:接口不可用时恢复构造路线。
|
||||
|
||||
```js
|
||||
const cruise = addVehicleCruises(viewer, routeData, signalData, start);
|
||||
```
|
||||
|
||||
正确:保持空车辆层,等待真实流。
|
||||
|
||||
```js
|
||||
const cruise = createLiveVehicleState();
|
||||
```
|
||||
|
||||
## 本地预览必须走 HTTP
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user