itsMarco-G commited on
Commit
1deea0f
·
1 Parent(s): 37663c4

Web UI updates and assets upload

Browse files
reachy_phone_home/assets/angry_reachy.mp3 ADDED
Binary file (55.1 kB). View file
 
reachy_phone_home/assets/beep1.mp3 ADDED
Binary file (48.4 kB). View file
 
reachy_phone_home/assets/beep2.mp3 ADDED
Binary file (52.2 kB). View file
 
reachy_phone_home/assets/happy_reachy.mp3 ADDED
Binary file (63.5 kB). View file
 
reachy_phone_home/assets/reach_curious.mp3 ADDED
Binary file (49.3 kB). View file
 
reachy_phone_home/assets/reachy_reachy.mp3 ADDED
Binary file (59.7 kB). View file
 
reachy_phone_home/assets/sad_reachy.mp3 ADDED
Binary file (73.9 kB). View file
 
reachy_phone_home/static/index.html CHANGED
@@ -161,6 +161,12 @@
161
  flex-direction: column;
162
  align-items: center;
163
  }
 
 
 
 
 
 
164
  .settings-card {
165
  border: 1px solid #232836;
166
  background: #0b0e13;
@@ -313,6 +319,7 @@
313
  <div class="status" id="status">Connecting...</div>
314
  </header>
315
  <div class="container">
 
316
  <div class="tabs">
317
  <button class="tab-btn active" id="tabStatus">Status</button>
318
  <button class="tab-btn" id="tabSettings">Settings</button>
 
161
  flex-direction: column;
162
  align-items: center;
163
  }
