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

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

TOP: the joint sliders follow your finger and stay where you put them - no snapping back #79

Merged opened this in answer to

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

smith/arm:smith/64-top-the-joint-sliders-follow-your-finger → main 2 commits fork 3 threads · 3 unresolved

  • Merged. smith/64-top-the-joint-sliders-follow-your-finger was merged into main as c89e816.

Review

Sign in to review this change.
4 files changed +196 −33
Software/so101/src/server.test.ts +12
@@ -127,6 +127,18 @@ describe("viewer page", () => {
127127 expect(await r.text()).toContain("Fullscreen");
128128 });
129129
130 test("wires your target past the pose: the intent module, the reason line, the marks and the model's hold", async () => {
131 const html = await (await fetch(`${base}/`)).text();
132 expect(html).toMatch(/import\("\/ui\/[^/]+\/intent\.js"\)/);
133 expect(html).toContain('id="why"');
134 const module = await fetch(`${base}${html.match(/import\("(\/ui\/[^"]+\/intent\.js)"\)/)![1]}`);
135 expect(module.status).toBe(200);
136 expect(html).toContain("intent.target(j.id, j.position"); // the slider row and the model both ask before showing the pose
137 expect(html.match(/intent\.target\(/g)!.length).toBeGreaterThanOrEqual(2);
138 expect(html).toContain("intent.set(j.id, Number(range.value)"); // every input event is a target
139 expect(html).toContain("explainLock()");
140 });
141
130142 test("never builds HTML from people's text: event details and E-stop names go in as text nodes", async () => {
131143 const html = await (await fetch(`${base}/`)).text();
132144 const sinks = html.split("\n").filter((line) => /\.innerHTML\s*=/.test(line));
Software/so101/src/ui/intent.js added +92
@@ -0,0 +1,92 @@
1 /**
2 * What the person asked for, kept apart from where the arm is. A joint dragged by a slider or the 3D model has an
3 * intent (a target in ticks): while it is held, and after release until the arm arrives or `hold` ms pass, the page
4 * shows the intent and never lets a pose update overwrite it. Plain ESM, served at /ui/ and imported by the tests.
5 */
6
7 export class Intent {
8 /** @param {{ hold?: number, near?: number }} [options] hold: ms an unreached target is kept after release; near: ticks that count as arrived */
9 constructor(options = {}) {
10 this.hold = options.hold ?? 2000;
11 this.near = options.near ?? 12;
12 /** @type {Map<number, { ticks: number, down: boolean, since: number }>} */
13 this.targets = new Map();
14 }
15
16 /** The pointer is on the joint and wants `ticks`. @param {number} id @param {number} ticks @param {number} now */
17 set(id, ticks, now) {
18 if (Number.isFinite(ticks)) this.targets.set(id, { ticks, down: true, since: now });
19 }
20
21 /** The pointer lifted: the target stays, timed from now. @param {number} id @param {number} now */
22 release(id, now) {
23 const t = this.targets.get(id);
24 if (t) { t.down = false; t.since = now; }
25 }
26
27 /** Drop everything (stopped, turn over). */
28 clear() { this.targets.clear(); }
29
30 /**
31 * The target to show for a joint, or null when the real pose is the thing to show. Expires released targets the
32 * arm reached or that waited long enough.
33 * @param {number} id @param {number | null | undefined} actual @param {number} now
34 */
35 target(id, actual, now) {
36 const t = this.targets.get(id);
37 if (!t) return null;
38 if (!t.down && (now - t.since >= this.hold || (Number.isFinite(actual) && Math.abs(/** @type {number} */ (actual) - t.ticks) <= this.near))) {
39 this.targets.delete(id);
40 return null;
41 }
42 return t.ticks;
43 }
44
45 /** Whether the pointer is still on the joint. @param {number} id */
46 held(id) { return this.targets.get(id)?.down === true; }
47 }
48
49 /**
50 * In words, why the controls are off; null when they are on.
51 * @param {{ queued?: boolean, turn: boolean, estop?: unknown, held?: unknown, reconnecting?: unknown }} s
52 */
53 export function whyNot(s) {
54 if (s.estop) return "Stopped - an admin must clear the emergency stop";
55 if (s.held) return "Stopped - resume first";
56 if (s.reconnecting) return "Arm offline - reconnecting";
57 if (s.turn) return null;
58 return s.queued ? "It's not your turn" : "Join the queue to drive";
59 }
60
61 /** The marks' look, added with the first mark: the page's own style is spent. */
62 const CSS = `
63 .j .rail { position: relative; flex: 1; min-width: 0; display: flex; }
64 .j .rail input[type=range] { width: 100%; }
65 .j .mark { position: absolute; top: 2px; bottom: 2px; width: 2px; pointer-events: none; border-radius: 1px; }
66 .j .mark.actual { background: var(--fg); opacity: .8; } .j .mark.intent { background: var(--blue); width: 8px; top: -3px; bottom: -3px; border-radius: 4px; border: 2px solid var(--bg, #fff); box-sizing: border-box; margin-left: -3px; }
67 #why { margin: 0 0 6px; color: var(--warn); font-size: 13px; } #why:empty { display: none; }
68 `;
69
70 let styled = false;
71
72 /**
73 * Place the two marks on a slider's rail: where the arm is, and (when there is one) where it was asked to go.
74 * The mark is a tall pill, the arm's a thin line, and the range says both in words.
75 * @param {{ range: any, actual?: any, mark?: any }} row
76 * @param {number | null} want @param {number | null | undefined} actual
77 */
78 export function marks(row, want, actual) {
79 const document = /** @type {any} */ (globalThis).document;
outdated

The JSDoc is attached to let styled instead of marks(). The marks differ by colour only: add aria-valuetext on the range and make the intent mark taller or a different shape.

80 if (!styled && document) { styled = true; document.head.append(Object.assign(document.createElement("style"), { textContent: CSS })); }
81 if (!row.actual) {
82 row.actual = Object.assign(document.createElement("i"), { className: "mark actual" });
83 row.mark = Object.assign(document.createElement("i"), { className: "mark intent", hidden: true });
84 row.range.parentElement.append(row.actual, row.mark);
85 }
86 const lo = Number(row.range.min), span = Number(row.range.max) - lo;
87 const at = (/** @type {number} */ v) => `calc(${Math.max(0, Math.min(100, ((v - lo) / span) * 100))}% - 1px)`;
88 row.range.setAttribute("aria-valuetext", want === null ? `${row.range.value}` : `target ${want}, actual ${actual ?? "unknown"}`);
89 row.mark.hidden = want === null;
90 if (want !== null) row.mark.style.left = at(want);
91 if (typeof actual === "number") row.actual.style.left = at(actual);
92 }
Software/so101/src/ui/intent.test.ts added +58
@@ -0,0 +1,58 @@
1 import { describe, expect, test } from "bun:test";
2 import { Intent, whyNot } from "./intent.js";
3
4 describe("Intent", () => {
5 test("a fake 30 Hz pose stream never moves a held slider", () => {
6 const i = new Intent();
7 i.set(1, 3000, 0);
8 for (let k = 0; k < 90; k++) expect(i.target(1, 2048, k * 33)).toBe(3000);
9 });
10 test("after release the target stays until the arm arrives", () => {
11 const i = new Intent();
12 i.set(1, 3000, 0); i.release(1, 100);
13 expect(i.target(1, 2048, 500)).toBe(3000);
14 expect(i.target(1, 2995, 600)).toBeNull();
15 expect(i.target(1, 2048, 700)).toBeNull();
16 });
17 test("an arm that never arrives is followed again after 2 s", () => {
18 const i = new Intent();
19 i.set(2, 3000, 0); i.release(2, 0);
20 expect(i.target(2, 2048, 1999)).toBe(3000);
21 expect(i.target(2, 2048, 2000)).toBeNull();
22 });
23 test("a held target is not dropped when the arm happens to be there", () => {
24 const i = new Intent();
25 i.set(3, 2048, 0);
26 expect(i.target(3, 2048, 10)).toBe(2048);
27 expect(i.held(3)).toBe(true);
28 });
29 test("an unknown joint shows the real pose", () => expect(new Intent().target(9, 1, 0)).toBeNull());
30 });
31
32 describe("whyNot", () => {
33 const base = { turn: false };
34 test("a refused command says why", () => {
35 expect(whyNot({ ...base })).toBe("Join the queue to drive");
36 expect(whyNot({ ...base, queued: true })).toBe("It's not your turn");
37 expect(whyNot({ turn: true, held: {} })).toBe("Stopped - resume first");
38 expect(whyNot({ turn: true, reconnecting: true })).toBe("Arm offline - reconnecting");
39 });
40 test("your turn drives", () => expect(whyNot({ turn: true })).toBeNull());
41 });
42
43 describe("marks", () => {
44 test("intent and actual sit apart on the rail, the intent hidden when there is none", async () => {
45 const { marks } = await import("./intent.js");
46 const made: any[] = [];
47 (globalThis as any).document = { head: { append() {} }, createElement: () => ({ style: {} }) };
48 const row = { range: { min: "0", max: "100", value: "40", setAttribute(k: string, v: string) { (this as any)[k] = v; }, parentElement: { append: (...n: any[]) => made.push(...n) } } } as any;
49 marks(row, 75, 25);
50 expect(row.mark.hidden).toBe(false);
51 expect(row.mark.style.left).toBe("calc(75% - 1px)");
52 expect(row.actual.style.left).toBe("calc(25% - 1px)");
53 expect(row.range["aria-valuetext"]).toBe("target 75, actual 25");
54 marks(row, null, 30);
55 expect(row.range["aria-valuetext"]).toBe("40");
56 expect(row.mark.hidden).toBe(true);
57 });
58 });
Software/so101/src/viewer.html +34 −33
@@ -365,6 +365,7 @@
365365 </div>
366366 <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>
367367 </div>
368 <p id="why" role="status"></p>
368369 <div id="joints"></div>
369370 <div class="row" id="poses"></div>
370371 <div class="row" id="drive">
@@ -575,7 +576,6 @@
575576
576577 // ---------------------------------------------------------------- which arm
577578 // 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.
578 // The relay writes the link and the camera list into the page (#boot), so the first view needs no round trip to start.
579579 const boot = (() => { try { return JSON.parse($("boot")?.textContent ?? "null"); } catch { return null; } })();
580580 const relayed = boot !== null || await fetch("/link", { cache: "no-store" }).then((r) => r.ok, () => false);
581581 // A real arm that drops is "reconnecting": the same arm, its last pose kept, driving paused. Only after a minute down
@@ -602,11 +602,7 @@
602602 }
603603
604604 // ---------------------------------------------------------------- cameras
605 // The owner lists the cameras (/admin/camera-list); this page polls the list, so a camera added or removed shows within seconds.
606 // Which views are on is this viewer's own choice, kept in this browser: one at a time on a phone, several side by side on a wider screen.
607 // On a good link a plain <img> stream, which every browser plays; a canvas comparison once a second notices a frozen
608 // picture and reconnects. On a slow one (src/ui/camera-plan.js) the relay holds the stream to a few frames a second,
609 // and on a crawl one snapshot at a time. The quality button overrides it. A hidden page fetches no video at all.
605 // On a good link a plain <img> stream, which every browser plays; a canvas comparison once a second notices a frozen picture and reconnects; a slow link gets fewer frames (src/ui/camera-plan.js).
610606 const cams = [];
611607 const direct = (n) => q.get(`stream${n}`) || q.get(n === 1 ? "stream" : "") || `${location.protocol}//${location.hostname}:${8079 + n}/stream`;
612608 const canvas = document.createElement("canvas"); canvas.width = 32; canvas.height = 18;
@@ -986,9 +982,7 @@
986982 $("playClose").onclick = () => $("playDlg").close();
987983
988984 // ---------------------------------------------------------------- the leader arm, plugged into this computer or phone
989 // src/leader-arm.ts, served at /app/: the CLI's own bus code over Web Serial. Connected, the leader is mirrored by the 3D model
990 // and the joint rows. With Teleop on, during your turn, src/teleop.ts streams its pose at 30 Hz, latest wins, through the
991 // server's limits and zone; the turn ending, a hidden tab, an unplugged leader or a lost socket stop it and the arm holds.
985 // src/leader-arm.ts, served at /app/: the CLI's own bus code over Web Serial. Connected, the leader is mirrored by the 3D model; teleop (src/teleop.ts) streams it during your turn.
992986 let leader = null; // { arm, port, stop, pose, targets, calibration }
993987 let teleop = null; // src/teleop.ts, made when the first leader connects
994988 let calib = null; // the calibration card, while it is open
@@ -1101,9 +1095,7 @@
11011095 teleop.set(true);
11021096 }
11031097 // ---------------------------------------------------------------- leader calibration (src/leader-map.js)
1104 // Once per driver: the leader in the follower's middle pose, then each joint at each end the model shows. The ends
1105 // carry the direction (a joint whose low end reads higher is mounted backwards) and each side's length; the centre
1106 // carries the offset. Kept on the server under the driver's sign-in; the connected leader maps through it from then on.
1098 // Once per driver: the leader in the follower's middle pose, then each joint at each end the model shows; kept on the server under the driver's sign-in.
11071099 const LABELS = { 1: "Base rotation", 2: "Shoulder", 3: "Elbow", 4: "Wrist bend", 5: "Wrist roll", 6: "Gripper trigger" };
11081100 const LEADER_IDS = [1, 2, 3, 4, 5, 6];
11091101 const STEPS = ["centre", ...LEADER_IDS.flatMap((id) => [{ id, end: "low" }, { id, end: "high" }]), "check"];
@@ -1223,11 +1215,9 @@
12231215 ]);
12241216 THREE = three; reachMath = reach;
12251217 if (!customElements.get("urdf-viewer")) customElements.define("urdf-viewer", URDFManipulator);
1226 // The element leaves mesh loading to the page: binary STL through three's loader, the URDF's colour where it names one.
12271218 viewer.loadMeshFunc = (path, manager, material, done) => {
12281219 new STLLoader(manager).load(path, (geometry) => done(new THREE.Mesh(geometry, material ?? new THREE.MeshPhongMaterial({ color: 0x9aa4ae, shininess: 30 }))), undefined, (err) => done(null, err));
12291220 };
1230 // The drag controls listen for mouse events only. A finger is translated into them, so the model can be dragged on a phone or an iPad.
12311221 const canvas = viewer.renderer.domElement;
12321222 canvas.style.touchAction = "none";
12331223 const asMouse = (type, t) => canvas.dispatchEvent(new MouseEvent(type, { clientX: t.clientX, clientY: t.clientY, bubbles: true }));
@@ -1246,12 +1236,10 @@
12461236 table.position.z = modelInfo.floorZ - 0.0005;
12471237 const grid = new THREE.GridHelper(0.9, 18, 0x4a5058, 0x30363d); grid.rotation.x = Math.PI / 2; grid.position.z = modelInfo.floorZ;
12481238 marker = new THREE.Mesh(new THREE.SphereGeometry(0.012, 16, 12), new THREE.MeshBasicMaterial({ color: 0xf85149 })); marker.visible = false;
1249 // Not for the mouse: the drag controls take the first thing a ray hits, and three.js hits a line from a metre away.
12501239 for (const o of [table, grid, marker]) o.raycast = () => {};
12511240 viewer.world.add(table, grid, marker);
12521241 viewer.plane.visible = false; // the element's own shadow plane sits under the lowest part, which would be below the table
12531242 if (status) applyModel(status);
1254 // A three-quarter view from the front right, close enough for a 40 cm arm (the element starts 10 m away).
12551243 viewer.camera.position.set(0.5, 0.38, 0.62);
12561244 viewer.controls.target.set(0.08, 0.1, 0);
12571245 viewer.controls.update();
@@ -1259,11 +1247,13 @@
12591247 $("reach").hidden = !tipLink();
12601248 });
12611249 viewer.addEventListener("manipulate-start", (e) => { dragging = e.detail; stream.open(); });
1262 viewer.addEventListener("manipulate-end", () => { dragging = null; stream.end(); });
1250 viewer.addEventListener("manipulate-end", () => { const id = IDS[dragging]; if (id) intent.release(id, performance.now()); dragging = null; stream.end(); });
12631251 viewer.addEventListener("angle-change", (e) => {
12641252 if (dragging !== e.detail || !viewer.robot) return;
12651253 const id = IDS[e.detail]; if (!id || !limits[id]) return;
1266 stream.send({ [id]: clampTicks(id, toTicks(id, viewer.robot.joints[e.detail].angle)) });
1254 const ticks = clampTicks(id, toTicks(id, viewer.robot.joints[e.detail].angle));
1255 intent.set(id, ticks, performance.now());
1256 stream.send({ [id]: ticks });
12671257 });
12681258 function applyModel(d) {
12691259 if (!viewer.robot || calib) return; // while calibrating, the model shows the pose to copy
@@ -1271,7 +1261,8 @@
12711261 const name = NAMES[j.id];
12721262 if (!name || j.position == null || name === dragging || !limits[j.id]) continue;
12731263 if (reachState.timer && j.id <= 3) continue; // the joystick is ahead of the arm; snapping back would make it stutter
1274 viewer.setJointValue(name, toRad(j.id, j.position));
1264 const want = intent.target(j.id, j.position, performance.now());
1265 viewer.setJointValue(name, toRad(j.id, want ?? j.position));
12751266 }
12761267 if (marker) {
12771268 const v = d.blocked ?? d.violation;
@@ -1281,8 +1272,7 @@
12811272 }
12821273
12831274 // ---------------------------------------------------------------- the joystick: move the gripper, not a joint
1284 // The pad's deflection becomes a displacement of the gripper (src/ui/reach.js), solved onto pan, lift and elbow
1285 // against the URDF the 3D view already holds. The wrist keeps its own angle; the server's zone checks every frame.
1275 // The pad's deflection becomes a displacement of the gripper (src/ui/reach.js), solved onto pan, lift and elbow.
12861276 let reachMath = null;
12871277 const REACH = [1, 2, 3];
12881278 const SPEED = { 100: 0.02, 300: 0.05, 800: 0.1 }; // m/s at full deflection, by jog speed
@@ -1363,8 +1353,6 @@
13631353
13641354 // ---------------------------------------------------------------- touch driving (src/ui/drive.js)
13651355 // Upright: a chip picks the joint, the lever's deflection is its speed, ▲ and ▼ nudge it and jog when held.
1366 // On its side: two thumb sticks over the picture (left J1/J2, right J3/J4 or J5/gripper) and the gripper between them.
1367 // Every finger is its own holder; the instant one lifts, its joints' targets go out as they stand and the arm settles there.
13681356 const driver = new Driver({
13691357 send: (f) => stream.send(f),
13701358 flush: (f) => stream.flush(f),
@@ -1570,8 +1558,16 @@
15701558 function isOwner() { return !relayed || Boolean(lobby.hello?.you?.owner); }
15711559 const say = (m) => { if (lobby.ws?.readyState === 1) lobby.ws.send(JSON.stringify(m)); };
15721560 let drove = false;
1561 function explainLock() {
1562 const me = lobby.hello?.you, down = linkNow === "offline", st = typeof status?.source === "string" && status.source.startsWith("simulated");
1563 const w = whyNot({ turn: mayDrive(), queued: Boolean(me && lobby.state?.queue?.some((x) => x.id === me.id)), estop: status?.estop, held: status?.held, reconnecting: status?.reconnecting || linkNow === "reconnecting" || (relayed && (down || (st && realArm(linkMode)))) });
1564 $("why").textContent = w ?? "";
1565 return w;
1566 }
15731567 function applyLock() {
1574 const can = mayDrive() && !status?.estop && !status?.held, owner = isOwner();
1568 const why = explainLock();
1569 if (why) intent.clear();
1570 const can = mayDrive() && !why, owner = isOwner();
15751571 $("t-controls").hidden = !mayDrive();
15761572 $("t-admin").hidden = !owner;
15771573 $("t-chat").hidden = $("t-queue").hidden = !relayed;
@@ -1868,6 +1864,9 @@
18681864 const joints = $("joints");
18691865 const built = new Map();
18701866 let sliding = null;
1867 // Lazy: the first view's budget is spent.
1868 let intent = { set() {}, release() {}, clear() {}, target: () => null }, whyNot = () => null, marks = () => {};
1869 const intentModule = import("/ui/__VERSION__/intent.js").then((m) => { intent = new m.Intent(); whyNot = m.whyNot; marks = m.marks; }, () => {});
18711870 function render(d) {
18721871 for (const j of d.joints) {
18731872 let el = built.get(j.id);
@@ -1875,13 +1874,13 @@
18751874 const lim = limits[j.id] ?? { min: 0, max: 4095 };
18761875 const div = document.createElement("div"); div.className = "j";
18771876 div.innerHTML = `<b></b><div class="v"><span class="pos"></span><small class="ld"></small><small class="t"></small></div>
1878 <div class="slide"><span class="jog"><button data-d="-1" aria-label="less">−</button></span><input type="range" min="${lim.min + 30}" max="${lim.max - 30}" step="1"><span class="jog"><button data-d="1" aria-label="more">+</button></span></div>`;
1877 <div class="slide"><span class="jog"><button data-d="-1" aria-label="less">−</button></span><span class="rail"><input type="range" min="${lim.min + 30}" max="${lim.max - 30}" step="1"></span><span class="jog"><button data-d="1" aria-label="more">+</button></span></div>`;
18791878 div.querySelector("b").textContent = j.joint ?? String(j.id);
18801879 const range = div.querySelector("input");
18811880 range.setAttribute("aria-label", j.joint ?? `joint ${j.id}`);
18821881 range.addEventListener("pointerdown", () => { sliding = j.id; stream.open(); });
1883 range.addEventListener("input", () => { if (sliding === j.id) stream.send({ [j.id]: Number(range.value) }); });
1884 const done = () => { if (sliding === j.id) { sliding = null; stream.end(); } };
1882 range.addEventListener("input", () => { if (sliding === j.id) { intent.set(j.id, Number(range.value), performance.now()); stream.send({ [j.id]: Number(range.value) }); el.pos.textContent = range.value; } });
1883 const done = () => { if (sliding === j.id) { sliding = null; intent.release(j.id, performance.now()); stream.end(); } };
18851884 range.addEventListener("pointerup", done); range.addEventListener("pointercancel", done); range.addEventListener("change", done);
18861885 for (const b of div.querySelectorAll(".jog button")) jog(b, j.id, () => Number(b.dataset.d));
18871886 joints.append(div);
@@ -1889,10 +1888,12 @@
18891888 built.set(j.id, el);
18901889 }
18911890 const hot = j.temperature >= 55, load = Math.abs(j.load ?? 0);
1892 el.pos.textContent = j.position ?? "—";
1891 const want = intent.target(j.id, j.position, performance.now());
1892 el.pos.textContent = want ?? j.position ?? "—";
1893 marks(el, want, j.position);
18931894 el.pos.style.color = hot ? "var(--bad)" : load > 50 ? "var(--warn)" : "var(--fg)";
18941895 el.t.textContent = `${j.temperature ?? "—"}°C · ${load.toFixed(0)}%${j.torque ? " ·T" : ""}`;
1895 if (sliding !== j.id && j.position != null) el.range.value = j.position;
1896 if (want !== null) el.range.value = want; else if (sliding !== j.id && j.position != null) el.range.value = j.position;
18961897 el.div.classList.toggle("jam", d.jammed?.includes(j.id));
18971898 el.div.classList.toggle("drag", dragging === j.joint || sliding === j.id);
18981899 const locked = (d.driving !== null && d.driving !== "stream") || leaderStreaming(); // the page's own stream may run; a leader's may not be fought
@@ -1940,10 +1941,10 @@
19401941 function applyStatus(d) {
19411942 if (!started) return void (early = d);
19421943 {
1943 const wasStopped = Boolean(status?.estop || status?.held);
1944 const was = $("why").textContent;
19441945 status = d;
19451946 driver.seed(d.joints.filter((j) => j.position != null).map((j) => [j.id, j.position]));
1946 if (Boolean(d.estop || d.held) !== wasStopped) applyLock();
1947 if ((explainLock() ?? "") !== was) applyLock();
19471948 // Stopped, reconnecting or no longer this person's turn: a held thumb lets go, and its zero goes out now.
19481949 if (!canDrive({ mayDrive: mayDrive(), estop: d.estop, held: d.held, reconnecting: d.reconnecting, limits })) driver.releaseAll();
19491950 // The round trip to the arm, which every command also makes: shown once it is long enough to feel.
@@ -1984,13 +1985,13 @@
19841985 applyLock();
19851986 if (relayed) lobbyConnect(); else showTab("controls");
19861987 // The views: the ones chosen last time, else one on a phone (the camera when there is a real one), else the camera and the model.
1987 // With the page's own facts (#boot) the camera starts now, before anything else is asked; the rest is asked all at once.
19881988 const linked = boot ? Promise.resolve(boot.link) : relayed ? api("/link").catch(() => ({})) : Promise.resolve(null);
19891989 if (boot) {
19901990 cameraFirst = boot.link.mode === "live" || q.has("stream");
19911991 if (cameraFirst) { viewsReady = true; for (const c of cams) if (!paneOn(c) && wanted(c.pane.dataset.key)) showCam(c, true); }
19921992 }
1993 const [l, mi, link] = await Promise.all([api("/limits"), api("/model.json"), linked, loadSettings(), loadPoses()]);
1993 const [, l, mi, link] = await Promise.all([intentModule, api("/limits"), api("/model.json"), linked, loadSettings(), loadPoses()]);
1994 applyLock();
19941995 limits = l; modelInfo = mi; started = true;
19951996 cameraFirst = !relayed || link?.mode === "live" || q.has("stream");
19961997 startViews();

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs