Divyanshudiv commited on
Commit
b3225fe
·
verified ·
1 Parent(s): 9053b49

dualworld viewer: latest_uniad_gnss_fix_test (2 runs)

Browse files
dualworld/latest_uniad_gnss_fix_test/conflict_turn_on_red_gruenpfeil_de__German-gruenpfeil/videos/rgb_front.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:786d1bc32db4d60738cf7d78b124b13d12c54e42b3066fb9e853ff8fdc560f2c
3
+ size 8260346
dualworld/latest_uniad_gnss_fix_test/index.html ADDED
@@ -0,0 +1,1209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="dark">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>SceneDriveBench — Dualworld Suite Viewer</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: dark;
10
+ --page: #0d0d0d;
11
+ --surface-1: #1a1a19;
12
+ --surface-2: #232322;
13
+ --text-primary: #ffffff;
14
+ --text-secondary: #c3c2b7;
15
+ --text-muted: #898781;
16
+ --grid: #2c2c2a;
17
+ --baseline: #383835;
18
+ --border: rgba(255,255,255,0.10);
19
+ --series-1: #3987e5; /* blue */
20
+ --series-2: #d95926; /* orange */
21
+ --series-3: #199e70; /* aqua */
22
+ --series-5: #d55181; /* magenta */
23
+ --accent: var(--series-1);
24
+ /* bird's-eye map */
25
+ --map-road: #2e2e2c;
26
+ --map-junction: #343432;
27
+ --map-walk: #3f3e3a;
28
+ --map-mark: #d6d5cf;
29
+ --map-yellow: #d9b13f;
30
+ --map-plate: #e5484d;
31
+ }
32
+ * { box-sizing: border-box; }
33
+ html, body { margin: 0; padding: 0; }
34
+ body {
35
+ background: var(--page);
36
+ color: var(--text-primary);
37
+ font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
38
+ }
39
+ .num { font-variant-numeric: tabular-nums; }
40
+
41
+ header {
42
+ display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
43
+ padding: 14px 20px 0;
44
+ }
45
+ header h1 { font-size: 17px; margin: 0; font-weight: 650; }
46
+ header .suite-id { color: var(--text-muted); font-size: 13px; }
47
+
48
+ nav.tabs { display: flex; gap: 4px; padding: 10px 20px 0; flex-wrap: wrap; }
49
+ nav.tabs button {
50
+ background: none; border: 1px solid transparent; border-bottom: none;
51
+ color: var(--text-secondary); font: inherit; padding: 7px 14px;
52
+ border-radius: 8px 8px 0 0; cursor: pointer;
53
+ }
54
+ nav.tabs button:hover { background: var(--surface-2); }
55
+ nav.tabs button.active {
56
+ background: var(--surface-1); color: var(--text-primary);
57
+ border-color: var(--border); font-weight: 600;
58
+ }
59
+
60
+ main {
61
+ background: var(--surface-1);
62
+ border-top: 1px solid var(--border);
63
+ padding: 18px 20px 40px;
64
+ display: grid; gap: 18px;
65
+ }
66
+
67
+ .panel {
68
+ background: var(--surface-2);
69
+ border: 1px solid var(--border);
70
+ border-radius: 10px;
71
+ padding: 14px 16px;
72
+ }
73
+ .panel h2 {
74
+ margin: 0 0 10px; font-size: 13px; font-weight: 650;
75
+ color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
76
+ }
77
+
78
+ /* ---- sensor grid ---- */
79
+ .modality-row { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
80
+ .modality-row .seg {
81
+ display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
82
+ }
83
+ .modality-row .seg button {
84
+ background: none; border: none; color: var(--text-secondary);
85
+ font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer;
86
+ }
87
+ .modality-row .seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
88
+ .modality-row .spacer { flex: 1; }
89
+
90
+ .cam-grid {
91
+ display: grid; gap: 8px;
92
+ grid-template-columns: 1fr 1.6fr 1fr;
93
+ grid-template-areas: "left front right" "rear front tele";
94
+ }
95
+ .cam-grid.has-cosmos {
96
+ grid-template-areas: "left front right" "rear cosmos tele";
97
+ }
98
+ .cam-cell[data-cam="cosmos_front"] { grid-area: cosmos; }
99
+ /* The cameras the policy itself reads: nuPlan's for AutoVLA / Qwen-Drive,
100
+ the Hyperion captures (before the fisheye warp) for Alpamayo. */
101
+ .cam-grid.nuplan { grid-template-areas: "nl0 nf0 nr0"; }
102
+ .cam-grid.nuplan.has-cosmos { grid-template-areas: "nl0 nf0 nr0" ". cosmos ."; }
103
+ .cam-cell[data-cam="nuplan_l0"] { grid-area: nl0; }
104
+ .cam-cell[data-cam="nuplan_f0"] { grid-area: nf0; }
105
+ .cam-cell[data-cam="nuplan_r0"] { grid-area: nr0; }
106
+ .cam-cell[data-cam="nuplan_l1"] { grid-area: nl0; }
107
+ .cam-cell[data-cam="nuplan_r1"] { grid-area: nr0; }
108
+ /* SimLingo: its one camera large, the repo's front view beside it. */
109
+ .cam-grid.simlingo { grid-template-columns: 1.6fr 1fr; grid-template-areas: "sl front"; }
110
+ .cam-cell[data-cam="simlingo_f0"] { grid-area: sl; }
111
+ .cam-grid.hyperion { grid-template-areas: "hl hf hr" ". hf ht"; }
112
+ .cam-grid.hyperion.has-cosmos { grid-template-areas: "hl hf hr" ". cosmos ht"; }
113
+ .cam-cell[data-cam="hv_cross_left"] { grid-area: hl; }
114
+ .cam-cell[data-cam="hv_front_wide"] { grid-area: hf; }
115
+ .cam-cell[data-cam="hv_cross_right"] { grid-area: hr; }
116
+ .cam-cell[data-cam="hv_front_tele"] { grid-area: ht; }
117
+ .cam-cell[data-cam="cosmos_front"] .cam-label { background: rgba(217,89,38,.75); }
118
+ .cam-cell { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
119
+ .cam-cell[data-cam="front"] { grid-area: front; }
120
+ .cam-cell[data-cam="left"] { grid-area: left; }
121
+ .cam-cell[data-cam="right"] { grid-area: right; }
122
+ .cam-cell[data-cam="rear"] { grid-area: rear; }
123
+ .cam-cell[data-cam="front_tele"] { grid-area: tele; }
124
+ /* LEAD's own six cameras, laid out as mounted (yaw -57.5 / 0 / +57.5 in
125
+ front, -122.5 / 180 / +122.5 behind) */
126
+ .cam-grid.lead {
127
+ grid-template-columns: 1fr 1fr 1fr;
128
+ grid-template-areas: "l0 f0 r0" "l1 b0 r1";
129
+ }
130
+ .cam-cell[data-cam="lead_l0"] { grid-area: l0; }
131
+ .cam-cell[data-cam="lead_f0"] { grid-area: f0; }
132
+ .cam-cell[data-cam="lead_r0"] { grid-area: r0; }
133
+ .cam-cell[data-cam="lead_l1"] { grid-area: l1; }
134
+ .cam-cell[data-cam="lead_b0"] { grid-area: b0; }
135
+ .cam-cell[data-cam="lead_r1"] { grid-area: r1; }
136
+ .compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
137
+ .compare-row:empty { display: none; }
138
+ .compare-row .cam-cell { aspect-ratio: auto; }
139
+ .compare-toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
140
+ .cam-cell video { display: block; width: 100%; height: 100%; object-fit: contain; }
141
+ .cam-label {
142
+ position: absolute; top: 6px; left: 8px;
143
+ font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
144
+ padding: 2px 7px; border-radius: 5px; letter-spacing: .03em;
145
+ }
146
+
147
+ /* ---- transport ---- */
148
+ .transport { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
149
+ .transport button.play {
150
+ width: 34px; height: 34px; border-radius: 50%;
151
+ border: 1px solid var(--border); background: var(--surface-1);
152
+ color: var(--text-primary); font-size: 14px; cursor: pointer;
153
+ }
154
+ .transport button.play:hover { border-color: var(--accent); }
155
+ .scrub-wrap { position: relative; flex: 1; height: 34px; display: flex; align-items: center; }
156
+ .scrub-wrap input[type=range] {
157
+ width: 100%; margin: 0; accent-color: var(--accent); position: relative; z-index: 2;
158
+ }
159
+ .replan-ticks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
160
+ .replan-ticks span {
161
+ position: absolute; top: 4px; bottom: 4px; width: 2px;
162
+ background: var(--series-2); border-radius: 1px; opacity: .9;
163
+ }
164
+ .time-readout { color: var(--text-secondary); font-size: 13px; min-width: 150px; text-align: right; }
165
+ select.rate {
166
+ background: var(--surface-1); color: var(--text-secondary);
167
+ border: 1px solid var(--border); border-radius: 6px; font: inherit; padding: 4px 6px;
168
+ }
169
+
170
+ /* ---- charts ---- */
171
+ .charts-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
172
+ @media (max-width: 1100px) { .charts-row { grid-template-columns: 1fr; } }
173
+ .chart-box { position: relative; }
174
+ .chart-box svg { display: block; width: 100%; height: auto; }
175
+ .chart-legend { display: flex; gap: 16px; margin: 2px 0 6px; flex-wrap: wrap; }
176
+ .chart-legend .item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
177
+ .chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
178
+ .viz-tooltip {
179
+ position: fixed; pointer-events: none; z-index: 50; display: none;
180
+ background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
181
+ padding: 8px 10px; font-size: 12px; color: var(--text-secondary);
182
+ box-shadow: 0 4px 16px rgba(0,0,0,.5); min-width: 120px;
183
+ }
184
+ .viz-tooltip .t-title { color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
185
+ .viz-tooltip .t-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
186
+ .viz-tooltip .t-row .lhs { display: inline-flex; align-items: center; gap: 6px; }
187
+ .viz-tooltip .swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
188
+
189
+ /* ---- bottom row: BEV + replans ---- */
190
+ .bottom-row { display: grid; grid-template-columns: minmax(380px, 480px) 1fr; gap: 18px; align-items: start; }
191
+ @media (max-width: 1100px) { .bottom-row { grid-template-columns: 1fr; } }
192
+ #bev-canvas { width: 100%; border-radius: 8px; background: var(--surface-1); cursor: crosshair; display: block; }
193
+
194
+ .replan-cards { display: grid; gap: 8px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
195
+ .scope-note {
196
+ font-size: 12px; line-height: 1.5; margin: 0 0 10px;
197
+ padding: 8px 10px; border-radius: 6px;
198
+ border: 1px solid var(--border); background: var(--bg-elev);
199
+ color: var(--text-secondary);
200
+ }
201
+ .scope-note b { color: var(--text); }
202
+ .scope-note .cos { color: var(--accent); }
203
+ .replan-card {
204
+ border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
205
+ cursor: pointer; background: var(--surface-1);
206
+ }
207
+ .replan-card:hover { border-color: var(--text-muted); }
208
+ .replan-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
209
+ .replan-card .rc-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
210
+ .replan-card .rc-head b { font-size: 13px; }
211
+ .replan-card .rc-stat { color: var(--text-muted); font-size: 12px; }
212
+ .replan-card .rc-cot { color: var(--text-secondary); font-size: 13px; margin-top: 5px; font-style: italic; }
213
+ .replan-card .rc-out { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
214
+
215
+ .cosmos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 12px; }
216
+ .cosmos-cell { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
217
+ .cosmos-cell video { display: block; width: 100%; }
218
+ .cosmos-toolbar { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
219
+ .cosmos-toolbar button {
220
+ background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
221
+ font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer;
222
+ }
223
+ .cosmos-toolbar button:hover { border-color: var(--accent); color: var(--text-primary); }
224
+
225
+ details.config { color: var(--text-secondary); }
226
+ details.config summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; }
227
+ details.config pre {
228
+ white-space: pre-wrap; font-size: 12px; color: var(--text-muted);
229
+ background: var(--surface-1); border-radius: 8px; padding: 10px 12px; margin: 8px 0 0;
230
+ }
231
+ .instruction {
232
+ border-left: 3px solid var(--series-2); padding: 4px 12px; margin: 0 0 12px;
233
+ color: var(--text-secondary); font-size: 13px;
234
+ }
235
+ .hint { color: var(--text-muted); font-size: 12px; }
236
+ .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; font-size: 13px; color: var(--text-secondary); }
237
+ .facts b { color: var(--text-primary); font-weight: 600; }
238
+ .scene-doc {
239
+ white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
240
+ color: var(--text-secondary); background: var(--surface-1); border-radius: 8px;
241
+ padding: 10px 12px; margin: 0 0 12px;
242
+ }
243
+ .scene-doc:empty { display: none; }
244
+ .panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
245
+ .panel-head h2 { margin: 0; }
246
+ .panel-head .spacer { flex: 1; }
247
+ </style>
248
+ </head>
249
+ <body>
250
+ <header>
251
+ <h1>SceneDriveBench · Dualworld Suite</h1>
252
+ <span class="suite-id num" id="suite-id"></span>
253
+ </header>
254
+ <nav class="tabs" id="scenario-tabs"></nav>
255
+
256
+ <main>
257
+ <div class="panel" id="scenario-info">
258
+ <div class="facts" id="facts"></div>
259
+ <pre class="scene-doc" id="scene-doc"></pre>
260
+ <p id="evaluation-status"></p>
261
+ <div class="instruction" id="instruction"></div>
262
+ <details class="config">
263
+ <summary>Run configuration &amp; Cosmos prompt</summary>
264
+ <pre id="config-pre"></pre>
265
+ </details>
266
+ </div>
267
+
268
+ <div class="panel">
269
+ <h2>Synchronized sensors</h2>
270
+ <div class="modality-row">
271
+ <div class="seg" id="modality-seg"></div>
272
+ <div class="seg" id="camset-seg"></div>
273
+ <label class="compare-toggle" id="compare-wrap" style="display:none">
274
+ <input type="checkbox" id="compare"> <span id="compare-label"></span>
275
+ </label>
276
+ <div class="spacer"></div>
277
+ <span class="hint" id="ticks-hint">orange markers on the timeline are Cosmos+policy replans</span>
278
+ </div>
279
+ <div class="cam-grid" id="cam-grid"></div>
280
+ <div class="compare-row" id="compare-row"></div>
281
+ <div class="transport">
282
+ <button class="play" id="btn-play" title="play / pause">▶</button>
283
+ <div class="scrub-wrap">
284
+ <div class="replan-ticks" id="replan-ticks"></div>
285
+ <input type="range" id="scrub" min="0" max="1000" value="0" step="1">
286
+ </div>
287
+ <span class="time-readout num" id="time-readout">frame 0 · t = 0.0 s</span>
288
+ <select class="rate" id="rate">
289
+ <option value="0.25">0.25×</option>
290
+ <option value="0.5">0.5×</option>
291
+ <option value="1" selected>1×</option>
292
+ <option value="2">2×</option>
293
+ </select>
294
+ </div>
295
+ </div>
296
+
297
+ <div class="charts-row">
298
+ <div class="panel">
299
+ <h2>Vehicle controls</h2>
300
+ <div class="chart-legend" id="controls-legend"></div>
301
+ <div class="chart-box" id="controls-chart"></div>
302
+ </div>
303
+ <div class="panel">
304
+ <h2>Ego speed (m/s)</h2>
305
+ <div class="chart-legend" id="speed-legend"></div>
306
+ <div class="chart-box" id="speed-chart"></div>
307
+ </div>
308
+ </div>
309
+
310
+ <div class="bottom-row">
311
+ <div class="panel">
312
+ <div class="panel-head">
313
+ <h2>Bird's-eye view</h2>
314
+ <span class="spacer"></span>
315
+ <div class="modality-row" style="margin:0"><div class="seg" id="bev-mode"></div></div>
316
+ </div>
317
+ <div class="chart-legend" id="bev-legend"></div>
318
+ <canvas id="bev-canvas"></canvas>
319
+ <div class="hint" style="margin-top:6px" id="bev-hint"></div>
320
+ </div>
321
+ <div class="panel">
322
+ <h2>Replans — policy output &amp; Cosmos</h2>
323
+ <!-- Only the views in cosmos_views are rendered through Cosmos; the rest
324
+ of the policy's cameras are raw CARLA. This panel shows Cosmos
325
+ artifacts, which exist only for the rendered views, so without this
326
+ note the page reads as if the whole world were photoreal. -->
327
+ <div id="cosmos-scope" class="scope-note" style="display:none"></div>
328
+ <div class="replan-cards" id="replan-cards"></div>
329
+ <div class="cosmos-toolbar" id="cosmos-toolbar" style="display:none">
330
+ <button id="cosmos-play">▶ play all</button>
331
+ <button id="cosmos-restart">⟲ restart</button>
332
+ <span class="hint">looping 4 s Cosmos window for the selected replan</span>
333
+ </div>
334
+ <div class="cosmos-grid" id="cosmos-grid"></div>
335
+ </div>
336
+ </div>
337
+ </main>
338
+
339
+ <div class="viz-tooltip" id="tooltip"></div>
340
+
341
+ <script src="viewer_data.js"></script>
342
+ <script>
343
+ "use strict";
344
+
345
+ window.addEventListener("error", e => {
346
+ const b = document.createElement("pre");
347
+ b.style.cssText = "color:#e66767;background:#1a1a19;padding:10px 16px;margin:0;white-space:pre-wrap";
348
+ b.textContent = `viewer error: ${e.message} (${e.filename}:${e.lineno})`;
349
+ document.body.prepend(b);
350
+ });
351
+
352
+ /* ============================== state ============================== */
353
+ const S = {
354
+ data: null,
355
+ scen: null, // active scenario object
356
+ modality: null, // null = the scenario's first (a LEAD run's own cameras)
357
+ compare: false, // show the other arm of the same scene alongside
358
+ bevFollow: false, // BEV: follow ego at 60 m instead of fitting the episode
359
+ playing: false,
360
+ videos: {}, // cam -> <video>
361
+ master: null, // master <video>
362
+ selectedReplan: null,
363
+ charts: [], // {update(tSec)} cursor updaters
364
+ };
365
+ const CAMS = ["left", "front", "right", "rear", "front_tele"];
366
+ const LEAD_CAMS = ["lead_l0", "lead_f0", "lead_r0", "lead_l1", "lead_b0", "lead_r1"];
367
+ const CAM_LABELS = { simlingo_f0: "SIMLINGO INPUT (its only camera)", front: "FRONT (CARLA)", front_tele: "FRONT TELE", left: "LEFT", right: "RIGHT", rear: "REAR",
368
+ cosmos_front: "FRONT · COSMOS (policy input)",
369
+ nuplan_f0: "NUPLAN F0 · FRONT (policy)", nuplan_l0: "NUPLAN L0 · FRONT-LEFT",
370
+ nuplan_r0: "NUPLAN R0 · FRONT-RIGHT", nuplan_l1: "NUPLAN L1 · LEFT",
371
+ nuplan_r1: "NUPLAN R1 · RIGHT",
372
+ hv_front_wide: "FRONT WIDE (policy, before fisheye)", hv_cross_left: "CROSS LEFT",
373
+ hv_cross_right: "CROSS RIGHT", hv_front_tele: "FRONT TELE",
374
+ lead_f0: "LEAD F0 · FRONT", lead_l0: "L0 · FRONT-LEFT", lead_r0: "R0 · FRONT-RIGHT",
375
+ lead_l1: "L1 · REAR-LEFT", lead_b0: "B0 · REAR", lead_r1: "R1 · REAR-RIGHT" };
376
+ const MOD_LABELS = { lead: "LEAD input", rgb: "RGB", depth: "Depth", semseg: "SemSeg" };
377
+ // Replan markers are drawn only when sparse: LEAD replans every tick, and
378
+ // 140 markers paint the whole timeline orange.
379
+ const replanMarks = sc => sc.replans.length <= 40 ? sc.replans : [];
380
+ const sibling = sc => S.data.scenarios.find(o => o !== sc && o.group === sc.group &&
381
+ o.arm !== sc.arm && o.policy === sc.policy && o.seed === sc.seed) || null;
382
+ const armName = sc => `${sc.arm || "?"}${sc.arm_label ? ` (arm ${sc.arm_label})` : ""}`;
383
+ const COSMOS_LABELS = {
384
+ input: "sim input (CARLA)", restored: "Cosmos + exact restore (policy input)",
385
+ generation: "Cosmos raw (pre-restore)", mask_guided: "mask-guided gen",
386
+ control_vis: "control overlay", control_edge: "edge control", control_depth: "depth control",
387
+ control_seg: "seg control",
388
+ };
389
+ const css = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
390
+ const $ = id => document.getElementById(id);
391
+ const el = (tag, attrs = {}, ...kids) => {
392
+ const n = document.createElement(tag);
393
+ for (const [k, v] of Object.entries(attrs)) {
394
+ if (k === "class") n.className = v;
395
+ else if (k.startsWith("on")) n.addEventListener(k.slice(2), v);
396
+ else n.setAttribute(k, v);
397
+ }
398
+ n.append(...kids);
399
+ return n;
400
+ };
401
+ const fmt = (v, nd = 1) => v == null ? "–" : Number(v).toFixed(nd);
402
+ // Where the videos live. Empty when served from the suite directory; a host
403
+ // that keeps the page apart from its media (the HF gallery streams videos from
404
+ // the dataset) sets window.VIEWER_MEDIA_BASE before this script runs.
405
+ const media = p => /^(https?:)?\/\//.test(p) ? p : (window.VIEWER_MEDIA_BASE || "") + p;
406
+
407
+ /* ============================== boot ============================== */
408
+ window.addEventListener("DOMContentLoaded", () => {
409
+ if (!window.VIEWER_DATA) {
410
+ document.querySelector("main").innerHTML =
411
+ `<div class="panel">Failed to load <code>viewer_data.js</code> — run build.py on this suite directory.</div>`;
412
+ return;
413
+ }
414
+ S.data = window.VIEWER_DATA;
415
+ $("suite-id").textContent = S.data.suite;
416
+ const tabs = $("scenario-tabs");
417
+ S.data.scenarios.forEach((sc, i) => {
418
+ const label = sc.group ? `${sc.group.replaceAll("_", " ")} · ${armName(sc)}` : sc.name.replaceAll("_", " ");
419
+ tabs.append(el("button", { onclick: () => selectScenario(i), title: sc.name }, label));
420
+ });
421
+ // deep link: ?scenario=<name|index>&replan=<t0>&compare=1&bev=follow&t=<s>
422
+ const q = new URLSearchParams(location.search);
423
+ S.compare = q.get("compare") === "1";
424
+ S.bevFollow = q.get("bev") === "follow";
425
+ const want = q.get("scenario");
426
+ let idx = 0;
427
+ if (want != null) {
428
+ const byName = S.data.scenarios.findIndex(s => s.name === want);
429
+ idx = byName >= 0 ? byName : (parseInt(want, 10) || 0);
430
+ }
431
+ selectScenario(Math.max(0, Math.min(S.data.scenarios.length - 1, idx)));
432
+ const t0 = q.get("replan");
433
+ if (t0 != null) {
434
+ const r = S.scen.replans.find(r => String(r.t0) === t0);
435
+ const card = document.querySelectorAll(".replan-card")[S.scen.replans.indexOf(r)];
436
+ if (r && card) selectReplan(r, card);
437
+ }
438
+ const t = parseFloat(q.get("t"));
439
+ if (t > 0) { seekAll(t); updateAtTime(t); }
440
+ });
441
+
442
+ function selectScenario(i) {
443
+ S.scen = S.data.scenarios[i];
444
+ S.selectedReplan = null;
445
+ document.querySelectorAll("#scenario-tabs button").forEach((b, j) => b.classList.toggle("active", j === i));
446
+ renderInfo();
447
+ renderModalitySeg();
448
+ renderCamSetSeg();
449
+ renderCompareToggle();
450
+ renderCamGrid();
451
+ renderReplanTicks();
452
+ renderCharts();
453
+ renderBEVLegend();
454
+ renderReplans();
455
+ updateAtTime(0);
456
+ }
457
+
458
+ /* ============================== info ============================== */
459
+ function renderInfo() {
460
+ const sc = S.scen;
461
+ const facts = $("facts");
462
+ facts.innerHTML = "";
463
+ const fact = (k, v) => v != null && v !== "" && facts.append(el("span", {}, `${k} `, el("b", {}, String(v))));
464
+ fact("policy", sc.policy);
465
+ fact("town", sc.map && sc.map.town);
466
+ fact("jurisdiction", armName(sc));
467
+ if (sc.countries && sc.countries.length === 2) fact("arms", `A = ${sc.countries[0]} · B = ${sc.countries[1]}`);
468
+ fact("seed", sc.seed);
469
+ fact("length", `${(sc.num_frames / sc.fps).toFixed(1)} s`);
470
+ fact("ended", sc.execution && sc.execution.termination_reason);
471
+ if (sc.interference) fact("background", sc.interference.valid ? "no interference"
472
+ : `INTERFERED (${sc.interference.events.map(e => e.kind === "contact"
473
+ ? `${e.type} touched ego at ${e.at_s} s` : `${e.type} in ego's path ${e.from_s}-${e.to_s} s`).join("; ")})`);
474
+ if (sc.scene_instruction && sc.scene_instruction.mode !== "none") fact("text", sc.scene_instruction.mode);
475
+ const seen = (sc.map && sc.map.sign_visibility) || {};
476
+ for (const [sid, views] of Object.entries(seen)) {
477
+ const parts = Object.entries(views).map(([v, n]) => `${v} ${n}`).join(", ");
478
+ fact(`plate ${sid}`, parts ? `visible frames: ${parts}` : "never visible");
479
+ }
480
+ if (sc.map && !Object.keys(seen).length) fact("plates", "none");
481
+ $("scene-doc").textContent = sc.scene_doc || "";
482
+ $("evaluation-status").textContent = sc.evaluation_status || "Run validity not recorded";
483
+ $("instruction").textContent = sc.instruction || "(no policy instruction recorded)";
484
+ const cfg = { ...sc.config };
485
+ const prompt = cfg.prompt; delete cfg.prompt;
486
+ $("config-pre").textContent =
487
+ Object.entries(cfg).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join("\n") +
488
+ (prompt ? `\n\nprompt: ${prompt}` : "");
489
+ renderCosmosScope(sc);
490
+ }
491
+
492
+ // The policy reads every camera on its rig, but only the views in cosmos_views
493
+ // are rendered through Cosmos -- the others are handed to it as raw CARLA.
494
+ // Say so on the page: this panel shows Cosmos artifacts, which exist only for
495
+ // the rendered views, and without this the viewer reads as though the whole
496
+ // world were photoreal.
497
+ const POLICY_RIG_CAMERAS = ["left", "front", "right", "front_tele"];
498
+ function renderCosmosScope(sc) {
499
+ const el = $("cosmos-scope");
500
+ if (!el) return;
501
+ const cfg = sc.config || {};
502
+ // cosmos_views is populated even when Cosmos never ran (LEAD reads raw CARLA
503
+ // by design), so cosmos_enabled is the field that decides, not the view list.
504
+ if (cfg.cosmos_enabled === false) {
505
+ el.innerHTML = "<b>No Cosmos rendering in this suite.</b> The policy read " +
506
+ "raw CARLA frames on every camera — LEAD has no text channel and takes " +
507
+ "simulator pixels by design, so there is no photoreal condition here.";
508
+ el.style.display = "";
509
+ return;
510
+ }
511
+ const views = cfg.cosmos_views;
512
+ if (!Array.isArray(views) || views.length === 0) {
513
+ el.style.display = "none"; return;
514
+ }
515
+ const raw = POLICY_RIG_CAMERAS.filter(c => !views.includes(c));
516
+ const cos = views.map(v => `<span class="cos">${v}</span>`).join(", ");
517
+ el.innerHTML = raw.length
518
+ ? `<b>Cosmos covers ${views.length} of ${POLICY_RIG_CAMERAS.length} policy cameras.</b> ` +
519
+ `Rendered through Cosmos: ${cos}. Handed to the policy as raw CARLA: ` +
520
+ `${raw.join(", ")}. The panels below show only the rendered view(s), ` +
521
+ `so this page is not evidence the policy drove in a fully photoreal world.`
522
+ : `<b>All ${views.length} policy cameras rendered through Cosmos.</b>`;
523
+ el.style.display = "";
524
+ }
525
+
526
+ /* ============================== sensor grid ============================== */
527
+ function renderModalitySeg() {
528
+ const seg = $("modality-seg");
529
+ seg.innerHTML = "";
530
+ if (!S.scen.videos[S.modality]) S.modality = Object.keys(S.scen.videos)[0];
531
+ for (const mod of Object.keys(S.scen.videos)) {
532
+ seg.append(el("button", {
533
+ class: mod === S.modality ? "active" : "",
534
+ onclick: () => { S.modality = mod; renderModalitySeg(); renderCamGrid(); },
535
+ }, MOD_LABELS[mod] || mod));
536
+ }
537
+ }
538
+
539
+ // Which cameras the grid shows: by default the ones the policy itself reads;
540
+ // "standard" is the repo's own front / left / right / rear / tele.
541
+ function camLayout(sc, vids) {
542
+ // SimLingo reads one camera, its own; the repo's views are for orientation only.
543
+ if (vids.simlingo_f0 && sc.policy === "simlingo")
544
+ return { cls: "simlingo", cams: ["simlingo_f0", "front"], main: "simlingo_f0" };
545
+ if (S.camSet !== "standard") {
546
+ if (vids.nuplan_f0 && (sc.policy === "autovla" || sc.policy === "qwendrive")) {
547
+ // AutoVLA reads the side cameras L1/R1 (runs since 2026-10-18), Qwen-Drive L0/R0.
548
+ const side = sc.policy === "autovla" && vids.nuplan_l1 ? "1" : "0";
549
+ return { cls: "nuplan", cams: ["nuplan_l" + side, "nuplan_f0", "nuplan_r" + side], main: "nuplan_f0" };
550
+ }
551
+ if (vids.hv_front_wide && (sc.policy === "alpamayo" || sc.policy === "alpamayo2"))
552
+ return { cls: "hyperion", main: "hv_front_wide",
553
+ cams: ["hv_cross_left", "hv_front_wide", "hv_cross_right", "hv_front_tele"] };
554
+ }
555
+ return { cls: "", cams: CAMS, main: "front" };
556
+ }
557
+ function renderCamSetSeg() {
558
+ const seg = $("camset-seg");
559
+ seg.innerHTML = "";
560
+ for (const [key, label] of [["policy", "Policy cameras"], ["standard", "Standard cameras"]]) {
561
+ seg.append(el("button", {
562
+ class: (S.camSet || "policy") === key ? "active" : "",
563
+ onclick: () => { S.camSet = key; renderCamSetSeg(); renderCamGrid(); },
564
+ }, label));
565
+ }
566
+ }
567
+
568
+ function renderCompareToggle() {
569
+ const sib = sibling(S.scen);
570
+ $("compare-wrap").style.display = sib ? "" : "none";
571
+ if (sib) $("compare-label").textContent = `compare with ${armName(sib)}`;
572
+ $("compare").checked = S.compare && !!sib;
573
+ }
574
+ $("compare").addEventListener("change", () => {
575
+ S.compare = $("compare").checked;
576
+ renderCamGrid(); renderCharts(); renderBEVLegend();
577
+ updateAtTime(S.master ? S.master.currentTime : 0);
578
+ });
579
+
580
+ function renderCamGrid() {
581
+ const grid = $("cam-grid");
582
+ const wasTime = S.master ? S.master.currentTime : 0;
583
+ const wasPlaying = S.playing;
584
+ pauseAll();
585
+ grid.innerHTML = "";
586
+ S.videos = {}; S.master = null;
587
+ const vids = { ...(S.scen.videos[S.modality] || {}) };
588
+ const lead = S.modality === "lead";
589
+ const layout = lead ? { cls: "", cams: LEAD_CAMS, main: "lead_f0" } : camLayout(S.scen, vids);
590
+ const mainCam = layout.main;
591
+ // the stitched Cosmos render of the view the policy reads (front, nuPlan F0
592
+ // or Hyperion front wide) rides along in every modality, below that camera
593
+ const cosmos = S.scen.cosmos_stitched || {};
594
+ const cosKey = ["front", "nuplan_f0", "ft_front_wide"].find(k => cosmos[k]) || Object.keys(cosmos)[0];
595
+ if (cosKey && !lead) vids.cosmos_front = cosmos[cosKey];
596
+ CAM_LABELS.cosmos_front = `COSMOS · ${cosKey || "front"} (policy input)`;
597
+ grid.classList.toggle("has-cosmos", !!cosKey && !lead);
598
+ grid.classList.toggle("lead", lead);
599
+ grid.classList.toggle("nuplan", layout.cls === "nuplan");
600
+ grid.classList.toggle("hyperion", layout.cls === "hyperion");
601
+ grid.classList.toggle("simlingo", layout.cls === "simlingo");
602
+ const addVideo = (parent, key, src, label) => {
603
+ const v = el("video", { src: media(src), preload: "auto", muted: "", playsinline: "" });
604
+ parent.append(el("div", { class: "cam-cell", "data-cam": key }, v, el("span", { class: "cam-label" }, label)));
605
+ S.videos[key] = v;
606
+ return v;
607
+ };
608
+ for (const cam of [...layout.cams, "cosmos_front"]) {
609
+ if (!vids[cam]) continue;
610
+ const v = addVideo(grid, cam, vids[cam], CAM_LABELS[cam] || cam);
611
+ if (!S.master) S.master = v;
612
+ if (cam === mainCam) S.master = v;
613
+ }
614
+ // the same camera of the other arm, side by side: identical scenes should
615
+ // drive identically unless the arms differ in what the policy can see
616
+ const row = $("compare-row");
617
+ row.innerHTML = "";
618
+ const sib = S.compare ? sibling(S.scen) : null;
619
+ const sibSrc = sib && (sib.videos[S.modality] || {})[mainCam];
620
+ if (sibSrc && vids[mainCam]) {
621
+ addVideo(row, "cmp_self", vids[mainCam], `${armName(S.scen)} · ${CAM_LABELS[mainCam]}`);
622
+ addVideo(row, "cmp_other", sibSrc, `${armName(sib)} · ${CAM_LABELS[mainCam]}`);
623
+ }
624
+ if (S.master) {
625
+ S.master.addEventListener("timeupdate", onMasterTick);
626
+ S.master.addEventListener("ended", () => setPlaying(false));
627
+ // 1 ms offset forces the browser to decode and paint the first frame
628
+ for (const v of Object.values(S.videos)) v.currentTime = Math.max(wasTime, 0.001);
629
+ if (wasPlaying) setPlaying(true);
630
+ }
631
+ applyRate();
632
+ }
633
+
634
+ function setPlaying(on) {
635
+ S.playing = on;
636
+ $("btn-play").textContent = on ? "❚❚" : "▶";
637
+ for (const v of Object.values(S.videos)) on ? v.play().catch(() => {}) : v.pause();
638
+ }
639
+ function pauseAll() { for (const v of Object.values(S.videos)) v.pause(); }
640
+ function seekAll(t) {
641
+ for (const v of Object.values(S.videos)) {
642
+ if (Math.abs(v.currentTime - t) > 0.04) v.currentTime = t;
643
+ }
644
+ }
645
+ function applyRate() {
646
+ const r = parseFloat($("rate").value);
647
+ for (const v of Object.values(S.videos)) v.playbackRate = r;
648
+ }
649
+ $("rate").addEventListener("change", applyRate);
650
+ $("btn-play").addEventListener("click", () => {
651
+ if (S.master && S.master.ended) seekAll(0);
652
+ setPlaying(!S.playing);
653
+ });
654
+ $("scrub").addEventListener("input", () => {
655
+ if (!S.scen) return;
656
+ const dur = S.scen.num_frames / S.scen.fps;
657
+ const t = ($("scrub").value / 1000) * dur;
658
+ seekAll(t);
659
+ updateAtTime(t);
660
+ });
661
+ document.addEventListener("keydown", e => {
662
+ if (e.target.tagName === "INPUT" || e.target.tagName === "SELECT") return;
663
+ if (e.code === "Space") { e.preventDefault(); $("btn-play").click(); }
664
+ if (e.code === "ArrowRight" || e.code === "ArrowLeft") {
665
+ const dt = (e.code === "ArrowRight" ? 1 : -1) / (S.scen ? S.scen.fps : 10);
666
+ const t = Math.max(0, (S.master ? S.master.currentTime : 0) + dt);
667
+ seekAll(t); updateAtTime(t);
668
+ }
669
+ });
670
+
671
+ function onMasterTick() {
672
+ const t = S.master.currentTime;
673
+ // keep followers in lockstep with the master clock
674
+ for (const [cam, v] of Object.entries(S.videos)) {
675
+ if (v !== S.master && Math.abs(v.currentTime - t) > 0.1) v.currentTime = t;
676
+ }
677
+ updateAtTime(t);
678
+ }
679
+
680
+ function updateAtTime(t) {
681
+ const sc = S.scen;
682
+ const dur = sc.num_frames / sc.fps;
683
+ const frame = Math.min(sc.num_frames - 1, Math.round(t * sc.fps));
684
+ $("scrub").value = Math.round((t / dur) * 1000);
685
+ $("time-readout").textContent = `frame ${frame} / ${sc.num_frames} · t = ${t.toFixed(1)} s`;
686
+ for (const ch of S.charts) ch.update(t);
687
+ drawBEV(frame);
688
+ }
689
+
690
+ function renderReplanTicks() {
691
+ const box = $("replan-ticks");
692
+ box.innerHTML = "";
693
+ const dur = S.scen.num_frames / S.scen.fps;
694
+ const marks = replanMarks(S.scen);
695
+ $("ticks-hint").style.display = marks.length ? "" : "none";
696
+ for (const r of marks) {
697
+ const pct = (r.t0 / S.scen.fps) / dur * 100;
698
+ box.append(el("span", { style: `left:${pct}%`, title: `replan @ frame ${r.t0}` }));
699
+ }
700
+ }
701
+
702
+ /* ============================== line charts ============================== */
703
+ function niceTicks(y0, y1, n = 4) {
704
+ const raw = (y1 - y0) / n;
705
+ const mag = Math.pow(10, Math.floor(Math.log10(raw)));
706
+ const norm = raw / mag;
707
+ const step = mag * (norm < 1.5 ? 1 : norm < 3 ? 2 : norm < 7 ? 5 : 10);
708
+ const hi = Math.ceil(y1 / step) * step;
709
+ const ticks = [];
710
+ for (let v = Math.floor(y0 / step) * step; v <= hi + 1e-9; v += step) ticks.push(+v.toFixed(6));
711
+ return { ticks, hi };
712
+ }
713
+
714
+ function lineChart(container, opts) {
715
+ // opts: {series:[{name,color,x[],y[]}], yDomain:[lo,hi], xDomain:[lo,hi], height, yFmt, legendEl}
716
+ const W = 640, H = opts.height || 200;
717
+ const M = { l: 42, r: 74, t: 10, b: 24 };
718
+ const [x0, x1] = opts.xDomain;
719
+ let [y0, y1] = opts.yDomain;
720
+ let yTickVals;
721
+ if (opts.niceY) {
722
+ const nt = niceTicks(y0, y1, opts.yTicks || 4);
723
+ y1 = nt.hi; yTickVals = nt.ticks;
724
+ } else {
725
+ const n = opts.yTicks || 4;
726
+ yTickVals = Array.from({ length: n + 1 }, (_, i) => y0 + (y1 - y0) * i / n);
727
+ }
728
+ const px = x => M.l + (x - x0) / (x1 - x0) * (W - M.l - M.r);
729
+ const py = y => M.t + (1 - (y - y0) / (y1 - y0)) * (H - M.t - M.b);
730
+ const ns = "http://www.w3.org/2000/svg";
731
+ const svg = document.createElementNS(ns, "svg");
732
+ svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
733
+ container.innerHTML = "";
734
+ container.append(svg);
735
+ const add = (tag, attrs, parent = svg) => {
736
+ const n = document.createElementNS(ns, tag);
737
+ for (const [k, v] of Object.entries(attrs)) n.setAttribute(k, v);
738
+ parent.append(n);
739
+ return n;
740
+ };
741
+
742
+ // recessive grid + axes
743
+ for (const yv of yTickVals) {
744
+ add("line", { x1: M.l, x2: W - M.r, y1: py(yv), y2: py(yv), stroke: css("--grid"), "stroke-width": 1 });
745
+ add("text", {
746
+ x: M.l - 6, y: py(yv) + 4, "text-anchor": "end", fill: css("--text-muted"),
747
+ "font-size": 11, style: "font-variant-numeric: tabular-nums",
748
+ }).textContent = (opts.yFmt || (v => v))(yv);
749
+ }
750
+ for (let xv = Math.ceil(x0); xv <= x1; xv += 2) {
751
+ add("text", {
752
+ x: px(xv), y: H - 8, "text-anchor": "middle", fill: css("--text-muted"),
753
+ "font-size": 11, style: "font-variant-numeric: tabular-nums",
754
+ }).textContent = xv + " s";
755
+ }
756
+ if (y0 < 0 && y1 > 0)
757
+ add("line", { x1: M.l, x2: W - M.r, y1: py(0), y2: py(0), stroke: css("--baseline"), "stroke-width": 1 });
758
+
759
+ // replan markers
760
+ for (const r of (opts.replans || [])) {
761
+ const xr = px(r.t0 / S.scen.fps);
762
+ add("line", { x1: xr, x2: xr, y1: M.t, y2: H - M.b, stroke: css("--series-2"), "stroke-width": 1, "stroke-dasharray": "3 3", opacity: .6 });
763
+ }
764
+
765
+ // series: 2px lines + direct labels at line end (pushed apart if they collide)
766
+ const endLabels = [];
767
+ for (const s of opts.series) {
768
+ const d = s.x.map((xv, i) => `${i ? "L" : "M"}${px(xv).toFixed(1)},${py(s.y[i]).toFixed(1)}`).join("");
769
+ add("path", { d, fill: "none", stroke: s.color, "stroke-width": 2, "stroke-linejoin": "round",
770
+ ...(s.dash ? { "stroke-dasharray": s.dash } : {}) });
771
+ endLabels.push({ name: s.name, x: px(s.x[s.x.length - 1]) + 6, y: py(s.y[s.y.length - 1]) + 4 });
772
+ }
773
+ // clamp to the plot first, then push colliding labels apart upward from the
774
+ // bottom -- clamping after pushing stacked lines that all end at 0
775
+ for (const L of endLabels) L.y = Math.min(L.y, H - M.b);
776
+ endLabels.sort((a, b) => a.y - b.y);
777
+ for (let i = endLabels.length - 2; i >= 0; i--)
778
+ if (endLabels[i + 1].y - endLabels[i].y < 13) endLabels[i].y = endLabels[i + 1].y - 13;
779
+ for (const L of endLabels)
780
+ add("text", { x: L.x, y: L.y, fill: css("--text-secondary"), "font-size": 11 })
781
+ .textContent = L.name;
782
+
783
+ // legend (only for multi-series)
784
+ if (opts.legendEl) {
785
+ opts.legendEl.innerHTML = "";
786
+ if (opts.series.length > 1)
787
+ for (const s of opts.series)
788
+ opts.legendEl.append(el("span", { class: "item" },
789
+ el("span", { class: "swatch", style: `background:${s.color}` }), s.name));
790
+ }
791
+
792
+ // playback cursor + crosshair/tooltip
793
+ const cursor = add("line", { x1: px(x0), x2: px(x0), y1: M.t, y2: H - M.b, stroke: css("--text-secondary"), "stroke-width": 1, opacity: .8 });
794
+ const cross = add("line", { x1: 0, x2: 0, y1: M.t, y2: H - M.b, stroke: css("--text-muted"), "stroke-width": 1, opacity: 0 });
795
+ const dots = opts.series.map(s => add("circle", { r: 4, fill: s.color, stroke: css("--surface-2"), "stroke-width": 2, opacity: 0 }));
796
+ const tip = $("tooltip");
797
+
798
+ svg.addEventListener("mousemove", ev => {
799
+ const pt = svg.createSVGPoint(); pt.x = ev.clientX; pt.y = ev.clientY;
800
+ const p = pt.matrixTransform(svg.getScreenCTM().inverse());
801
+ if (p.x < M.l || p.x > W - M.r) { hideTip(); return; }
802
+ const tx = x0 + (p.x - M.l) / (W - M.l - M.r) * (x1 - x0);
803
+ cross.setAttribute("x1", px(tx)); cross.setAttribute("x2", px(tx));
804
+ cross.setAttribute("opacity", .8);
805
+ let rows = "";
806
+ opts.series.forEach((s, i) => {
807
+ let k = s.x.findIndex(v => v >= tx);
808
+ if (k < 0) k = s.x.length - 1;
809
+ if (k > 0 && Math.abs(s.x[k - 1] - tx) < Math.abs(s.x[k] - tx)) k--;
810
+ dots[i].setAttribute("cx", px(s.x[k])); dots[i].setAttribute("cy", py(s.y[k]));
811
+ dots[i].setAttribute("opacity", 1);
812
+ rows += `<div class="t-row"><span class="lhs"><span class="swatch" style="background:${s.color}"></span>${s.name}</span><b class="num">${(opts.yFmt || (v => v))(s.y[k])}</b></div>`;
813
+ });
814
+ tip.innerHTML = `<div class="t-title num">t = ${tx.toFixed(1)} s</div>${rows}`;
815
+ tip.style.display = "block";
816
+ tip.style.left = Math.min(window.innerWidth - 190, ev.clientX + 14) + "px";
817
+ tip.style.top = (ev.clientY + 14) + "px";
818
+ });
819
+ const hideTip = () => {
820
+ tip.style.display = "none"; cross.setAttribute("opacity", 0);
821
+ dots.forEach(d => d.setAttribute("opacity", 0));
822
+ };
823
+ svg.addEventListener("mouseleave", hideTip);
824
+ svg.addEventListener("click", ev => {
825
+ const pt = svg.createSVGPoint(); pt.x = ev.clientX; pt.y = ev.clientY;
826
+ const p = pt.matrixTransform(svg.getScreenCTM().inverse());
827
+ const tx = x0 + (p.x - M.l) / (W - M.l - M.r) * (x1 - x0);
828
+ if (tx >= x0 && tx <= x1) { seekAll(tx); updateAtTime(tx); }
829
+ });
830
+
831
+ return {
832
+ update(tSec) {
833
+ const xv = Math.max(x0, Math.min(x1, tSec));
834
+ cursor.setAttribute("x1", px(xv)); cursor.setAttribute("x2", px(xv));
835
+ },
836
+ };
837
+ }
838
+
839
+ function renderCharts() {
840
+ S.charts = [];
841
+ const sc = S.scen;
842
+ const dur = sc.num_frames / sc.fps;
843
+ const tOf = tick => tick / sc.fps;
844
+
845
+ const ctl = sc.controls;
846
+ const cx = ctl.map(c => tOf(c.tick));
847
+ S.charts.push(lineChart($("controls-chart"), {
848
+ xDomain: [0, dur], yDomain: [-1, 1], yTicks: 4, height: 210,
849
+ yFmt: v => Number(v).toFixed(2),
850
+ legendEl: $("controls-legend"),
851
+ replans: replanMarks(sc),
852
+ series: [
853
+ { name: "throttle", color: css("--series-1"), x: cx, y: ctl.map(c => c.throttle) },
854
+ { name: "brake", color: css("--series-2"), x: cx, y: ctl.map(c => c.brake) },
855
+ { name: "steer", color: css("--series-3"), x: cx, y: ctl.map(c => c.steer) },
856
+ ],
857
+ }));
858
+
859
+ const ego = sc.ego;
860
+ const series = [
861
+ { name: "speed", color: css("--series-1"), x: ego.frame.map(f => f / sc.fps), y: ego.speed },
862
+ ];
863
+ // the speed LEAD's planner asked for at each tick: where it falls to zero
864
+ // ahead of the actual speed, the stop was the policy's decision
865
+ const tgt = sc.replans.filter(r => r.target_speed != null);
866
+ if (tgt.length)
867
+ series.push({ name: "target", color: css("--series-2"), dash: "4 3",
868
+ x: tgt.map(r => r.t0 / sc.fps), y: tgt.map(r => r.target_speed) });
869
+ const sib = S.compare ? sibling(sc) : null;
870
+ if (sib)
871
+ series.push({ name: sib.arm_label ? `arm ${sib.arm_label}` : sib.arm, color: css("--series-3"),
872
+ x: sib.ego.frame.map(f => f / sib.fps), y: sib.ego.speed });
873
+ const vmax = Math.max(1, ...series.flatMap(s => s.y)) * 1.1;
874
+ S.charts.push(lineChart($("speed-chart"), {
875
+ xDomain: [0, dur], yDomain: [0, vmax], yTicks: 4, niceY: true, height: 210,
876
+ yFmt: v => Number(v).toFixed(1),
877
+ legendEl: $("speed-legend"),
878
+ replans: replanMarks(sc),
879
+ series,
880
+ }));
881
+ }
882
+
883
+ /* ============================== BEV ============================== */
884
+ const BEV = { pad: 26, hover: null, followSpan: 60 };
885
+
886
+ function bevTransform(canvas, frame = BEV.lastFrame || 0) {
887
+ const sc = S.scen, ego = sc.ego;
888
+ let cxm, cym, span;
889
+ if (S.bevFollow) {
890
+ const k = Math.min(frame, ego.x.length - 1);
891
+ cxm = ego.x[k]; cym = ego.y[k]; span = BEV.followSpan;
892
+ } else {
893
+ let xs = [...ego.x], ys = [...ego.y];
894
+ for (const r of sc.replans) for (const [x, y] of (r.waypoints_world || [])) { xs.push(x); ys.push(y); }
895
+ cxm = (Math.min(...xs) + Math.max(...xs)) / 2;
896
+ cym = (Math.min(...ys) + Math.max(...ys)) / 2;
897
+ span = Math.max(Math.max(...xs) - Math.min(...xs), Math.max(...ys) - Math.min(...ys), 20) * 1.25;
898
+ }
899
+ const s = (canvas.width - 2 * BEV.pad) / span;
900
+ // CARLA is left-handed (y flipped vs. conventional map view) — negate y for display
901
+ return {
902
+ s,
903
+ px: x => canvas.width / 2 + (x - cxm) * s,
904
+ py: y => canvas.height / 2 - (-(y - cym)) * s,
905
+ };
906
+ }
907
+
908
+ function renderBEVMode() {
909
+ const seg = $("bev-mode");
910
+ seg.innerHTML = "";
911
+ for (const [label, on] of [["fit episode", false], ["follow ego", true]])
912
+ seg.append(el("button", {
913
+ class: S.bevFollow === on ? "active" : "",
914
+ onclick: () => { S.bevFollow = on; renderBEVMode(); drawBEV(BEV.lastFrame || 0); },
915
+ }, label));
916
+ }
917
+
918
+ function renderBEVLegend() {
919
+ renderBEVMode();
920
+ const lg = $("bev-legend");
921
+ lg.innerHTML = "";
922
+ const sc = S.scen;
923
+ const items = [["ego", css("--series-1")]];
924
+ if (S.compare && sibling(sc)) items.push([`ego · ${armName(sibling(sc))}`, css("--series-3")]);
925
+ items.push(["scene vehicles", css("--text-secondary")], ["pedestrians", css("--series-5")],
926
+ ["traffic", css("--baseline")], ["policy plan", css("--series-2")]);
927
+ if (sc.map && sc.map.route && sc.map.route.pts.length) items.push(["intended route", css("--text-muted")]);
928
+ if (sc.map && sc.map.signs && sc.map.signs.length) items.push(["plate", css("--map-plate")]);
929
+ for (const [name, color] of items)
930
+ lg.append(el("span", { class: "item" }, el("span", { class: "swatch", style: `background:${color}` }), name));
931
+ const recorded = sc.ego.extent != null;
932
+ $("bev-hint").textContent = "Trails show the full episode; markers follow playback. The orange plan is the " +
933
+ "selected replan's, or else the latest one at the playback time. Footprints are " +
934
+ (recorded ? "the actors' CARLA bounding boxes." : "nominal sizes (this run predates recorded extents).");
935
+ }
936
+
937
+ // nominal half-extents [length, width] in m, for runs recorded without them
938
+ const nominalExtent = a => a.type === "pedestrian" ? [0.3, 0.3]
939
+ : /hgv|truck|cola|bus|firetruck|ambulance/.test(a.label || "") ? [4.0, 1.3] : [2.3, 1.0];
940
+
941
+ function drawMap(ctx, T, map) {
942
+ if (!map || !map.lanes) return;
943
+ const fillPoly = (pts, color) => {
944
+ ctx.fillStyle = color; ctx.beginPath();
945
+ pts.forEach(([x, y], i) => i ? ctx.lineTo(T.px(x), T.py(y)) : ctx.moveTo(T.px(x), T.py(y)));
946
+ ctx.closePath(); ctx.fill();
947
+ };
948
+ for (const l of map.lanes)
949
+ if (l.kind !== "Driving") fillPoly(l.poly, css("--map-walk"));
950
+ for (const l of map.lanes)
951
+ if (l.kind === "Driving") fillPoly(l.poly, l.junction ? css("--map-junction") : css("--map-road"));
952
+ ctx.globalAlpha = 0.35;
953
+ for (const c of map.crosswalks || []) fillPoly(c, css("--map-mark"));
954
+ ctx.globalAlpha = 1;
955
+ for (const m of map.marks || []) {
956
+ ctx.strokeStyle = m.color === "yellow" ? css("--map-yellow") : css("--map-mark");
957
+ ctx.globalAlpha = 0.8;
958
+ ctx.lineWidth = Math.max(1, 0.15 * T.s);
959
+ // CARLA broken lines are ~3 m paint / ~6 m gap
960
+ ctx.setLineDash(m.style === "broken" ? [3 * T.s, 6 * T.s] : []);
961
+ ctx.beginPath();
962
+ m.pts.forEach(([x, y], i) => i ? ctx.lineTo(T.px(x), T.py(y)) : ctx.moveTo(T.px(x), T.py(y)));
963
+ ctx.stroke();
964
+ }
965
+ ctx.setLineDash([]); ctx.globalAlpha = 1;
966
+ if (map.route && map.route.pts.length) {
967
+ ctx.strokeStyle = css("--text-muted"); ctx.lineWidth = 2; ctx.setLineDash([2, 6]);
968
+ ctx.beginPath();
969
+ map.route.pts.forEach(([x, y], i) => i ? ctx.lineTo(T.px(x), T.py(y)) : ctx.moveTo(T.px(x), T.py(y)));
970
+ ctx.stroke(); ctx.setLineDash([]);
971
+ }
972
+ for (const sg of map.signs || []) {
973
+ const X = T.px(sg.x), Y = T.py(sg.y);
974
+ ctx.fillStyle = css("--map-plate"); ctx.beginPath();
975
+ for (let i = 0; i < 8; i++) {
976
+ const a = Math.PI / 8 + i * Math.PI / 4;
977
+ const R = Math.max(7, 0.6 * T.s);
978
+ i ? ctx.lineTo(X + R * Math.cos(a), Y + R * Math.sin(a)) : ctx.moveTo(X + R * Math.cos(a), Y + R * Math.sin(a));
979
+ }
980
+ ctx.closePath(); ctx.fill();
981
+ ctx.fillStyle = css("--text-primary"); ctx.font = "20px system-ui";
982
+ ctx.fillText(sg.id, X + 12, Y - 10);
983
+ }
984
+ }
985
+
986
+ function drawBEV(frame) {
987
+ const canvas = $("bev-canvas");
988
+ const cssW = canvas.clientWidth || 440;
989
+ if (canvas.width !== cssW * 2) { canvas.width = cssW * 2; canvas.height = cssW * 2; }
990
+ const ctx = canvas.getContext("2d");
991
+ const sc = S.scen, ego = sc.ego;
992
+ const T = bevTransform(canvas, frame);
993
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
994
+ drawMap(ctx, T, sc.map);
995
+
996
+ // scale bar
997
+ const step = 10 * T.s;
998
+ ctx.strokeStyle = css("--text-muted"); ctx.lineWidth = 3;
999
+ ctx.beginPath(); ctx.moveTo(BEV.pad, canvas.height - BEV.pad); ctx.lineTo(BEV.pad + step, canvas.height - BEV.pad); ctx.stroke();
1000
+ ctx.fillStyle = css("--text-muted"); ctx.font = "20px system-ui";
1001
+ ctx.fillText("10 m", BEV.pad, canvas.height - BEV.pad - 8);
1002
+
1003
+ const trail = (xs, ys, upTo, color, width) => {
1004
+ ctx.strokeStyle = color; ctx.lineWidth = width; ctx.beginPath();
1005
+ for (let i = 0; i <= upTo; i++) {
1006
+ const X = T.px(xs[i]), Y = T.py(ys[i]);
1007
+ i ? ctx.lineTo(X, Y) : ctx.moveTo(X, Y);
1008
+ }
1009
+ ctx.stroke();
1010
+ };
1011
+ // footprint at true scale (min 5 px so far-zoomed actors stay visible),
1012
+ // with a nose tick showing heading
1013
+ const footprint = (x, y, yawDeg, ext, color, hollow) => {
1014
+ const X = T.px(x), Y = T.py(y);
1015
+ const L = Math.max(5, ext[0] * T.s), W = Math.max(4, ext[1] * T.s);
1016
+ ctx.save(); ctx.translate(X, Y); ctx.rotate(-yawDeg * Math.PI / 180); // y-flip mirrors rotation
1017
+ ctx.fillStyle = color; ctx.strokeStyle = color; ctx.lineWidth = 3;
1018
+ ctx.beginPath(); ctx.rect(-L, -W, 2 * L, 2 * W);
1019
+ hollow ? ctx.stroke() : ctx.fill();
1020
+ ctx.strokeStyle = css("--surface-1"); ctx.lineWidth = 2;
1021
+ ctx.beginPath(); ctx.moveTo(L * 0.4, 0); ctx.lineTo(L, 0); ctx.stroke();
1022
+ ctx.restore();
1023
+ };
1024
+ const walker = (x, y, color) => {
1025
+ ctx.fillStyle = color; ctx.beginPath();
1026
+ ctx.arc(T.px(x), T.py(y), Math.max(6, 0.35 * T.s), 0, 7); ctx.fill();
1027
+ };
1028
+ const idx = a => {
1029
+ let k = a.frame.findIndex(f => f >= frame);
1030
+ if (k < 0) k = a.frame.length - 1;
1031
+ return k;
1032
+ };
1033
+
1034
+ // actors: background traffic faint and trail-less; scene actors with trails
1035
+ // without a scene graph, anything not tagged as traffic counts as scene
1036
+ const anyScene = sc.actors.some(o => o.scene);
1037
+ for (const a of sc.actors) {
1038
+ const k = idx(a);
1039
+ const isScene = a.scene || (!anyScene && !a.background);
1040
+ const color = a.type === "pedestrian" ? css("--series-5")
1041
+ : isScene ? css("--text-secondary") : css("--baseline");
1042
+ if (isScene) {
1043
+ ctx.globalAlpha = 0.45;
1044
+ trail(a.x, a.y, a.x.length - 1, color, 2);
1045
+ ctx.globalAlpha = 1;
1046
+ }
1047
+ if (a.type === "pedestrian") walker(a.x[k], a.y[k], color);
1048
+ else footprint(a.x[k], a.y[k], a.yaw[k], a.extent || nominalExtent(a), color, false);
1049
+ }
1050
+
1051
+ // the policy's plan: the selected replan, else the latest one at this frame
1052
+ let rp = S.selectedReplan;
1053
+ if (!rp) for (const r of sc.replans) if (r.t0 <= frame && r.waypoints_world) rp = r;
1054
+ if (rp && rp.waypoints_world) {
1055
+ ctx.globalAlpha = S.selectedReplan ? 1 : 0.85;
1056
+ ctx.strokeStyle = css("--series-2"); ctx.lineWidth = 3;
1057
+ ctx.setLineDash([8, 6]); ctx.beginPath();
1058
+ rp.waypoints_world.forEach(([x, y], i) => {
1059
+ const X = T.px(x), Y = T.py(y);
1060
+ i ? ctx.lineTo(X, Y) : ctx.moveTo(X, Y);
1061
+ });
1062
+ ctx.stroke(); ctx.setLineDash([]);
1063
+ ctx.fillStyle = css("--series-2");
1064
+ for (const [x, y] of rp.waypoints_world) {
1065
+ ctx.beginPath(); ctx.arc(T.px(x), T.py(y), 4, 0, 7); ctx.fill();
1066
+ }
1067
+ ctx.globalAlpha = 1;
1068
+ }
1069
+
1070
+ // the other arm's ego, hollow, so the two runs of one scene overlay
1071
+ const sib = S.compare ? sibling(sc) : null;
1072
+ if (sib) {
1073
+ const se = sib.ego, j = Math.min(frame, se.x.length - 1);
1074
+ ctx.setLineDash([10, 8]); ctx.globalAlpha = 0.8;
1075
+ trail(se.x, se.y, se.x.length - 1, css("--series-3"), 3);
1076
+ ctx.setLineDash([]); ctx.globalAlpha = 1;
1077
+ footprint(se.x[j], se.y[j], se.yaw[j], se.extent || [2.4, 1.05], css("--series-3"), true);
1078
+ }
1079
+
1080
+ // ego: trail up to current frame + full faint remainder
1081
+ ctx.globalAlpha = 0.3;
1082
+ trail(ego.x, ego.y, ego.x.length - 1, css("--series-1"), 2);
1083
+ ctx.globalAlpha = 1;
1084
+ const k = Math.min(frame, ego.x.length - 1);
1085
+ trail(ego.x, ego.y, k, css("--series-1"), 4);
1086
+ footprint(ego.x[k], ego.y[k], ego.yaw[k], ego.extent || [2.4, 1.05], css("--series-1"), false);
1087
+
1088
+ BEV.lastFrame = frame;
1089
+ }
1090
+
1091
+ $("bev-canvas").addEventListener("mousemove", ev => {
1092
+ const canvas = $("bev-canvas");
1093
+ const rect = canvas.getBoundingClientRect();
1094
+ const mx = (ev.clientX - rect.left) * canvas.width / rect.width;
1095
+ const my = (ev.clientY - rect.top) * canvas.height / rect.height;
1096
+ const T = bevTransform(canvas);
1097
+ const frame = BEV.lastFrame || 0;
1098
+ const tip = $("tooltip");
1099
+ let best = null, bestD = 26 * 26;
1100
+ const consider = (name, sub, x, y) => {
1101
+ const d = (T.px(x) - mx) ** 2 + (T.py(y) - my) ** 2;
1102
+ if (d < bestD) { bestD = d; best = { name, sub, x, y }; }
1103
+ };
1104
+ const sc = S.scen;
1105
+ const k = Math.min(frame, sc.ego.x.length - 1);
1106
+ consider("ego", `${fmt(sc.ego.speed[k])} m/s`, sc.ego.x[k], sc.ego.y[k]);
1107
+ for (const a of sc.actors) {
1108
+ let j = a.frame.findIndex(f => f >= frame);
1109
+ if (j < 0) j = a.frame.length - 1;
1110
+ const role = a.scene ? "scene" : a.background ? "traffic" : "";
1111
+ consider(a.type === "vehicle" ? a.label : "pedestrian", `id ${a.id}${role ? " · " + role : ""}`, a.x[j], a.y[j]);
1112
+ }
1113
+ for (const sg of (sc.map && sc.map.signs) || [])
1114
+ consider(`plate ${sg.id}`, Object.entries(sg.seen || {}).map(([v, n]) => `${v}: ${n} frames`).join(", ") || "never in view", sg.x, sg.y);
1115
+ if (best) {
1116
+ tip.innerHTML = `<div class="t-title">${best.name}</div><div class="t-row"><span>${best.sub}</span></div>` +
1117
+ `<div class="t-row"><span class="num">x ${fmt(best.x)} · y ${fmt(best.y)}</span></div>`;
1118
+ tip.style.display = "block";
1119
+ tip.style.left = Math.min(window.innerWidth - 190, ev.clientX + 14) + "px";
1120
+ tip.style.top = (ev.clientY + 14) + "px";
1121
+ } else tip.style.display = "none";
1122
+ });
1123
+ $("bev-canvas").addEventListener("mouseleave", () => { $("tooltip").style.display = "none"; });
1124
+
1125
+ /* ============================== replans ============================== */
1126
+ // The numbers behind the words: SimLingo's text ends in "Waypoints:" and its
1127
+ // path / speed come from its action head, not as text.
1128
+ function outputsLine(r) {
1129
+ const parts = [];
1130
+ if (r.plan_end) {
1131
+ const [x, y] = r.plan_end;
1132
+ parts.push(`path: ${r.plan_points} points, ends ${fmt(x, 1)} m ahead, ` +
1133
+ `${fmt(Math.abs(y), 1)} m ${y >= 0 ? "left" : "right"}`);
1134
+ }
1135
+ if (r.target_speed != null) parts.push(`speed plan: ${fmt(r.target_speed, 1)} m/s`);
1136
+ if (r.control) parts.push(`control: steer ${fmt(r.control.steer, 2)}, ` +
1137
+ `throttle ${fmt(r.control.throttle, 2)}, brake ${fmt(r.control.brake, 2)}`);
1138
+ return "→ " + parts.join(" · ");
1139
+ }
1140
+
1141
+ function renderReplans() {
1142
+ const box = $("replan-cards");
1143
+ box.innerHTML = "";
1144
+ $("cosmos-grid").innerHTML = "";
1145
+ $("cosmos-toolbar").style.display = "none";
1146
+ const cosmosOn = (S.scen.config || {}).cosmos_enabled !== false;
1147
+ for (const r of S.scen.replans) {
1148
+ const stats = [
1149
+ `sim t = ${fmt(r.sim_time_s)} s`,
1150
+ ...(cosmosOn ? [`Cosmos ${fmt(r.cosmos_s, 0)} s`] : []),
1151
+ `policy ${fmt(r.policy_s)} s`,
1152
+ `v = ${fmt(r.speed_mps)} m/s`,
1153
+ ];
1154
+ // LEAD has no chain-of-thought; its own outputs say what it decided
1155
+ const said = [].concat(r.cot || []).join(" ") || (r.target_speed != null
1156
+ ? `target ${fmt(r.target_speed, 2)} m/s${r.brake_flag ? " · brake flag set" : ""}` +
1157
+ (r.steer_modality ? ` · steering from ${r.steer_modality}` : "")
1158
+ : "(no chain-of-thought)");
1159
+ const card = el("div", { class: "replan-card", onclick: () => selectReplan(r, card) },
1160
+ el("div", { class: "rc-head" },
1161
+ el("b", { class: "num" }, `replan @ frame ${r.t0}`),
1162
+ ...stats.map(t => el("span", { class: "rc-stat num" }, t)),
1163
+ ),
1164
+ el("div", { class: "rc-cot" }, said),
1165
+ ...(r.cot && r.cot.length && (r.control || r.plan_end)
1166
+ ? [el("div", { class: "rc-out num" }, outputsLine(r))] : []),
1167
+ );
1168
+ box.append(card);
1169
+ }
1170
+ }
1171
+
1172
+ function selectReplan(r, card) {
1173
+ const was = S.selectedReplan === r;
1174
+ S.selectedReplan = was ? null : r;
1175
+ document.querySelectorAll(".replan-card").forEach(c => c.classList.remove("active"));
1176
+ const grid = $("cosmos-grid");
1177
+ grid.innerHTML = "";
1178
+ $("cosmos-toolbar").style.display = "none";
1179
+ if (!was) {
1180
+ card.classList.add("active");
1181
+ for (const [view, vids] of Object.entries(r.views || {})) {
1182
+ for (const [key, path] of Object.entries(vids)) {
1183
+ const v = el("video", { src: media(path), preload: "metadata", muted: "", loop: "", playsinline: "", controls: "" });
1184
+ v.currentTime = 0.001; // decode + paint the first frame
1185
+ grid.append(el("div", { class: "cosmos-cell" }, v,
1186
+ el("span", { class: "cam-label" }, `${view} · ${COSMOS_LABELS[key] || key}`)));
1187
+ }
1188
+ }
1189
+ if (grid.children.length) $("cosmos-toolbar").style.display = "flex";
1190
+ // jump the main playback to the replan moment
1191
+ const t = r.t0 / S.scen.fps;
1192
+ seekAll(t); updateAtTime(t);
1193
+ }
1194
+ drawBEV(BEV.lastFrame || 0);
1195
+ }
1196
+
1197
+ $("cosmos-play").addEventListener("click", () => {
1198
+ const vids = document.querySelectorAll("#cosmos-grid video");
1199
+ const anyPaused = [...vids].some(v => v.paused);
1200
+ vids.forEach(v => anyPaused ? v.play().catch(() => {}) : v.pause());
1201
+ $("cosmos-play").textContent = anyPaused ? "❚❚ pause all" : "▶ play all";
1202
+ });
1203
+ $("cosmos-restart").addEventListener("click", () => {
1204
+ document.querySelectorAll("#cosmos-grid video").forEach(v => { v.currentTime = 0; v.play().catch(() => {}); });
1205
+ $("cosmos-play").textContent = "❚❚ pause all";
1206
+ });
1207
+ </script>
1208
+ </body>
1209
+ </html>
dualworld/latest_uniad_gnss_fix_test/scenario_ltap_od_signalized__US/videos/rgb_front.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19aa35d586ad568256c20d7ba82feca8258eeacb3d5facec110272cfd4c0c28c
3
+ size 9563429
dualworld/latest_uniad_gnss_fix_test/suite.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "latest_uniad_gnss_fix_test",
3
+ "scenarios": [
4
+ {
5
+ "name": "conflict_turn_on_red_gruenpfeil_de__German-gruenpfeil",
6
+ "group": "conflict_turn_on_red_gruenpfeil_de",
7
+ "arm": "German-gruenpfeil",
8
+ "arm_label": "A",
9
+ "policy": "uniad",
10
+ "evaluation_status": "Execution validated; rule scoring incomplete",
11
+ "town": "Town05",
12
+ "length_s": 16.0
13
+ },
14
+ {
15
+ "name": "scenario_ltap_od_signalized__US",
16
+ "group": "scenario_ltap_od_signalized",
17
+ "arm": "US",
18
+ "arm_label": null,
19
+ "policy": "uniad",
20
+ "evaluation_status": "Execution validated; rule scoring incomplete",
21
+ "town": "Town05",
22
+ "length_s": 14.0
23
+ }
24
+ ]
25
+ }
dualworld/latest_uniad_gnss_fix_test/viewer_data.js ADDED
The diff for this file is too large to render. See raw diff