164
+ .hero-img {
165
+ width: min(720px, 100%);
166
+ border-radius: 12px;
167
+ border: 1px solid #232836;
168
+ margin: 12px 20px 0;
169
+ }
170
  .settings-card {
171
  border: 1px solid #232836;
172
  background: #0b0e13;
 
319
  <div class="status" id="status">Connecting...</div>
320
  </header>
321
  <div class="container">
322
+ <img class="hero-img" src="/static/reachy_phone_home.PNG" alt="Reachy Phone Home" />
323
  <div class="tabs">
324
  <button class="tab-btn active" id="tabStatus">Status</button>
325
  <button class="tab-btn" id="tabSettings">Settings</button>
static/index.html DELETED
@@ -1,480 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>Reachy Phone Home Logs</title>
7
- <style>
8
- :root {
9
- color-scheme: dark;
10
- --video-max-width: 720px;
11
- --video-aspect: 4 / 3;
12
- }
13
- body {
14
- margin: 0;
15
- font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
16
- background: #0f1115;
17
- color: #e9e6e0;
18
- }
19
- header {
20
- padding: 16px 20px;
21
- border-bottom: 1px solid #232836;
22
- display: flex;
23
- align-items: center;
24
- justify-content: space-between;
25
- }
26
- .container {
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- }
31
- header h1 {
32
- margin: 0;
33
- font-size: 18px;
34
- }
35
- .status {
36
- font-size: 12px;
37
- color: #9aa4b2;
38
- }
39
- #video {
40
- padding: 16px 20px 0;
41
- display: flex;
42
- flex-direction: column;
43
- align-items: center;
44
- gap: 12px;
45
- }
46
- .video-frame {
47
- width: 100%;
48
- max-width: var(--video-max-width);
49
- aspect-ratio: var(--video-aspect);
50
- border-radius: 12px;
51
- border: 1px solid #232836;
52
- overflow: hidden;
53
- position: relative;
54
- background: #0b0e13;
55
- }
56
- #video img {
57
- position: absolute;
58
- inset: 0;
59
- width: 100%;
60
- height: 100%;
61
- object-fit: contain;
62
- display: block;
63
- }
64
- .video-placeholder {
65
- position: absolute;
66
- inset: 0;
67
- border-radius: 12px;
68
- background: #0b0e13;
69
- color: #7c8696;
70
- display: flex;
71
- align-items: center;
72
- justify-content: center;
73
- font-size: 12px;
74
- letter-spacing: 0.3px;
75
- }
76
- .video-controls {
77
- display: flex;
78
- align-items: center;
79
- gap: 12px;
80
- }
81
- .video-controls button {
82
- background: #1b2230;
83
- color: #e9e6e0;
84
- border: 1px solid #2b3447;
85
- padding: 8px 14px;
86
- border-radius: 8px;
87
- cursor: pointer;
88
- font-size: 13px;
89
- }
90
- .video-controls button:hover {
91
- background: #242d3f;
92
- }
93
- .warning {
94
- font-size: 12px;
95
- color: #d5a66b;
96
- }
97
- .instructions {
98
- margin: 16px 20px 0;
99
- max-width: 960px;
100
- padding: 14px 16px;
101
- border-radius: 12px;
102
- border: 1px solid #232836;
103
- background: #0b0e13;
104
- }
105
- .instructions h2 {
106
- margin: 0 0 8px 0;
107
- font-size: 14px;
108
- letter-spacing: 0.4px;
109
- text-transform: uppercase;
110
- color: #9aa4b2;
111
- }
112
- .instructions p {
113
- margin: 0 0 8px 0;
114
- color: #c9d1d9;
115
- }
116
- .instructions ol {
117
- margin: 0 0 8px 0;
118
- padding-left: 18px;
119
- color: #c9d1d9;
120
- }
121
- .instructions ul {
122
- margin: 0;
123
- padding-left: 18px;
124
- color: #c9d1d9;
125
- }
126
- .instructions li {
127
- margin-bottom: 6px;
128
- }
129
- .muted {
130
- color: #7c8696;
131
- }
132
- .cards {
133
- display: grid;
134
- gap: 12px;
135
- grid-template-columns: repeat(2, minmax(220px, 1fr));
136
- margin: 16px 20px 40px;
137
- max-width: 960px;
138
- width: min(960px, 100%);
139
- }
140
- .card {
141
- border: 1px solid #232836;
142
- background: #0b0e13;
143
- border-radius: 12px;
144
- padding: 10px 12px;
145
- }
146
- .card h3 {
147
- margin: 0 0 8px 0;
148
- font-size: 13px;
149
- color: #e9e6e0;
150
- }
151
- .card .status-pill {
152
- display: inline-block;
153
- padding: 3px 8px;
154
- border-radius: 999px;
155
- font-size: 11px;
156
- background: #1b2230;
157
- color: #9aa4b2;
158
- border: 1px solid #2b3447;
159
- }
160
- .card.active .status-pill {
161
- background: #1a3b2c;
162
- color: #d6f8e4;
163
- border-color: #25533e;
164
- }
165
- .card.alert .status-pill {
166
- background: #4a1f1f;
167
- color: #ffd6d6;
168
- border-color: #6b2b2b;
169
- }
170
- .card .sub {
171
- margin-top: 6px;
172
- font-size: 11px;
173
- color: #7c8696;
174
- }
175
- .card-header {
176
- display: flex;
177
- align-items: center;
178
- justify-content: space-between;
179
- gap: 8px;
180
- }
181
- .event-line {
182
- margin: 0 20px 20px;
183
- max-width: 960px;
184
- color: #9aa4b2;
185
- font-size: 12px;
186
- text-align: center;
187
- }
188
- .log-panel {
189
- width: 100%;
190
- max-width: 720px;
191
- border-radius: 12px;
192
- border: 1px solid #232836;
193
- background: #0b0e13;
194
- padding: 10px 12px;
195
- }
196
- .log-toolbar {
197
- display: flex;
198
- align-items: center;
199
- justify-content: space-between;
200
- gap: 12px;
201
- margin-bottom: 8px;
202
- font-size: 12px;
203
- color: #9aa4b2;
204
- }
205
- .log-toolbar button {
206
- background: #1b2230;
207
- color: #e9e6e0;
208
- border: 1px solid #2b3447;
209
- padding: 6px 10px;
210
- border-radius: 8px;
211
- cursor: pointer;
212
- font-size: 12px;
213
- }
214
- .log-toolbar button:hover {
215
- background: #242d3f;
216
- }
217
- .log-body {
218
- height: 180px;
219
- overflow-y: auto;
220
- white-space: pre-wrap;
221
- line-height: 1.4;
222
- font-size: 12px;
223
- color: #c9d1d9;
224
- }
225
- .log-line {
226
- margin-bottom: 6px;
227
- }
228
- </style>
229
- </head>
230
- <body>
231
- <header>
232
- <h1>Reachy Phone Home Logs</h1>
233
- <div class="status" id="status">Connecting...</div>
234
- </header>
235
- <div class="container">
236
- <div class="cards">
237
- <div class="card" id="cardPhoneHome">
238
- <div class="card-header">
239
- <h3>Phone Home</h3>
240
- <span class="status-pill" id="statusPhoneHome">Waiting</span>
241
- </div>
242
- <div class="sub">Place phone in front of Reachy</div>
243
- </div>
244
- <div class="card" id="cardPhoneDetected">
245
- <div class="card-header">
246
- <h3>Phone Detected</h3>
247
- <span class="status-pill" id="statusPhoneDetected">Unknown</span>
248
- </div>
249
- <div class="sub">Phone seen by camera</div>
250
- </div>
251
- <div class="card" id="cardPhoneUse">
252
- <div class="card-header">
253
- <h3>Phone Use</h3>
254
- <span class="status-pill" id="statusPhoneUse">No</span>
255
- </div>
256
- <div class="sub">Phone overlaps person</div>
257
- </div>
258
- <div class="card" id="cardReachyStatus">
259
- <div class="card-header">
260
- <h3>Reachy’s Status</h3>
261
- <span class="status-pill" id="statusReachy">Idle</span>
262
- </div>
263
- <div class="sub" id="subReachy">Waiting for signals</div>
264
- </div>
265
- </div>
266
- <div id="video">
267
- <div class="video-frame">
268
- <div id="videoPlaceholder" class="video-placeholder">Debug video disabled</div>
269
- <img id="videoStream" data-src="/stream.mjpg" alt="Reachy camera stream" />
270
- </div>
271
- <div class="video-controls">
272
- <button id="debugBtn" type="button">Enable debug video</button>
273
- <span class="warning">Debug video may affect performance.</span>
274
- </div>
275
- </div>
276
- </div>
277
- <script>
278
- let lastId = 0;
279
- const statusEl = document.getElementById("status");
280
- const debugBtn = document.getElementById("debugBtn");
281
- const videoStream = document.getElementById("videoStream");
282
- const videoPlaceholder = document.getElementById("videoPlaceholder");
283
- let videoEnabled = false;
284
- let currentState = null;
285
- let phoneDetected = null;
286
- let phoneUse = false;
287
- let phoneHome = false;
288
- const logsEnabled = true;
289
-
290
- const cardPhoneDetected = document.getElementById("cardPhoneDetected");
291
- const cardPhoneUse = document.getElementById("cardPhoneUse");
292
- const cardReachyStatus = document.getElementById("cardReachyStatus");
293
- const cardPhoneHome = document.getElementById("cardPhoneHome");
294
- const statusPhoneDetected = document.getElementById("statusPhoneDetected");
295
- const statusPhoneUse = document.getElementById("statusPhoneUse");
296
- const statusReachy = document.getElementById("statusReachy");
297
- const subReachy = document.getElementById("subReachy");
298
- const statusPhoneHome = document.getElementById("statusPhoneHome");
299
- let aspectTimer = null;
300
- let snapshotTimer = null;
301
-
302
- function updateAspectFromStream() {
303
- if (videoStream.naturalWidth && videoStream.naturalHeight) {
304
- document.documentElement.style.setProperty(
305
- "--video-aspect",
306
- `${videoStream.naturalWidth} / ${videoStream.naturalHeight}`
307
- );
308
- }
309
- }
310
-
311
- function updateAspectFromSnapshot() {
312
- const img = new Image();
313
- img.onload = () => {
314
- if (img.naturalWidth && img.naturalHeight) {
315
- document.documentElement.style.setProperty(
316
- "--video-aspect",
317
- `${img.naturalWidth} / ${img.naturalHeight}`
318
- );
319
- }
320
- };
321
- img.src = `/snapshot.jpg?t=${Date.now()}`;
322
- }
323
-
324
- function setVideoEnabled(enabled) {
325
- videoEnabled = enabled;
326
- if (videoEnabled) {
327
- debugBtn.textContent = "Disable debug video";
328
- fetch("/debug?enabled=1")
329
- .then(() => {
330
- const base = videoStream.dataset.src;
331
- videoStream.src = `${base}?t=${Date.now()}`;
332
- videoStream.style.display = "block";
333
- videoPlaceholder.style.display = "none";
334
- updateAspectFromStream();
335
- if (aspectTimer) {
336
- clearInterval(aspectTimer);
337
- }
338
- aspectTimer = setInterval(updateAspectFromStream, 500);
339
- updateAspectFromSnapshot();
340
- if (snapshotTimer) {
341
- clearInterval(snapshotTimer);
342
- }
343
- snapshotTimer = setInterval(updateAspectFromSnapshot, 2000);
344
- })
345
- .catch(() => {});
346
- } else {
347
- videoStream.removeAttribute("src");
348
- videoStream.style.display = "none";
349
- videoPlaceholder.style.display = "flex";
350
- debugBtn.textContent = "Enable debug video";
351
- fetch("/debug?enabled=0").catch(() => {});
352
- if (aspectTimer) {
353
- clearInterval(aspectTimer);
354
- aspectTimer = null;
355
- }
356
- if (snapshotTimer) {
357
- clearInterval(snapshotTimer);
358
- snapshotTimer = null;
359
- }
360
- }
361
- }
362
-
363
- debugBtn.addEventListener("click", () => {
364
- setVideoEnabled(!videoEnabled);
365
- });
366
-
367
- setVideoEnabled(false);
368
-
369
- videoStream.addEventListener("load", updateAspectFromStream);
370
-
371
- function setCard(card, statusEl, active, text, alert = false) {
372
- card.classList.toggle("active", active);
373
- card.classList.toggle("alert", alert);
374
- statusEl.textContent = text;
375
- }
376
-
377
- function renderCards() {
378
- setCard(
379
- cardPhoneDetected,
380
- statusPhoneDetected,
381
- phoneDetected === true,
382
- phoneDetected === null ? "Unknown" : phoneDetected ? "Yes" : "No",
383
- phoneDetected === false
384
- );
385
- setCard(
386
- cardPhoneUse,
387
- statusPhoneUse,
388
- phoneUse,
389
- phoneUse ? "Detected" : "No",
390
- phoneUse
391
- );
392
- let reachyLabel = "Idle";
393
- let reachySub = "Waiting for signals";
394
- let reachyActive = false;
395
- if (currentState === "tracking_phone") {
396
- reachyLabel = "Tracking Phone";
397
- reachySub = "Following the phone";
398
- reachyActive = true;
399
- } else if (currentState === "tracking_person") {
400
- if (phoneDetected === false) {
401
- reachyLabel = "Tracking Person & Searching Phone";
402
- reachySub = "Scanning for you and the phone";
403
- } else {
404
- reachyLabel = "Tracking Person";
405
- reachySub = "Looking for you";
406
- }
407
- reachyActive = true;
408
- } else if (currentState === "searching_phone" || currentState === "looking_down") {
409
- reachyLabel = "Searching Phone";
410
- reachySub = "Scanning for the phone";
411
- reachyActive = true;
412
- } else if (phoneDetected === false) {
413
- reachyLabel = "Searching Phone";
414
- reachySub = "Scanning for the phone";
415
- reachyActive = true;
416
- }
417
- setCard(cardReachyStatus, statusReachy, reachyActive, reachyLabel);
418
- subReachy.textContent = reachySub;
419
- const phoneHomeActive = phoneHome;
420
- setCard(
421
- cardPhoneHome,
422
- statusPhoneHome,
423
- phoneHomeActive,
424
- phoneHomeActive ? "Home" : "Waiting"
425
- );
426
- }
427
-
428
- function handleLine(text) {
429
- if (text.includes("[state]")) {
430
- const state = text.split("[state]")[1].trim();
431
- if (state === "phone use detected") {
432
- phoneUse = true;
433
- } else if (state === "phone use stopped") {
434
- phoneUse = false;
435
- } else if (state === "phone home") {
436
- phoneHome = true;
437
- } else if (state === "phone home cleared") {
438
- phoneHome = false;
439
- } else {
440
- currentState = state;
441
- if (state === "tracking_phone") {
442
- phoneDetected = true;
443
- } else if (
444
- state === "searching_phone" ||
445
- state === "tracking_person" ||
446
- state === "looking_down"
447
- ) {
448
- phoneDetected = false;
449
- }
450
- }
451
- }
452
- if (text.includes("[heartbeat] phone_detected=")) {
453
- phoneDetected = text.includes("phone_detected=yes");
454
- }
455
- renderCards();
456
- }
457
-
458
- async function poll() {
459
- if (!logsEnabled) {
460
- statusEl.textContent = "Logs disabled";
461
- }
462
- try {
463
- const res = await fetch(`/logs?since=${lastId}`);
464
- const data = await res.json();
465
- data.lines.forEach((line) => {
466
- lastId = Math.max(lastId, line.id);
467
- handleLine(line.text);
468
- });
469
- statusEl.textContent = "Live";
470
- } catch (err) {
471
- statusEl.textContent = "Disconnected";
472
- handleLine("[warn] log stream disconnected");
473
- }
474
- setTimeout(poll, 1000);
475
- }
476
-
477
- poll();
478
- </script>
479
- </body>
480
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
web_log_ui.html CHANGED
@@ -161,6 +161,12 @@
161
  flex-direction: column;
162
  align-items: center;
163
  }
 
 
 
 
 
 
164
  .settings-card {
165
  border: 1px solid #232836;
166
  background: #0b0e13;
@@ -313,6 +319,7 @@
313
  <div class="status" id="status">Connecting...</div>
314
  </header>
315
  <div class="container">
 
316
  <div class="tabs">
317
  <button class="tab-btn active" id="tabStatus">Status</button>
318
  <button class="tab-btn" id="tabSettings">Settings</button>
 
161
  flex-direction: column;
162
  align-items: center;
163
  }
164
+ .hero-img {
165
+ width: min(720px, 100%);
166
+ border-radius: 12px;
167
+ border: 1px solid #232836;
168
+ margin: 12px 20px 0;
169
+ }
170
  .settings-card {
171
  border: 1px solid #232836;
172
  background: #0b0e13;
 
319
  <div class="status" id="status">Connecting...</div>
320
  </header>
321
  <div class="container">
322
+ <img class="hero-img" src="/static/reachy_phone_home.PNG" alt="Reachy Phone Home" />
323
  <div class="tabs">
324
  <button class="tab-btn active" id="tabStatus">Status</button>
325
  <button class="tab-btn" id="tabSettings">Settings</button>