Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

Mobile shell: video pinned on top, one status strip, bottom tabs, a snap-point drive sheet - and exactly ONE stop button #62

Parked opened this in answer to
Closed without merging

quill/arm:quill/49-mobile-shell-video-pinned-on-top-one-sta → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +540 −129
Software/README.md +38 −17
@@ -386,27 +386,37 @@ appended to `admin.log.jsonl` next to it, with who did it. `/admin` shows
386386 the latest entries. Changes are accepted only from the owner, and only from
387387 the app's own page.
388388
389 **On a phone.** The page is laid out for one thumb, phone first. The view
390 (camera or 3D) sits on top at full width. Under it a status strip shows who
391 drives, your place in the line, the time left, the turn's one button, and
392 the red **Stop**. Stop is there whenever you drive, and for the owner. Below
393 that is a sheet with tabs at the bottom edge: **Chat**, **Queue**,
394 **Controls** (only on your turn, and it opens by itself when your turn
395 starts) and **Admin** (the owner: the room, the safe zone, the trims,
396 metrics and 3D calibration).
389 **On a phone.** The page is laid out for one thumb, phone first. The video
390 (camera or 3D) is pinned on top at full width, its 16:9 box reserved before
391 a frame arrives, so nothing shifts. Under it one status strip shows who
392 drives and the time left, your place in the line, Live or Reconnecting, the
393 turn's one button, and the red **Stop**. A tab bar sits under the thumb:
394 **Drive**, **Queue**, **Chat** and **Admin** (the owner: the room, the safe
395 zone, the trims, metrics and 3D calibration). Drive opens by itself when
396 your turn starts.
397397
398 - Controls: a joystick moves the gripper. Up reaches out, sideways swings
398 - Stop: there is exactly one, in every layout and every tab. It is at
399 least 56 px, and it fires the moment a finger touches it, not when the
400 finger lifts. Stopped, a full-width banner says so, and the button turns
401 into **Resume** for the owner. Resuming takes a second, confirming tap
402 within 4 s. Esc is the same emergency stop; Space ends whatever the arm
403 is doing without the hold.
404 - Drive: a joystick moves the gripper. Up reaches out, sideways swings
399405 around the base, and ▲/▼ raise and lower it. The page solves that onto
400406 pan, lift and elbow against the URDF (`src/ui/reach.js`), and the server
401 checks every frame against the zone as usual. Below the joystick come the
402 joint sliders with hold-to-jog −/+, the poses, and the rest.
407 checks every frame against the zone as usual. Over it, a sheet rests at
408 one of two snap points (`src/ui/sheet.js`). At peek (96 px) it shows the
409 arm's state and the gripper. Open (45 % of the screen) it adds the joint
410 sliders with hold-to-jog −/+, the poses and the rest. Drag the handle,
411 flick it, or tap it.
403412 - Chat: the page follows the visual viewport. The keyboard shrinks the
404 sheet and the view, and never covers the box or the last message.
405 Long-press a message (or right-click it) to delete it, or mute or ban its
406 author.
407 - Phone on its side: the view fills the screen, the strip and the sheet
408 float over it, and **Hide** clears them away. A wide screen puts the
409 sheet in a column beside the view.
413 view, and never covers the box or the last message. Long-press a
414 message (or right-click it) to delete it, or mute or ban its author.
415 - Phone on its side: the video fills the screen. The strip floats
416 top-left, Stop sits top-right, and the drive controls sit in the lower
417 corners. Queue, Chat and Admin open as a drawer, and tapping their tab
418 again puts it away. A wide screen puts the tabs in a column beside the
419 video.
410420 - Every tap target is at least 44 px. The safe-area insets are respected,
411421 the page follows the system's light or dark mode, and nothing moves for
412422 people who ask for reduced motion. The bottom-right corner belongs to the
@@ -419,6 +429,17 @@ metrics and 3D calibration).
419429 from the MJPEG stream to one snapshot at a time, 0.5 to 4 a second
420430 (`src/ui/camera-plan.js`), and goes back once the link recovers.
421431
432 `src/mobile-shell.test.ts` checks all of this in a real browser. It runs on
433 an iPhone (390×844) and an Android phone (412×915), upright and on their
434 side, in light and dark mode. It checks for exactly one visible
435 `[data-stop]` of at least 56 px, that nothing sits under the forge pill,
436 that the sheet snaps, and that Stop fires on the touch and Resume needs two
437 taps. It drives a system Chromium (`CHROMIUM`, or `/usr/bin/chromium`)
438 through `playwright-core`. That is a dev dependency only, without the
439 browser downloads. Where no Chromium can start, the suite is skipped, by
440 name. `SO101_SHOTS=<dir> bun test src/mobile-shell.test.ts` saves a
441 screenshot of every state.
442
422443 The queue, the countdown and the chat all come over one WebSocket (`/live`):
423444 no polling. People who joined are kept in
424445 `$FORGE_APP_DATA/so101/accounts.sqlite` (`src/accounts.ts`, bun's built-in
Software/so101/bun.lock +3
@@ -13,6 +13,7 @@
1313 "devDependencies": {
1414 "@types/bun": "^1.4.2",
1515 "@types/ws": "^8.18.2",
16 "playwright-core": "^1.64.1",
1617 "typescript": "^7.0.2",
1718 },
1819 },
@@ -102,6 +103,8 @@
102103
103104 "node-gyp-build": ["[email protected]", "", { "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", "node-gyp-build-test": "build-test.js" } }, "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ=="],
104105
106 "playwright-core": ["[email protected]", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ=="],
107
105108 "serialport": ["[email protected]", "", { "dependencies": { "@serialport/binding-mock": "10.2.2", "@serialport/bindings-cpp": "13.0.0", "@serialport/parser-byte-length": "13.0.0", "@serialport/parser-cctalk": "13.0.0", "@serialport/parser-delimiter": "13.0.0", "@serialport/parser-inter-byte-timeout": "13.0.0", "@serialport/parser-packet-length": "13.0.0", "@serialport/parser-readline": "13.0.0", "@serialport/parser-ready": "13.0.0", "@serialport/parser-regex": "13.0.0", "@serialport/parser-slip-encoder": "13.0.0", "@serialport/parser-spacepacket": "13.0.0", "@serialport/stream": "13.0.0", "debug": "4.4.0" } }, "sha512-PHpnTd8isMGPfFTZNCzOZp9m4mAJSNWle9Jxu6BPTcWq7YXl5qN7tp8Sgn0h+WIGcD6JFz5QDgixC2s4VW7vzg=="],
106109
107110 "three": ["[email protected]", "", {}, "sha512-blFeqb49wRCSGUGj7gtpfnSGHy2lwDk94RhUmS1c/hTby70kvChbWpkJ4Pm1390LqzzvTmzgXKHPEafJwCb8jA=="],
Software/so101/package.json +1
@@ -20,6 +20,7 @@
2020 "devDependencies": {
2121 "@types/bun": "^1.4.2",
2222 "@types/ws": "^8.18.2",
23 "playwright-core": "^1.64.1",
2324 "typescript": "^7.0.2"
2425 }
2526 }
Software/so101/src/mobile-shell.test.ts added +170
@@ -0,0 +1,170 @@
1 /**
2 * The viewer on phones, in a real browser: an iPhone (390×844) and an Android phone (412×915), upright and on their
3 * side, light and dark. Exactly one STOP, big and on screen; nothing under the forge pill; the Drive sheet snaps.
4 * Runs where a Chromium can start (CHROMIUM names one, else /usr/bin/chromium); skipped, by name, where none can.
5 * SO101_SHOTS=<dir> also saves a screenshot of every state there.
6 */
7 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
8 import { existsSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
9 import { tmpdir } from "node:os";
10 import { join } from "node:path";
11 import { chromium, type Browser, type Page } from "playwright-core";
12
13 // The callbacks below run in the page; this file is typed without the DOM library.
14 declare const document: any, getComputedStyle: any;
15
16 const executablePath = [process.env.CHROMIUM, "/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome"].find((p) => p && existsSync(p));
17 const browser: Browser | null = executablePath
18 ? await chromium.launch({ executablePath, args: ["--no-sandbox", "--disable-gpu"] }).catch(() => null)
19 : null;
20 const shots = process.env.SO101_SHOTS;
21 if (shots) mkdirSync(shots, { recursive: true });
22
23 const PILL = { w: 68, h: 56 }; // the forge's pill owns this much of the bottom-right corner
24 const PHONES = [["iphone", 390, 844], ["android", 412, 915]] as const;
25
26 let child: ReturnType<typeof Bun.spawn> | undefined;
27 let dir = "";
28 let base = "";
29
30 beforeAll(async () => {
31 if (!browser) return;
32 dir = mkdtempSync(join(tmpdir(), "so101-shell-"));
33 const script = new URL("../bench/fake-serve.ts", import.meta.url).pathname;
34 child = Bun.spawn(["bun", "run", script], { env: { ...process.env, PORT: "0", HOST: "127.0.0.1", FORGE_APP_DATA: dir, FORGE_APP_ENV: "", FORGE_APP_IDENTITY_KEY: "" }, stdout: "pipe", stderr: "inherit" });
35 const reader = (child.stdout as ReadableStream<Uint8Array>).getReader();
36 let text = "";
37 while (!text.includes("\n")) {
38 const { value, done } = await reader.read();
39 if (done) throw new Error(`fake-serve exited: ${text}`);
40 text += new TextDecoder().decode(value);
41 }
42 base = /http:\/\/[^\s]+/.exec(text)![0];
43 }, 20_000);
44
45 afterAll(async () => {
46 await browser?.close();
47 child?.kill();
48 if (dir) rmSync(dir, { recursive: true, force: true });
49 });
50
51 /** The page at this size and scheme, once the room and the arm both answer: on this machine every visitor drives. */
52 async function open(width: number, height: number, scheme: "light" | "dark"): Promise<Page> {
53 const page = await browser!.newPage({ viewport: { width, height }, isMobile: true, hasTouch: true, colorScheme: scheme });
54 await page.goto(base);
55 await page.waitForFunction(() => document.getElementById("conn")?.textContent === "Live" && !document.getElementById("t-drive")?.hidden, undefined, { timeout: 15_000 });
56 await page.waitForTimeout(300); // the sheet and the tab settle
57 return page;
58 }
59 const shot = (page: Page, name: string) => (shots ? page.screenshot({ path: join(shots, `${name}.png`) }) : undefined);
60 /** Ask until the answer is what was wanted, or give up after `ms`. */
61 async function until<T>(ask: () => Promise<T>, ok: (v: T) => boolean, ms = 5000): Promise<T> {
62 const end = Date.now() + ms;
63 for (;;) {
64 const v = await ask();
65 if (ok(v) || Date.now() > end) return v;
66 await Bun.sleep(100);
67 }
68 }
69 const estop = async () => ((await (await fetch(`${base}/status`)).json()) as { estop: unknown }).estop;
70 const overlaps = (a: { x: number; y: number; width: number; height: number }, b: { x: number; y: number; width: number; height: number }) =>
71 a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
72
73 describe.skipIf(!browser)(`the phone shell${browser ? "" : " (skipped: no Chromium could start here)"}`, () => {
74 for (const [phone, w, h] of PHONES) {
75 for (const [orientation, width, height] of [["portrait", w, h], ["landscape", h, w]] as const) {
76 for (const scheme of ["light", "dark"] as const) {
77 test(`${phone} ${orientation} ${scheme}: one STOP, at least 56 px, on screen; nothing under the pill; nothing spills sideways`, async () => {
78 const page = await open(width, height, scheme);
79 await shot(page, `${phone}-${orientation}-${scheme}-drive`);
80 expect(await page.locator("[data-stop]").count()).toBe(1);
81 const stop = page.locator("[data-stop]");
82 expect(await stop.isVisible()).toBe(true);
83 const box = (await stop.boundingBox())!;
84 expect(box.height).toBeGreaterThanOrEqual(56);
85 expect(box.width).toBeGreaterThanOrEqual(56);
86 expect(box.x).toBeGreaterThanOrEqual(0); expect(box.y).toBeGreaterThanOrEqual(0);
87 expect(box.x + box.width).toBeLessThanOrEqual(width); expect(box.y + box.height).toBeLessThanOrEqual(height);
88 if (orientation === "landscape") {
89 expect(box.y).toBeLessThan(80); // top right
90 expect(box.x + box.width).toBeGreaterThan(width - 80);
91 }
92 const pill = { x: width - PILL.w, y: height - PILL.h, width: PILL.w, height: PILL.h };
93 for (const tab of ["drive", "queue", "chat"]) {
94 if (tab !== "drive") { await page.click(`#t-${tab}`); await page.waitForTimeout(250); await shot(page, `${phone}-${orientation}-${scheme}-${tab}`); }
95 const covered = await page.$$eval("button, input, select, a[href], [role=application]", (els, p) => els.filter((e) => {
96 const r = e.getBoundingClientRect(), s = getComputedStyle(e);
97 if (!r.width || !r.height || s.visibility === "hidden") return false;
98 // what is really on screen at its middle: a sheet resting over it hides it, and that is no fault of the pill
99 const top = document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2);
100 if (!top || !(e === top || e.contains(top))) return false;
101 return r.x < p.x + p.width && p.x < r.x + r.width && r.y < p.y + p.height && p.y < r.y + r.height;
102 }).map((e) => e.id || e.textContent), pill);
103 expect(covered).toEqual([]);
104 expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(width);
105 for (const t of await page.locator("#tabs [role=tab]:visible").all()) expect((await t.boundingBox())!.height).toBeGreaterThanOrEqual(44);
106 expect(await page.locator("[data-stop]:visible").count()).toBe(1);
107 }
108 expect(overlaps(box, pill)).toBe(false);
109 await page.close();
110 }, 40_000);
111 }
112 }
113 }
114
115 test("the Drive sheet rests at peek, drags open, and a tap puts it back", async () => {
116 const page = await open(390, 844, "dark");
117 const sheet = page.locator("#driveSheet");
118 const shown = () => page.evaluate(() => {
119 const s = document.getElementById("driveSheet")!, host = document.getElementById("tab-drive")!;
120 return host.getBoundingClientRect().bottom - s.getBoundingClientRect().top;
121 });
122 expect(await sheet.getAttribute("data-snap")).toBe("peek");
123 expect(Math.abs((await shown()) - 96)).toBeLessThanOrEqual(2);
124 expect(await page.locator("[data-grip]:visible").count()).toBe(2); // the gripper is in the peek
125
126 const grab = (await page.locator("#grab").boundingBox())!;
127 const x = grab.x + grab.width / 2, y = grab.y + grab.height / 2;
128 await page.mouse.move(x, y); await page.mouse.down();
129 for (let i = 1; i <= 10; i++) await page.mouse.move(x, y - i * 25, { steps: 2 });
130 await page.mouse.up();
131 await page.waitForTimeout(400);
132 expect(await sheet.getAttribute("data-snap")).toBe("open");
133 const opened = await shown();
134 expect(opened).toBeGreaterThan(300); // about 45 % of the screen
135 expect(opened).toBeLessThanOrEqual(0.46 * 844);
136 await shot(page, "iphone-portrait-dark-drive-open");
137
138 await page.click("#grab");
139 await page.waitForTimeout(400);
140 expect(await sheet.getAttribute("data-snap")).toBe("peek");
141 expect(Math.abs((await shown()) - 96)).toBeLessThanOrEqual(2);
142 await page.close();
143 }, 40_000);
144
145 test("STOP fires on the touch, the banner spans the screen, and resuming takes a second tap", async () => {
146 for (const [width, height, name] of [[390, 844, "portrait"], [844, 390, "landscape"]] as const) {
147 const page = await open(width, height, "dark");
148 const stop = (await page.locator("[data-stop]").boundingBox())!;
149 await page.mouse.move(stop.x + stop.width / 2, stop.y + stop.height / 2);
150 await page.mouse.down(); // no lift yet: the press alone stops the arm
151 expect(await until(estop, (v) => v !== null)).not.toBeNull();
152 await page.mouse.up();
153 await page.waitForFunction(() => document.getElementById("banner")?.classList.contains("stop"));
154 const banner = (await page.locator("#banner").boundingBox())!, view = (await page.locator("#app").boundingBox())!;
155 expect(Math.abs(banner.width - view.width)).toBeLessThanOrEqual(1);
156 expect(await page.locator("[data-stop]").textContent()).toBe("Resume");
157 await shot(page, `stopped-${name}`);
158
159 await page.locator("[data-stop]").click();
160 expect(await page.locator("[data-stop]").textContent()).toBe("Tap again to resume");
161 await page.waitForTimeout(300);
162 expect(await estop()).not.toBeNull(); // one tap does not resume
163 await page.locator("[data-stop]").click();
164 expect(await until(estop, (v) => v === null)).toBeNull();
165 await page.waitForFunction(() => document.querySelector("[data-stop]")?.textContent === "Stop");
166 expect(await page.locator("[data-stop]").count()).toBe(1);
167 await page.close();
168 }
169 }, 60_000);
170 });
Software/so101/src/server.test.ts +14 −1
@@ -127,13 +127,26 @@ describe("viewer page", () => {
127127
128128 test("is laid out for a phone: tabs under the thumb, an E-stop beside the status, room for the forge pill", async () => {
129129 const page = await (await fetch(`${base}/`)).text();
130 for (const tab of ["chat", "queue", "controls", "admin"]) expect(page).toContain(`data-tab="${tab}"`);
130 for (const tab of ["drive", "queue", "chat", "admin"]) expect(page).toContain(`data-tab="${tab}"`);
131131 expect(page).toContain('class="estop"');
132 expect(page).toMatch(/#app \{[^}]*aspect-ratio: 16 \/ 9/); // the video's box is reserved before a frame arrives
133 expect(page).toMatch(/#driveSheet\[data-snap=open\]/);
132134 expect(page).toContain("interactive-widget=resizes-content");
133135 expect(page).toContain("prefers-color-scheme: light");
134136 expect(page).toContain("prefers-reduced-motion: reduce");
135137 expect(page).toMatch(/#tabs \{[^}]*var\(--pill\)/);
136138 });
139
140 test("has exactly one STOP, which fires on the touch and resumes only on a second tap", async () => {
141 const page = await (await fetch(`${base}/`)).text();
142 const markup = page.slice(page.indexOf("<body>"), page.indexOf("<script type=\"module\">"));
143 expect(markup.match(/data-stop/g)).toHaveLength(1);
144 expect(markup.match(/>Stop</g)).toHaveLength(1);
145 expect(page).toMatch(/--stop: 56px/);
146 expect(page).toMatch(/\$\("estop"\)\.addEventListener\("pointerdown"/);
147 expect(page).not.toMatch(/confirm\("Clear the emergency stop/); // the second tap is the confirmation
148 expect(page).toContain("Tap again to resume");
149 });
137150 });
138151
139152 describe("moves over HTTP", () => {
Software/so101/src/ui/sheet.js added +38
@@ -0,0 +1,38 @@
1 /**
2 * The Drive sheet's snap points, Apple Maps and vaul style: a sheet with two resting heights, peek and open, that a
3 * finger drags between. Plain ESM, served to the page at /ui/ and imported by the tests. The page measures; this decides.
4 */
5
6 /** A flick faster than this, in px/ms, goes the way it was flung whatever the distance. */
7 export const FLICK = 0.5;
8
9 /**
10 * Where a released sheet comes to rest.
11 * `shown` is how many px of the sheet were visible when the finger let go, `velocity` its last speed in px/ms
12 * (positive pulls the sheet up, showing more), `peek` and `open` the visible heights of the two snap points.
13 * A flick wins; otherwise the nearer snap point does. Broken numbers rest at peek: STOP and the gripper stay in sight.
14 * @param {{ shown: number, velocity: number, peek: number, open: number }} drag
15 * @returns {"peek" | "open"}
16 */
17 export function settle({ shown, velocity, peek, open }) {
18 if (![shown, peek, open].every(Number.isFinite) || open <= peek) return "peek";
19 if (Number.isFinite(velocity) && Math.abs(velocity) >= FLICK) return velocity > 0 ? "open" : "peek";
20 return shown - peek > (open - peek) / 2 ? "open" : "peek";
21 }
22
23 /**
24 * How many px of the sheet show while a finger drags it: where it started plus how far the finger went up, held
25 * between the snap points with a little give past either end, so the sheet never leaves its rails.
26 * @param {number} start visible px when the drag began
27 * @param {number} dy the finger's travel in px, positive downwards (screen coordinates)
28 * @param {number} peek
29 * @param {number} open
30 * @returns {number}
31 */
32 export function dragTo(start, dy, peek, open) {
33 const want = start - dy;
34 const give = 24;
35 if (want < peek) return peek - Math.min(give, (peek - want) / 3);
36 if (want > open) return open + Math.min(give, (want - open) / 3);
37 return want;
38 }
Software/so101/src/ui/sheet.test.ts added +36
@@ -0,0 +1,36 @@
1 import { describe, expect, test } from "bun:test";
2 import { FLICK, dragTo, settle } from "./sheet.js";
3
4 const peek = 96, open = 380;
5
6 describe("where a released sheet rests", () => {
7 test("the nearer snap point, when the finger lets go slowly", () => {
8 expect(settle({ shown: 150, velocity: 0, peek, open })).toBe("peek");
9 expect(settle({ shown: 300, velocity: 0, peek, open })).toBe("open");
10 expect(settle({ shown: (peek + open) / 2, velocity: 0, peek, open })).toBe("peek");
11 });
12
13 test("a flick goes the way it was flung, however short", () => {
14 expect(settle({ shown: 110, velocity: FLICK, peek, open })).toBe("open");
15 expect(settle({ shown: 360, velocity: -FLICK, peek, open })).toBe("peek");
16 });
17
18 test("broken numbers rest at peek, where STOP and the gripper are", () => {
19 expect(settle({ shown: Number.NaN, velocity: 0, peek, open })).toBe("peek");
20 expect(settle({ shown: 300, velocity: Number.NaN, peek, open })).toBe("open");
21 expect(settle({ shown: 300, velocity: 0, peek: 200, open: 100 })).toBe("peek");
22 });
23 });
24
25 describe("a dragged sheet", () => {
26 test("follows the finger between the snap points", () => {
27 expect(dragTo(peek, -100, peek, open)).toBe(196);
28 expect(dragTo(open, 50, peek, open)).toBe(330);
29 });
30
31 test("gives a little past either end and no more", () => {
32 expect(dragTo(peek, 30, peek, open)).toBe(peek - 10);
33 expect(dragTo(peek, 900, peek, open)).toBe(peek - 24);
34 expect(dragTo(open, -900, peek, open)).toBe(open + 24);
35 });
36 });
Software/so101/src/viewer.html +240 −111
@@ -18,17 +18,20 @@
1818 } }
1919 </script>
2020 <link rel="modulepreload" href="/ui/__VERSION__/camera-plan.js">
21 <link rel="modulepreload" href="/ui/__VERSION__/sheet.js">
2122 <link rel="modulepreload" href="/leader-map.js">
2223 <style>
23 /* Phone portrait first: the view on top, a status strip with the E-stop under it, a sheet of tabs below that.
24 Landscape on a phone: the view fills the screen and the strip and the sheet float over it.
25 A wider screen: the sheet becomes a column beside the view. The forge pill owns the bottom-right corner. */
24 /* Phone portrait first: the video pinned on top at 16:9, one status strip with the one STOP under it, the open tab,
25 and the tab bar under the thumb. The Drive tab is the joystick with a sheet over it that snaps between peek and open.
26 Landscape on a phone: the video fills the screen; the strip floats top-left, STOP top-right, the drive controls in the
27 lower corners, the other tabs in a drawer. A wider screen: the tabs become a column beside the view.
28 The forge pill owns the bottom-right corner. */
2629 :root {
2730 color-scheme: dark; --bg: #0b0d10; --surface: #0d1117; --raised: #161b22; --fg: #e8eaed; --fg2: #c9d1d9; --dim: #9aa4ae;
2831 --line: #30363d; --btn: #21262d; --btn-hover: #30363d; --link: #58a6ff; --blue: #388bfd; --on-blue: #fff;
2932 --ok: #3fb950; --warn: #d29922; --bad: #f85149; --bad-soft: rgba(248,81,73,.18); --blue-soft: rgba(56,139,253,.18);
30 --tap: 44px; --pill: 68px; --view: min(42svh, 75vw);
31 --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
33 --tap: 44px; --pill: 68px; --stop: 56px; --peek: 96px; --drawer: min(380px, 48vw);
34 --safe-t: env(safe-area-inset-top, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
3235 }
3336 @media (prefers-color-scheme: light) {
3437 :root { color-scheme: light; --bg: #f6f8fa; --surface: #fff; --raised: #fff; --fg: #1f2328; --fg2: #31363c; --dim: #59636e;
@@ -52,16 +55,16 @@
5255 [hidden] { display: none !important; }
5356 [inert] { opacity: .5; }
5457
55 #shell { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); display: grid; grid-template-columns: 100%; grid-template-rows: minmax(0, var(--view)) auto minmax(0, 1fr); grid-template-areas: "view" "strip" "sheet"; }
56 #shell.typing { --view: 24%; }
58 #shell { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); display: grid; grid-template-columns: 100%; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "view" "strip" "sheet"; }
5759
58 /* the view: cameras and the 3D model, always on black */
59 #app { grid-area: view; position: relative; min-height: 0; background: #000; color: #e8eaed; overflow: hidden; }
60 /* the view: cameras and the 3D model, always on black, its 16:9 box reserved before anything loads */
61 #app { grid-area: view; position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 42svh; min-height: 0; background: #000; color: #e8eaed; overflow: hidden; }
62 #shell.typing #app { max-height: 18svh; }
6063 #stage { position: absolute; inset: 0; display: flex; gap: 2px; }
61 /* the emergency stop's held state, and the banner that says who pressed it */
64 /* the emergency stop's held state, and the full-width banner that says who pressed it */
6265 .estop:disabled { opacity: .5; cursor: not-allowed; } .estop.on { background: #7d1410; box-shadow: 0 0 0 3px var(--bad); }
63 #banner.stop { display: block; border: 2px solid var(--bad); background: rgba(80,10,8,.92); color: #fff; font-weight: 600; }
64 #banner button { margin-left: 10px; min-height: 32px; padding: 2px 10px; }
66 .estop.armed { background: #9a6700; box-shadow: 0 0 0 3px var(--warn); }
67 #banner.stop { display: block; left: 0; right: 0; top: 0; transform: none; width: auto; max-width: none; border-radius: 0; border: 0; border-bottom: 2px solid var(--bad); background: rgba(80,10,8,.94); color: #fff; font-weight: 600; text-align: center; padding: 10px calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l)); }
6568 .pane { flex: 1; min-width: 0; position: relative; background: #000; display: none; }
6669 .pane.on { display: block; }
6770 .pane img { width: 100%; height: 100%; object-fit: contain; display: block; }
@@ -72,6 +75,7 @@
7275 #top button { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.18); color: #e8eaed; min-height: 36px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
7376 #top .seg { display: inline-flex; flex-wrap: wrap; gap: 2px; } #top .seg button { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #top .seg button.on { background: #388bfd; border-color: #388bfd; color: #fff; }
7477 #top .info { display: inline-flex; gap: 6px; align-items: center; background: rgba(0,0,0,.6); padding: 0 10px; min-height: 36px; border-radius: 8px; max-width: 100%; }
78 #top .info:not(:has(:not(:empty):not([hidden]))) { display: none; }
7579 #link { color: #9aa4ae; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(36ch, 46vw); } #link.on { color: #3fb950; } #link.warn { color: #d29922; }
7680 .dot { width: 8px; height: 8px; border-radius: 50%; background: #f85149; display: inline-block; flex: none; } .dot.on { background: #3fb950; }
7781 #banner { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: min(640px, calc(100% - 16px)); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(0,0,0,.8); border: 1px solid #30363d; display: none; }
@@ -79,17 +83,20 @@
7983 #msg { position: absolute; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: 8px; z-index: 6; margin: 0 auto; width: max-content; max-width: calc(100% - 16px); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(13,17,23,.9); color: #e8eaed; border: 1px solid #30363d; }
8084 #msg:empty { display: none; } #msg.bad { border-color: #f85149; color: #ffb3ad; }
8185
82 /* the status strip: who drives, your place, time left, the turn's action and the E-stop */
83 #strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 8px calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 64px; }
86 /* the status strip: who drives and how long is left, your place, live or reconnecting, the turn's action, and STOP */
87 #strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 6px calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: calc(var(--stop) + 12px); }
8488 #strip .who { flex: 1; min-width: 0; }
89 #strip .l1, #strip .l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
8590 #driverLine { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #driverLine.none { color: var(--dim); font-weight: 500; }
86 #clock { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #clock.idle { color: var(--warn); }
87 #capLine { color: var(--dim); font-size: 12px; } #capLine:empty { display: none; }
8891 #driverLine.paused { color: var(--warn); }
92 #conn { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); } #conn.warn { color: var(--warn); } #conn.bad { color: var(--bad); }
93 #clock { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #clock.idle { color: var(--warn); }
94 #capLine { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #capLine:empty { display: none; }
8995 #turnActions { display: flex; gap: 6px; } #turnActions:empty { display: none; }
90 .estop { flex: none; min-width: 72px; min-height: 52px; border: 0; border-radius: 12px; background: #d1242f; color: #fff; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 0 0 3px rgba(209,36,47,.25), 0 2px 8px rgba(0,0,0,.35); }
96 #turnActions button { padding: 0 12px; }
97 .estop { flex: none; min-width: 76px; min-height: var(--stop); padding: 0 12px; border: 0; border-radius: 14px; background: #d1242f; color: #fff; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 0 0 3px rgba(209,36,47,.25), 0 2px 8px rgba(0,0,0,.35); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
9198 .estop:hover { background: #e5323d; } .estop:active { transform: scale(.97); }
92 #sheetToggle { flex: none; }
99 .estop.on, .estop.armed { letter-spacing: .02em; font-size: 13px; max-width: 128px; line-height: 1.2; }
93100
94101 /* the sheet: one panel at a time, the tabs under the thumb */
95102 #sheet { grid-area: sheet; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
@@ -97,7 +104,7 @@
97104 .tab h2 { margin: 4px 0 0; font-size: 13px; font-weight: 650; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
98105 .tab p.note { margin: 0; color: var(--dim); font-size: 13px; }
99106 #tabs { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--raised); padding: 0 calc(var(--pill) + var(--safe-r)) var(--safe-b) var(--safe-l); }
100 #tabs button { flex: 1; min-width: 0; min-height: 56px; border: 0; border-radius: 0; background: none; color: var(--dim); font-size: 14px; font-weight: 600; position: relative; padding: 0 4px; }
107 #tabs button { flex: 1; min-width: 0; min-height: 56px; border: 0; border-radius: 0; background: none; color: var(--dim); font-size: 14px; font-weight: 600; position: relative; padding: 0 4px; touch-action: manipulation; }
101108 #tabs button[aria-selected=true] { color: var(--fg); }
102109 #tabs button[aria-selected=true]::before { content: ""; position: absolute; left: 25%; right: 25%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
103110 #tabs .badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--blue); color: var(--on-blue); font-size: 11px; line-height: 18px; }
@@ -127,15 +134,28 @@
127134 #joinErr { margin: 0; color: var(--bad); font-size: 13px; } #joinErr:empty { display: none; }
128135 #forgeSignin { color: var(--link); font-size: 13px; align-self: flex-start; }
129136
130 /* controls */
131 #reach { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
132 #pad { position: relative; width: min(46vw, 180px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--btn) 0 58%, var(--raised) 59%); border: 1px solid var(--line); touch-action: none; -webkit-user-select: none; user-select: none; }
137 /* the Drive tab: the joystick fills the room above a sheet that rests at peek (state and gripper) or open (every joint) */
138 #tab-drive { position: relative; padding: 0; gap: 0; overflow: hidden; }
139 #turnCard { margin: 12px calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); display: grid; gap: 10px; }
140 #turnCard p { margin: 0; color: var(--fg2); font-size: 14px; }
141 #reach { flex: 1; min-height: 0; display: flex; gap: 16px; align-items: center; justify-content: center; padding: 12px calc(12px + var(--safe-r)) calc(var(--peek) + 12px) calc(12px + var(--safe-l)); }
142 #driveSheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: min(45dvh, 100%); display: flex; flex-direction: column; background: var(--raised); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -6px 18px rgba(0,0,0,.28); transform: translateY(calc(100% - var(--peek))); transition: transform .22s cubic-bezier(.32,.72,0,1); will-change: transform; }
143 #driveSheet[data-snap=open] { transform: none; }
144 #driveSheet.dragging { transition: none; }
145 #grab { position: relative; flex: none; width: 100%; min-height: 28px; height: 28px; padding: 0; border: 0; border-radius: 16px 16px 0 0; background: none; display: grid; place-items: center; touch-action: none; cursor: grab; }
146 #grab .handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
147 #grab::after { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 44px; } /* a 44 px target around a slim handle */
148 #driveSheet .peek { flex: none; height: calc(var(--peek) - 28px); display: flex; align-items: center; gap: 10px; padding: 0 calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); }
149 #state { flex: 1; min-width: 0; color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
150 .grip { display: flex; gap: 8px; } .grip button { min-width: 72px; touch-action: none; -webkit-user-select: none; user-select: none; }
151 #driveMore { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px calc(12px + var(--safe-r)) 16px calc(12px + var(--safe-l)); display: flex; flex-direction: column; gap: 12px; }
152 #driveMore .hint { margin: 0; color: var(--dim); font-size: 12px; }
153 #pad { position: relative; flex: none; width: min(52vw, 200px, 30svh); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--btn) 0 58%, var(--raised) 59%); border: 1px solid var(--line); touch-action: none; -webkit-user-select: none; user-select: none; }
133154 #pad::before, #pad::after { content: ""; position: absolute; background: var(--line); left: 50%; top: 12%; bottom: 12%; width: 1px; } #pad::after { left: 12%; right: 12%; top: 50%; bottom: auto; width: auto; height: 1px; }
134155 #knob { position: absolute; left: 50%; top: 50%; width: 38%; aspect-ratio: 1; margin: -19% 0 0 -19%; border-radius: 50%; background: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .12s ease-out; pointer-events: none; z-index: 1; }
135156 #pad.held #knob { transition: none; }
136 #reach .side { display: grid; gap: 8px; }
137 #reach .side button { width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; }
138 #reach .hint { grid-column: 1 / -1; margin: 0; color: var(--dim); font-size: 12px; }
157 #reach .side { display: grid; gap: 10px; }
158 #reach .side button { min-width: 96px; min-height: 52px; touch-action: none; -webkit-user-select: none; user-select: none; }
139159 #joints { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 14px; }
140160 .j { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name val" "slide slide"; align-items: center; column-gap: 6px; padding: 4px 6px; border-radius: 10px; }
141161 .j.jam { background: var(--bad-soft); } .j.drag { background: var(--blue-soft); }
@@ -203,29 +223,55 @@
203223
204224 /* A wide screen: the sheet is a column beside the view. */
205225 @media (orientation: landscape) and (min-width: 900px) and (min-height: 501px) {
206 #shell { --view: 1fr; grid-template-columns: minmax(0, 1fr) min(400px, 36vw); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "view sheet" "strip sheet"; }
207 #shell.typing { --view: 1fr; }
226 #shell { grid-template-columns: minmax(0, 1fr) min(400px, 36vw); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "view sheet" "strip sheet"; }
227 #app, #shell.typing #app { aspect-ratio: auto; max-height: none; height: 100%; }
208228 #sheet { border-left: 1px solid var(--line); }
209229 #strip { border-bottom: 0; border-top: 1px solid var(--line); }
230 /* a column has room for everything at once: no sheet to drag */
231 #tab-drive { overflow: auto; }
232 #reach { flex: none; padding-bottom: 12px; }
233 #driveSheet { position: static; height: auto; transform: none; box-shadow: none; border-radius: 0; transition: none; }
234 #grab { display: none; }
235 #driveSheet .peek { height: auto; padding-top: 4px; }
236 #driveMore { overflow: visible; }
210237 }
211 /* A phone on its side: the view fills the screen, the controls float over it. */
238 /* A phone on its side: the video fills the screen; the strip, STOP, the drive controls and a drawer float over it.
239 Nothing here may set a transform or a filter on #strip or #sheet: STOP and the tab bar are placed against the screen. */
212240 @media (orientation: landscape) and (max-height: 500px) {
213 #shell, #shell.typing { grid-template-columns: 100%; grid-template-rows: 100%; grid-template-areas: "view"; }
214 #app, #strip, #sheet { grid-area: auto; }
215 #strip { position: absolute; z-index: 7; top: 6px; left: calc(6px + var(--safe-l)); max-width: calc(100% - min(380px, 48vw) - 18px - var(--safe-l) - var(--safe-r)); min-height: 0; padding: 6px 6px 6px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(13,17,23,.82); color: #e8eaed; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
216 #shell.bare #strip { max-width: calc(100% - 12px - var(--safe-l) - var(--safe-r)); }
217 #strip #clock { color: #9aa4ae; }
218 #sheetToggle { display: inline-flex !important; align-items: center; background: rgba(255,255,255,.08); color: #e8eaed; border-color: rgba(255,255,255,.18); }
219 #sheet { position: absolute; z-index: 7; top: 0; bottom: 0; right: 0; width: calc(min(380px, 48vw) + var(--safe-r)); background: rgba(13,17,23,.9); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-left: 1px solid var(--line); transition: transform .2s ease-out; }
220 #shell.bare #sheet { transform: translateX(100%); visibility: hidden; transition: transform .2s ease-out, visibility 0s .2s; }
221 #top { top: auto; bottom: 6px; justify-content: flex-start; right: calc(min(380px, 48vw) + 12px + var(--safe-r)); }
222 #shell.bare #top { right: calc(var(--pill) + var(--safe-r)); }
223 #banner { top: 64px; }
224 #msg { bottom: 52px; }
225 .tab { padding-top: 8px; }
226 #pad { width: min(30vh, 150px); }
241 #shell { grid-template-columns: 100%; grid-template-rows: 100%; grid-template-areas: "view"; }
242 #app, #shell.typing #app { grid-area: view; aspect-ratio: auto; max-height: none; height: 100%; }
243 #strip { grid-area: auto; position: absolute; z-index: 7; top: calc(6px + var(--safe-t)); left: calc(6px + var(--safe-l)); max-width: calc(100% - var(--drawer) - 18px - var(--safe-l) - var(--safe-r)); min-height: 0; padding: 6px 10px 6px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(13,17,23,.86); color: #e8eaed; }
244 #strip #clock, #strip #capLine { color: #9aa4ae; }
245 .estop { position: fixed; z-index: 12; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); }
246 #sheet { display: contents; }
247 #notice { position: absolute; z-index: 7; top: calc(80px + var(--safe-t)); left: calc(6px + var(--safe-l)); max-width: 50%; border-radius: 10px; }
248 /* the tab bar: a floating row at the bottom, centred on the video beside the drawer */
249 #tabs { position: absolute; z-index: 9; bottom: calc(6px + var(--safe-b)); left: 50%; transform: translateX(-50%); padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--raised) 92%, transparent); }
250 #shell.drawer #tabs { left: calc((100% - var(--drawer) - var(--safe-r)) / 2); }
251 #tabs button { flex: none; min-height: var(--tap); padding: 0 14px; font-size: 13px; }
252 #tabs button[aria-selected=true]::before { left: 20%; right: 20%; }
253 /* queue, chat and mod: a drawer on the right, opened by its tab and closed by tapping that tab again */
254 .tab { position: absolute; z-index: 8; top: 0; bottom: 0; right: 0; width: calc(var(--drawer) + var(--safe-r)); padding-top: calc(80px + var(--safe-t)); background: color-mix(in srgb, var(--surface) 94%, transparent); border-left: 1px solid var(--line); }
255 #tab-chat { padding-top: calc(76px + var(--safe-t)); }
256 .tab:not(#tab-drive) { padding-bottom: calc(var(--pill) + var(--safe-b)); } /* the pill's corner stays clear */
257 /* drive: the joystick in the lower left, the gripper and the joints in a card in the lower right, above the pill */
258 #tab-drive { position: absolute; inset: 0; width: auto; padding: 0; background: none; border: 0; pointer-events: none; overflow: visible; }
259 #tab-drive > * { pointer-events: auto; }
260 #turnCard { position: absolute; left: calc(6px + var(--safe-l)); bottom: calc(60px + var(--safe-b)); margin: 0; max-width: 46%; background: rgba(13,17,23,.88); color: #e8eaed; }
261 #reach { position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(10px + var(--safe-b)); padding: 0; gap: 10px; align-items: flex-end; }
262 #pad { width: min(40svh, 150px); background: radial-gradient(circle, rgba(33,38,45,.7) 0 58%, rgba(22,27,34,.55) 59%); border-color: rgba(255,255,255,.18); }
263 #reach .side button { min-width: 72px; background: rgba(0,0,0,.6); color: #e8eaed; border-color: rgba(255,255,255,.18); }
264 #driveSheet { left: auto; right: calc(8px + var(--safe-r)); bottom: calc(var(--pill) + var(--safe-b)); width: min(320px, 38vw); height: auto; max-height: calc(100% - var(--pill) - var(--stop) - 24px - var(--safe-t) - var(--safe-b)); transform: none; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--raised) 92%, transparent); transition: none; }
265 #driveSheet .peek { height: 52px; padding: 0 10px 6px; }
266 #driveSheet[data-snap=peek] #driveMore { display: none; }
267 #driveMore { padding: 4px 10px 12px; }
268 #joints { grid-template-columns: 1fr; }
269 #top { top: calc(var(--stop) + 16px + var(--safe-t)); right: calc(8px + var(--safe-r)); left: auto; max-width: 40%; }
270 #banner { top: calc(78px + var(--safe-t)); }
271 #banner.stop { top: calc(78px + var(--safe-t)); }
272 #msg { bottom: calc(60px + var(--safe-b)); }
227273 }
228 @media (max-width: 420px) { #top .label { display: none; } #link { max-width: 30vw; } }
274 @media (max-width: 420px) { #link { max-width: 30vw; } }
229275 @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
230276 </style>
231277 </head>
@@ -237,23 +283,54 @@
237283 </div>
238284 <div id="top">
239285 <span class="seg" role="group" aria-label="Views"><button id="v3" aria-pressed="false">3D</button></span>
240 <span class="info"><span id="link" hidden></span><span id="live" class="label"></span><span class="dot" id="dot"></span><span id="state">…</span></span>
286 <span class="info"><span id="link" hidden></span><span id="live"></span></span>
241287 <button id="fs" title="F">Fullscreen</button>
242288 </div>
243289 <div id="banner" role="alert"></div>
244290 <div id="msg" role="status"></div>
245291 </div>
246292
247 <section id="strip" aria-label="Who drives" aria-live="polite">
248 <div class="who"><div id="driverLine" class="none">Connecting…</div><div id="clock"></div><div id="capLine"></div></div>
293 <!-- The one status strip, and the one STOP: the same element in every layout and every tab. -->
294 <section id="strip" aria-label="Status">
295 <div class="who">
296 <div class="l1"><span class="dot" id="dot"></span><span id="driverLine" class="none" aria-live="polite">Connecting…</span></div>
297 <div class="l2"><span id="conn">…</span><span id="clock"></span></div>
298 <div id="capLine"></div>
299 </div>
249300 <div id="turnActions"></div>
250 <button id="sheetToggle" hidden aria-controls="sheet" aria-expanded="true">Hide</button>
251 <button id="stop" class="danger" hidden title="End what the arm is doing and hold (space)">Stop</button>
252 <button id="estop" class="estop" title="Emergency stop (Esc): halt, hold with torque, until an admin clears it" aria-label="Emergency stop">Stop</button>
301 <button id="estop" class="estop" data-stop title="Emergency stop (Esc): halt, hold with torque, until an admin resumes" aria-label="Emergency stop">Stop</button>
253302 </section>
254303
255 <section id="sheet" aria-label="Chat, queue and controls">
304 <section id="sheet" aria-label="Drive, queue, chat and moderation">
256305 <div id="notice" role="status" hidden></div>
306 <div class="tab" id="tab-drive" role="tabpanel" aria-labelledby="t-drive" hidden>
307 <div id="turnCard" hidden><p id="turnNote"></p></div>
308 <div id="reach" hidden>
309 <div id="pad" role="application" aria-label="Move the gripper: up reaches out, down pulls in, sideways swings around the base"><span id="knob"></span></div>
310 <div class="side">
311 <button data-lift="1" aria-label="Gripper up">▲ Up</button>
312 <button data-lift="-1" aria-label="Gripper down">▼ Down</button>
313 </div>
314 </div>
315 <section id="driveSheet" data-snap="peek" aria-label="Drive controls">
316 <button id="grab" type="button" aria-controls="driveMore" aria-expanded="false" aria-label="Joint controls"><span class="handle"></span></button>
317 <div class="peek"><span id="state">…</span><span class="grip" id="grip"><button data-grip="1">Open</button><button data-grip="-1">Close</button></span></div>
318 <div id="driveMore">
319 <p class="hint">Hold the pad to move the gripper: up reaches out, sideways swings around the base. The jog speed sets how fast.</p>
320 <div id="joints"></div>
321 <div class="row" id="poses"></div>
322 <div class="row" id="drive">
323 <label class="inline">jog <select id="rate"><option value="100">slow</option><option value="300" selected>medium</option><option value="800">fast</option></select></label>
324 <button id="hold" title="torque on, stay where it is">Hold</button>
325 <button id="releaseBtn" class="danger" title="torque off">Release</button>
326 <button id="record" class="rec">● Record</button>
327 <button id="play">▶ Play…</button>
328 <button id="leaderDrive" class="go" hidden title="stream the leader arm's pose to the arm during your turn">Drive with leader</button>
329 </div>
330 <div id="readout"></div>
331 </div>
332 </section>
333 </div>
257334 <div class="tab" id="tab-chat" role="tabpanel" aria-labelledby="t-chat">
258335 <div id="chat" role="log" aria-label="Chat"></div>
259336 <form id="say" hidden><input id="sayText" type="text" maxlength="500" autocomplete="off" enterkeyhint="send" placeholder="Say something" aria-label="Message"><button class="go">Send</button></form>
@@ -267,33 +344,10 @@
267344 <a id="forgeSignin" hidden>Have a forge account? Sign in instead</a>
268345 <h2>Waiting</h2>
269346 <ol id="queue" aria-label="Queue"></ol>
270 <p class="note">A turn lasts a few minutes and ends early when the arm sits idle. When yours comes, the Controls tab appears.</p>
347 <p class="note">A turn lasts a few minutes and ends early when the arm sits idle. When yours comes, the Drive tab opens.</p>
271348 <h2>Leader arm</h2>
272349 <div class="row"><button id="leaderBtn" title="read a leader arm plugged into this computer or phone (Chrome, Edge)">Connect leader arm</button><button id="leaderCal" hidden title="teach this page your own leader arm: once, kept with your name">Calibrate leader</button></div>
273 <p class="note">Plug an SO-101 leader into this computer or Android phone. The 3D model mirrors it while you wait; on your turn, Drive with leader in Controls moves the arm with it.</p>
274 </div>
275 <div class="tab" id="tab-controls" role="tabpanel" aria-labelledby="t-controls" hidden>
276 <div id="reach" hidden>
277 <div id="pad" role="application" aria-label="Move the gripper: up reaches out, down pulls in, sideways swings around the base"><span id="knob"></span></div>
278 <div class="side">
279 <button data-lift="1" aria-label="Gripper up">▲ Up</button>
280 <button data-lift="-1" aria-label="Gripper down">▼ Down</button>
281 <button data-grip="1">Open</button>
282 <button data-grip="-1">Close</button>
283 </div>
284 <p class="hint">Hold the pad to move the gripper: up reaches out, sideways swings around the base. The jog speed sets how fast.</p>
285 </div>
286 <div id="joints"></div>
287 <div class="row" id="poses"></div>
288 <div class="row" id="drive">
289 <label class="inline">jog <select id="rate"><option value="100">slow</option><option value="300" selected>medium</option><option value="800">fast</option></select></label>
290 <button id="hold" title="torque on, stay where it is">Hold</button>
291 <button id="releaseBtn" class="danger" title="torque off">Release</button>
292 <button id="record" class="rec">● Record</button>
293 <button id="play">▶ Play…</button>
294 <button id="leaderDrive" class="go" hidden title="stream the leader arm's pose to the arm during your turn">Drive with leader</button>
295 </div>
296 <div id="readout"></div>
350 <p class="note">Plug an SO-101 leader into this computer or Android phone. The 3D model mirrors it while you wait; on your turn, Drive with leader in the Drive tab moves the arm with it.</p>
297351 </div>
298352 <div class="tab" id="tab-admin" role="tabpanel" aria-labelledby="t-admin" hidden>
299353 <div class="card" id="modCard">
@@ -359,10 +413,10 @@
359413 <div class="row"><button id="metricsBtn">Metrics</button><button id="calib">3D calibration</button></div>
360414 </div>
361415 <nav id="tabs" role="tablist" aria-label="Sheet">
362 <button role="tab" id="t-chat" data-tab="chat" aria-controls="tab-chat" aria-selected="true">Chat<span class="badge" id="unread"></span></button>
416 <button role="tab" id="t-drive" data-tab="drive" aria-controls="tab-drive" aria-selected="false">Drive</button>
363417 <button role="tab" id="t-queue" data-tab="queue" aria-controls="tab-queue" aria-selected="false">Queue<span class="badge" id="waiting"></span></button>
364 <button role="tab" id="t-controls" data-tab="controls" aria-controls="tab-controls" aria-selected="false" hidden>Controls</button>
365 <button role="tab" id="t-admin" data-tab="admin" aria-controls="tab-admin" aria-selected="false" hidden>Admin</button>
418 <button role="tab" id="t-chat" data-tab="chat" aria-controls="tab-chat" aria-selected="true">Chat<span class="badge" id="unread"></span></button>
419 <button role="tab" id="t-admin" data-tab="admin" aria-controls="tab-admin" aria-selected="false" hidden>Mod</button>
366420 </nav>
367421 </section>
368422
@@ -458,6 +512,7 @@
458512 </div>
459513 <script type="module">
460514 import { cameraPlan } from "/ui/__VERSION__/camera-plan.js";
515 import { dragTo, settle } from "/ui/__VERSION__/sheet.js";
461516 import { mapLeaderFrame, parseCalibration } from "/leader-map.js";
462517
463518 const $ = (id) => document.getElementById(id);
@@ -476,6 +531,8 @@
476531 const NAMES = { 1: "shoulder_pan", 2: "shoulder_lift", 3: "elbow_flex", 4: "wrist_flex", 5: "wrist_roll", 6: "gripper" };
477532 const IDS = Object.fromEntries(Object.entries(NAMES).map(([id, n]) => [n, Number(id)]));
478533 const narrow = matchMedia("(max-width: 760px), (max-height: 500px)");
534 const sideways = matchMedia("(orientation: landscape) and (max-height: 500px)"); // a phone on its side: drawers, not sheets
535 const wide = matchMedia("(orientation: landscape) and (min-width: 900px) and (min-height: 501px)"); // a column: nothing to drag
479536
480537 // ---------------------------------------------------------------- the screen: the keyboard, the sheet, the tabs
481538 // The shell follows the visual viewport, so the on-screen keyboard shrinks the sheet instead of covering the chat.
@@ -483,14 +540,11 @@
483540 const vv = window.visualViewport;
484541 const fit = () => { if (!vv) return; shell.style.setProperty("--vv-h", `${vv.height}px`); shell.style.setProperty("--vv-top", `${vv.offsetTop}px`); };
485542 vv?.addEventListener("resize", fit); vv?.addEventListener("scroll", fit); fit();
486 $("sheetToggle").onclick = () => {
487 const bare = shell.classList.toggle("bare");
488 $("sheetToggle").textContent = bare ? "Show" : "Hide"; $("sheetToggle").setAttribute("aria-expanded", String(!bare));
489 };
490543 let tab = "chat";
491544 function showTab(name, focus = false) {
492 if ($(`t-${name}`).hidden) name = ["controls", "chat", "admin"].find((t) => !$(`t-${t}`).hidden) ?? "chat";
545 if ($(`t-${name}`).hidden) name = ["drive", "chat", "admin"].find((t) => !$(`t-${t}`).hidden) ?? "drive";
493546 tab = name;
547 shell.classList.toggle("drawer", name !== "drive");
494548 for (const b of $("tabs").querySelectorAll("[role=tab]")) {
495549 const on = b.dataset.tab === name;
496550 b.setAttribute("aria-selected", String(on)); b.tabIndex = on ? 0 : -1;
@@ -498,10 +552,11 @@
498552 if (on && focus) b.focus();
499553 }
500554 if (name === "chat") { $("unread").textContent = ""; chatBox.scrollTop = chatBox.scrollHeight; }
501 if (name === "controls") load3D();
555 if (name === "drive") load3D();
502556 if (name === "admin") loadSettings();
503557 }
504 for (const b of $("tabs").querySelectorAll("[role=tab]")) b.onclick = () => showTab(b.dataset.tab);
558 // On its side the video is the screen: tapping the open drawer's tab again puts the drawer away.
559 for (const b of $("tabs").querySelectorAll("[role=tab]")) b.onclick = () => showTab(sideways.matches && b.dataset.tab === tab ? "drive" : b.dataset.tab);
505560 $("tabs").addEventListener("keydown", (e) => {
506561 if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
507562 const shown = [...$("tabs").querySelectorAll("[role=tab]:not([hidden])")];
@@ -511,6 +566,41 @@
511566 $("sayText").addEventListener("focus", () => { shell.classList.add("typing"); setTimeout(() => (chatBox.scrollTop = chatBox.scrollHeight), 250); });
512567 $("sayText").addEventListener("blur", () => shell.classList.remove("typing"));
513568
569 // The Drive sheet (src/ui/sheet.js): it rests at peek (state and gripper) or open (every joint). Drag the handle,
570 // flick it, or tap it; on its side the phone shows the same two states as a card in the corner, by tap.
571 {
572 const sheet = $("driveSheet"), grab = $("grab");
573 let drag = null, dragged = false;
574 const snapTo = (where) => {
575 sheet.dataset.snap = where; sheet.style.transform = ""; sheet.classList.remove("dragging");
576 grab.setAttribute("aria-expanded", String(where === "open"));
577 };
578 const peekPx = () => parseFloat(getComputedStyle(sheet).getPropertyValue("--peek")) || 96;
579 grab.addEventListener("pointerdown", (e) => {
580 if (e.button || sideways.matches || wide.matches) return;
581 const open = sheet.offsetHeight, peek = peekPx();
582 drag = { id: e.pointerId, y0: e.clientY, start: sheet.dataset.snap === "open" ? open : peek, shown: 0, open, peek, t: e.timeStamp, y: e.clientY, v: 0 };
583 drag.shown = drag.start; dragged = false;
584 try { grab.setPointerCapture(e.pointerId); } catch {}
585 });
586 grab.addEventListener("pointermove", (e) => {
587 if (drag?.id !== e.pointerId) return;
588 if (!dragged && Math.abs(e.clientY - drag.y0) < 6) return; // a tap, so far
589 dragged = true; sheet.classList.add("dragging");
590 const dt = Math.max(1, e.timeStamp - drag.t);
591 drag.v = (drag.y - e.clientY) / dt; drag.t = e.timeStamp; drag.y = e.clientY;
592 drag.shown = dragTo(drag.start, e.clientY - drag.y0, drag.peek, drag.open);
593 sheet.style.transform = `translateY(${drag.open - drag.shown}px)`;
594 });
595 const end = (e) => {
596 if (drag?.id !== e.pointerId) return;
597 const d = drag; drag = null;
598 if (dragged) snapTo(settle({ shown: d.shown, velocity: e.timeStamp - d.t > 120 ? 0 : d.v, peek: d.peek, open: d.open }));
599 };
600 grab.addEventListener("pointerup", end); grab.addEventListener("pointercancel", end);
601 grab.addEventListener("click", () => { if (dragged) { dragged = false; return; } snapTo(sheet.dataset.snap === "open" ? "peek" : "open"); });
602 }
603
514604 // ---------------------------------------------------------------- which arm
515605 // Behind the hosted app's relay (/link answers), the arm is a live `so101 serve` or the simulation, and the cameras come through the relay.
516606 const relayed = await fetch("/link", { cache: "no-store" }).then((r) => r.ok, () => false);
@@ -761,20 +851,46 @@
761851 msg(r.stopped ? `stopped ${r.stopped}${r.saved ? `; saved recording ${r.saved}` : ""}; the arm holds` : r.ok ? "stopped: nothing was driving" : r.error, !r.ok);
762852 if (r.saved) loadRecordings();
763853 }
764 $("stop").onclick = stop;
765 // The emergency stop: the server halts whatever drives the arm and holds it with torque on until an admin clears it.
854 // The emergency stop, the page's one STOP: the server halts whatever drives the arm and holds it with torque on until
855 // an admin resumes. It fires on the finger's touch, not its lift; resuming takes a second, confirming tap.
766856 async function eStop() {
767 const r = await api("/estop", {});
768 msg(r.ok ? "EMERGENCY STOP: the arm holds; an admin must clear it" : r.error, true);
857 reachEnd();
769858 if (stream.ws) stream.ws.close();
770859 if (leaderStreaming()) stopLeaderDrive();
860 const r = await api("/estop", {});
861 msg(r.ok ? "EMERGENCY STOP: the arm holds until an admin resumes" : r.error, true);
862 if (r.ok && status) { status.estop = r.estop; renderStop(); banner(status); applyLock(); }
771863 }
772864 async function clearEStop() {
773 if (!confirm("Clear the emergency stop? The arm stays where it is; the driver can move it again.")) return;
774865 const r = await api("/estop/clear", {});
775 msg(r.ok ? "the emergency stop is cleared" : r.error, !r.ok);
866 msg(r.ok ? "resumed: the driver can move the arm again" : r.error, !r.ok);
867 if (r.ok && status) { status.estop = null; renderStop(); banner(status); applyLock(); }
776868 }
777 $("estop").onclick = eStop;
869 let resumeArmed = null, pressedAt = -Infinity;
870 /** STOP's face: Stop; once stopped, Resume for an admin (then "Tap again"), Stopped for everyone else. */
871 function renderStop() {
872 const b = $("estop"), stopped = Boolean(status?.estop), owner = isOwner();
873 if (!stopped && resumeArmed) { clearTimeout(resumeArmed); resumeArmed = null; }
874 b.classList.toggle("on", stopped && !resumeArmed); b.classList.toggle("armed", Boolean(resumeArmed));
875 b.textContent = !stopped ? "Stop" : !owner ? "Stopped" : resumeArmed ? "Tap again to resume" : "Resume";
876 b.disabled = stopped ? !owner : !(mayDrive() || owner);
877 b.setAttribute("aria-label", !stopped ? "Emergency stop" : owner ? (resumeArmed ? "Confirm: resume the arm" : "Resume the arm") : "Stopped: an admin resumes it");
878 b.title = b.disabled && !stopped ? "Emergency stop: the driver and the admins can press it" : stopped ? "The arm holds until an admin resumes it" : "Emergency stop (Esc): halt, hold with torque, until an admin resumes";
879 }
880 function resumeTap() {
881 if (!resumeArmed) { resumeArmed = setTimeout(() => { resumeArmed = null; renderStop(); }, 4000); return renderStop(); }
882 clearTimeout(resumeArmed); resumeArmed = null; renderStop();
883 void clearEStop();
884 }
885 $("estop").addEventListener("pointerdown", (e) => {
886 if (e.button || $("estop").disabled || status?.estop) return;
887 pressedAt = e.timeStamp; void eStop();
888 });
889 $("estop").addEventListener("click", (e) => {
890 if (e.timeStamp - pressedAt < 1500) { pressedAt = -Infinity; return; } // the touch already stopped it; this is its lift
891 if (status?.estop) return resumeTap();
892 void eStop(); // the keyboard: Enter or Space on the button
893 });
778894 $("hold").onclick = async () => { const r = await api("/torque", { on: true }); msg(r.ok ? "holding: torque on" : r.error, !r.ok); };
779895 $("releaseBtn").onclick = async () => {
780896 if (!confirm("Release torque? Hold the arm so it does not fall.")) return;
@@ -853,7 +969,7 @@
853969 msg(r.ok ? `recording ${name}: torque is off, move the arm by hand, then press ■ Stop recording` : r.error, !r.ok);
854970 $("recName").value = "";
855971 });
856 $("play").onclick = () => { loadRecordings(); $("playDlg").showModal(); };
972 $("play").onclick = () => { if (driving() === "play") return void stop(); loadRecordings(); $("playDlg").showModal(); };
857973 $("playClose").onclick = () => $("playDlg").close();
858974
859975 // ---------------------------------------------------------------- the leader arm, plugged into this computer or phone
@@ -1186,7 +1302,7 @@
11861302 for (const ev of ["pointerup", "pointercancel", "lostpointercapture"]) b.addEventListener(ev, up);
11871303 b.addEventListener("contextmenu", (e) => e.preventDefault());
11881304 }
1189 for (const b of document.querySelectorAll("#reach [data-grip]")) jog(b, 6, () => Number(b.dataset.grip));
1305 for (const b of document.querySelectorAll("[data-grip]")) jog(b, 6, () => Number(b.dataset.grip));
11901306 }
11911307
11921308 // ---------------------------------------------------------------- screen
@@ -1274,20 +1390,18 @@
12741390 let drove = false;
12751391 function applyLock() {
12761392 const can = mayDrive() && !status?.estop, owner = isOwner();
1277 $("t-controls").hidden = !mayDrive();
12781393 $("t-admin").hidden = !owner;
12791394 $("t-chat").hidden = $("t-queue").hidden = !relayed;
1280 for (const id of ["joints", "poses", "drive", "reach"]) $(id).inert = !can;
1281 $("stop").hidden = !(can || owner);
1282 $("estop").disabled = !(mayDrive() || owner);
1283 $("estop").title = $("estop").disabled ? "Emergency stop: the driver and the admins can press it" : "Emergency stop (Esc): halt, hold with torque, until an admin clears it";
1395 for (const id of ["joints", "poses", "drive", "reach", "grip"]) $(id).inert = !can;
1396 $("turnCard").hidden = mayDrive();
1397 renderStop();
12841398 // The server takes settings, the safety limits among them, from admins only.
12851399 for (const id of ["zoneRow", "trims", "safety", "jointLimits"]) $(id).inert = !owner;
12861400 viewer.toggleAttribute("disable-dragging", !can);
12871401 if (!can) reachEnd();
12881402 if (!can && leaderStreaming()) stopLeaderDrive(); // the server closes it too; the page need not wait for that
1289 // Your turn just came: open the controls. It just ended: back to the chat.
1290 if (mayDrive() !== drove) { drove = mayDrive(); if (relayed) showTab(drove ? "controls" : "chat"); }
1403 // Your turn just came: open the Drive tab. It just ended: back to the chat.
1404 if (mayDrive() !== drove) { drove = mayDrive(); if (relayed) showTab(drove ? "drive" : "chat"); }
12911405 else if ($(`t-${tab}`).hidden) showTab(tab);
12921406 }
12931407 const serverNow = () => Date.now() + lobby.offset;
@@ -1327,6 +1441,10 @@
13271441 $("notice").textContent = st.announcement ?? "";
13281442 $("capLine").textContent = st.maxSpeedPercent < 100 ? `Speed limited to ${st.maxSpeedPercent}% of full` : "";
13291443 $("turnActions").replaceChildren(...turnButtons());
1444 const mine = me ? st.queue.find((x) => x.id === me.id) : null;
1445 $("turnNote").textContent = lobby.hello.banned ? "You can watch, but not drive."
1446 : mine ? `You're ${ordinal(mine.place)} in line. The Drive tab opens when your turn comes.`
1447 : d ? `${d.name} is driving. Join the line, above, to take a turn.` : "Nobody is driving. Take control, above, to move the arm.";
13301448 $("queueActions").replaceChildren(el("span", { textContent: d ? (me && d.id === me.id ? "You" : d.name) : "Nobody", style: "flex:1;font-weight:600" }), ...turnButtons());
13311449 const joining = lobby.hello.signin && !me;
13321450 $("joinForm").hidden = $("forgeSignin").hidden = !joining;
@@ -1434,10 +1552,19 @@
14341552 if ($("modDlg").returnValue === "ban" && confirm(`Ban ${line.dataset.name}? They can still watch, but nobody from their name, browser or address can chat or drive.`)) say({ type: "ban", id: line.dataset.from, on: true });
14351553 });
14361554 }
1555 /** Live or reconnecting, in the strip: the room's socket (behind the relay) and the arm's status poll. */
1556 let armOk = null;
1557 function renderConn() {
1558 const c = $("conn"), roomUp = !relayed || lobby.ws?.readyState === 1;
1559 const [text, cls] = armOk === false ? ["No arm", "bad"] : !roomUp ? ["Reconnecting", "warn"] : armOk ? ["Live", ""] : ["…", ""];
1560 if (c.textContent !== text) c.textContent = text;
1561 c.className = cls;
1562 $("dot").className = armOk && roomUp ? "dot on" : "dot";
1563 }
14371564 function lobbyConnect() {
14381565 const ws = new WebSocket(`${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/live`);
14391566 lobby.ws = ws;
1440 ws.onopen = () => { lobby.retry = 500; };
1567 ws.onopen = () => { lobby.retry = 500; renderConn(); };
14411568 ws.onmessage = (e) => {
14421569 const m = JSON.parse(e.data);
14431570 if (m.type === "ping") return say({ type: "pong" });
@@ -1459,6 +1586,7 @@
14591586 lobby.ws = null; lobby.hello = null;
14601587 applyLock();
14611588 $("driverLine").className = "none"; $("driverLine").textContent = "Reconnecting…";
1589 renderConn();
14621590 setTimeout(lobbyConnect, lobby.retry);
14631591 lobby.retry = Math.min(lobby.retry * 2, 8000);
14641592 };
@@ -1569,8 +1697,7 @@
15691697 };
15701698 if (d.estop) {
15711699 b.className = "stop";
1572 b.replaceChildren(`EMERGENCY STOP by ${d.estop.by} at ${new Date(d.estop.at).toLocaleTimeString()}. The arm holds with torque on until an admin clears it.`);
1573 if (isOwner()) b.append(el("button", { textContent: "Clear the stop", className: "danger", onclick: clearEStop }));
1700 b.replaceChildren(`STOPPED by ${d.estop.by} at ${new Date(d.estop.at).toLocaleTimeString()}. The arm holds with torque on${isOwner() ? ": tap Resume twice to free it." : " until an admin resumes it."}`);
15741701 return;
15751702 }
15761703 if (d.jammed?.length) { b.className = "bad"; b.textContent = `jam: ${d.jammed.map((id) => NAMES[id] ?? id).join(", ")} pushed against something and stopped — back the leader off`; }
@@ -1587,21 +1714,23 @@
15871714 rtts.push(performance.now() - started); if (rtts.length > 10) rtts.shift(); // the link's round trip, for the camera plan
15881715 status = d;
15891716 if (Boolean(d.estop) !== wasStopped) applyLock();
1590 $("dot").className = "dot on";
1591 $("state").textContent = d.driving === null ? "idle" : d.driving === "record" ? `recording ${d.recording}` : leaderStreaming() ? `leader · ${leader.frames} frames` : d.driving;
1592 $("estop").classList.toggle("on", Boolean(d.estop)); $("estop").textContent = d.estop ? "Stopped" : "Stop";
1717 armOk = true; renderConn();
1718 $("state").textContent = d.estop ? "stopped" : d.driving === null ? "arm idle" : d.driving === "record" ? `recording ${d.recording}` : leaderStreaming() ? `leader · ${leader.frames} frames` : `arm: ${d.driving}`;
1719 renderStop();
15931720 $("record").textContent = d.driving === "record" ? "■ Stop recording" : "● Record";
1594 for (const id of ["hold", "releaseBtn", "play"]) $(id).disabled = d.driving !== null;
1595 if (tab === "controls") render(d);
1721 $("play").textContent = d.driving === "play" ? "■ End playback" : "▶ Play…";
1722 for (const id of ["hold", "releaseBtn"]) $(id).disabled = d.driving !== null;
1723 $("play").disabled = d.driving !== null && d.driving !== "play";
1724 if (tab === "drive") render(d);
15961725 banner(d); applyModel(d);
15971726 $("readout").innerHTML = `<span>lowest part <b>${Number.isFinite(d.lowestMm) ? d.lowestMm : "—"} mm</b> above the table</span><span>zone <b>${d.zone === "enforce" || d.zone === "warn" || d.zone === "off" ? d.zone : "—"}</b></span>`;
1598 } catch { $("dot").className = "dot"; $("state").textContent = "no arm"; }
1727 } catch { armOk = false; renderConn(); $("state").textContent = "no arm"; }
15991728 // Hidden, the page keeps the arm's state fresh at a walk: nobody is looking, and a phone's battery and data matter.
16001729 setTimeout(poll, document.hidden ? 2000 : 200);
16011730 }
16021731 (async () => {
16031732 applyLock();
1604 if (relayed) lobbyConnect(); else showTab("controls");
1733 if (relayed) lobbyConnect(); else showTab("drive");
16051734 limits = await api("/limits");
16061735 await loadSettings();
16071736 await loadPoses();

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs