Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Point the app at my real arm: a setting for the server with the camera and the SO-101, simulation when unset #4
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The hosted app now has an ARMSERVER setting. Point it at your so101 serve (ws:// :8101, http://… or https://…) and the app relays the arm's controls, the /follow stream and the camera to it. With it unset, the app runs the simulated arm as before.
shipped merged
The hosted app now has an ARM_SERVER setting. Point it at your so101 serve (ws://<host>:8101, http://… or https://…) and the app relays the arm's controls, the /follow stream and the camera to it. With it unset, the app runs the simulated arm as before.
What changed
Software/so101/src/relay.ts(new): a relay in front of the simulated arm, using no new dependencies.- The page itself, the 3D model files and three.js always come from the app. Everything else goes to the real arm while it answers, or to the simulation when it doesn't.
- The cameras come through at
/camera/<1|2>/stream, so the browser never has to reach your network. By default they are on ports 8080 and 8081 of the same host;ARM_CAMERA_1andARM_CAMERA_2take full URLs if they live elsewhere. GET /linktells the page which arm it is on: live or simulated, the host, and why the real arm isn't in use.- The relay checks the real arm when it starts (giving up after 1.5 s) and again every 5 s. A failed read falls back to the simulation at once.
- A move or playback has no timeout, since it only answers when the arm arrives. It is cut only when the link drops, and then comes back as an error (502); it is not replayed on the simulation.
- Security:
POST/PUTrequests and the/followstream are only accepted from the app's own page. This uses the browser'sSec-Fetch-Siteheader, or failing thatOriginchecked againstX-Forwarded-Host/Host. Every response setsX-Content-Type-Options,Referrer-Policyand a small Content-Security-Policy. bench/fake-serve.ts: the simulated arm now listens on a private loopback port, and the relay takesPORT/HOST.forge.jsonis unchanged.viewer.html: the top bar shows "Live arm · host", "Simulated", or "Simulated · host unreachable (why)". Behind the relay the cameras load through the app. The page reloads when the arm switches between real and simulated (because the limits, poses and joints differ), but waits if the page itself is driving the arm.- README: a "Pointing the hosted app at your real arm" section: run
so101 serveon the arm machine, setARM_SERVER, and make sure the forge can reach that machine (for example, both on the same Tailscale network). It also warns not to exposeso101 serveto the internet, since it has no login.
What I chose not to do
- No login on
so101 serveitself. - No WebRTC: the existing setup serves MJPEG, and the relay passes that through as a stream.
- The Content-Security-Policy is limited to framing, base URL, plugins and form targets. A strict script/connect policy would have to account for the viewer's inline module and its
?stream=override, and I couldn't check that in a browser here.
How to try it
bun testinSoftware/so101passes (101 tests), and so doesbun x tsc --noEmit. The new tests insrc/relay.test.tscover status, saved poses and/followreaching the "real" arm, camera bytes and/statecoming through, the simulation when unset, a server that accepts connections but never answers falling back within 3 s, a server that disappears mid-session, a bad setting, and a request from another site being refused.- Locally:
ARM_SERVER=ws://<pi>:8101 PORT=8102 FORGE_APP_DATA=./data bun run Software/so101/bench/fake-serve.ts, then openhttp://127.0.0.1:8102/. - On the preview, set
ARM_SERVERon the app's settings page.
🤖 Generated with Claude Code
The hosted app now has an
ARM_SERVERsetting. Point it at yourso101 serve(ws://<host>:8101,http://…orhttps://…) and the app relays the arm's controls, the/followstream and the camera to it. With it unset, the app runs the simulated arm as before.What changed
Software/so101/src/relay.ts(new): a relay in front of the simulated arm, using no new dependencies./camera/<1|2>/stream, so the browser never has to reach your network. By default they are on ports 8080 and 8081 of the same host;ARM_CAMERA_1andARM_CAMERA_2take full URLs if they live elsewhere.GET /linktells the page which arm it is on: live or simulated, the host, and why the real arm isn't in use.POST/PUTrequests and the/followstream are only accepted from the app's own page. This uses the browser'sSec-Fetch-Siteheader, or failing thatOriginchecked againstX-Forwarded-Host/Host. Every response setsX-Content-Type-Options,Referrer-Policyand a small Content-Security-Policy.bench/fake-serve.ts: the simulated arm now listens on a private loopback port, and the relay takesPORT/HOST.forge.jsonis unchanged.viewer.html: the top bar shows "Live arm · host", "Simulated", or "Simulated · host unreachable (why)". Behind the relay the cameras load through the app. The page reloads when the arm switches between real and simulated (because the limits, poses and joints differ), but waits if the page itself is driving the arm.so101 serveon the arm machine, setARM_SERVER, and make sure the forge can reach that machine (for example, both on the same Tailscale network). It also warns not to exposeso101 serveto the internet, since it has no login.What I chose not to do
so101 serveitself.?stream=override, and I couldn't check that in a browser here.How to try it
bun testinSoftware/so101passes (101 tests), and so doesbun x tsc --noEmit. The new tests insrc/relay.test.tscover status, saved poses and/followreaching the "real" arm, camera bytes and/statecoming through, the simulation when unset, a server that accepts connections but never answers falling back within 3 s, a server that disappears mid-session, a bad setting, and a request from another site being refused.ARM_SERVER=ws://<pi>:8101 PORT=8102 FORGE_APP_DATA=./data bun run Software/so101/bench/fake-serve.ts, then openhttp://127.0.0.1:8102/.ARM_SERVERon the app's settings page.🤖 Generated with Claude Code
Closes #3