Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
so101 serve boots with the arm unplugged: /status says "arm: not connected", cameras and the grow box keep serving #617
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
`so101 serve` now starts and listens when the arm is unplugged. When the port is missing or can't be opened, it logs `arm not connected (<path>: <reason>)` and keeps serving. That covers `--port`, `SO101_PORT` and detection.
shipped merged
so101 serve now starts and listens when the arm is unplugged. When the port is missing or can't be opened, it logs arm not connected (<path>: <reason>) and keeps serving. That covers --port, SO101_PORT and detection.
I ran the new test, server.test.ts, stations.test.ts, readme.test.ts, cli-node.test.ts and fake-serve.test.ts, and they pass. tsc --noEmit reports errors in other files, but none in the three I changed.
- Without an arm:
- GET /status answers 200 with arm: "not connected" and no joints.
- /version, /camera-profile and /grow/* answer as before.
- Every route that needs the servos answers 503 {"error":"arm not connected"} before touching anything.
- STOP, resume and E-stop still answer 200, and E-stop skips the bus hold.
- The gain-sync timer doesn't start.
- Code:
startServernow takes the bus ornull. The route lists and the stand-in bus are in the newsrc/absent-bus.ts;openArminsrc/cli.tsdoes the opening. - Test:
src/absent-arm.test.tsstarts the server with no bus. It reads thecaselines ofserver.tsand requires each route to be in exactly one of the arm-route or free-route lists. A new route must therefore be classified, or the test fails. It then checks every arm route answers 503. - README: the Pi section now says the arm server runs unplugged.
- Drive stream is not a 503:
/followis accepted and closed at once with code 1013 and the reasonarm not connected. Bun here never delivered a 503 written to an upgrade socket, so I used the same close-after-connect route the E-stop and hold already take. - Detection no longer waits:
servewith no port set used to block until a servo board appeared (waitForArm). It now starts without one. I removed that import fromcli.tsand left the helper in place, sincestations.test.tsstill uses it. I also rewrote the README line that described the wait. - Restart needed to connect: plugging the arm in needs a service restart, as the issue says (reconnecting is the next issue).
- Test teardown: the new test doesn't await
server.close(). In this Bun,http.closenever finishes after the server has closed a WebSocket. An E-stop close does the same on the armed server, so it isn't new.
Approved. The change does what #581 asks: so101 serve logs one line and keeps serving with the arm unplugged. Arm routes answer 503 in JSON, STOP answers 200, /follow closes with 1013, and no write reaches a wire. The test that forces every case route into exactly one list is the strongest part. I read the diff and the preview. The preview is the hosted app with the arm offline: / answers 200 and /status reports the arm offline. I did not exercise so101 serve itself or read the screenshots, because the sandbox denies /data/looks. This change has no UI of its own.
Two things to do next:
- Fix the README contradiction. It says plugging the arm in brings its card back with no restart, then says the service needs a restart. Say that the card returns once
serveis restarted, until the reconnect issue lands. - Remove
waitForArminarm-wait.ts, which only a test uses now, or use it. Also makeabsentBusreturnundefinedforthen. Todayawait buswould hang forever, because the Proxy returns a rejecting function for every key.
so101 servenow starts and listens when the arm is unplugged. When the port is missing or can't be opened, it logsarm not connected (<path>: <reason>)and keeps serving. That covers--port,SO101_PORTand detection.I ran the new test,
server.test.ts,stations.test.ts,readme.test.ts,cli-node.test.tsandfake-serve.test.ts, and they pass.tsc --noEmitreports errors in other files, but none in the three I changed.-
GET /statusanswers 200 witharm: "not connected"and no joints. -/version,/camera-profileand/grow/*answer as before. - Every route that needs the servos answers 503{"error":"arm not connected"}before touching anything. - STOP, resume and E-stop still answer 200, and E-stop skips the bus hold. - The gain-sync timer doesn't start.startServernow takes the bus ornull. The route lists and the stand-in bus are in the newsrc/absent-bus.ts;openArminsrc/cli.tsdoes the opening.src/absent-arm.test.tsstarts the server with no bus. It reads thecaselines ofserver.tsand requires each route to be in exactly one of the arm-route or free-route lists. A new route must therefore be classified, or the test fails. It then checks every arm route answers 503./followis accepted and closed at once with code 1013 and the reasonarm not connected. Bun here never delivered a 503 written to an upgrade socket, so I used the same close-after-connect route the E-stop and hold already take.servewith no port set used to block until a servo board appeared (waitForArm). It now starts without one. I removed that import fromcli.tsand left the helper in place, sincestations.test.tsstill uses it. I also rewrote the README line that described the wait.server.close(). In this Bun,http.closenever finishes after the server has closed a WebSocket. An E-stop close does the same on the armed server, so it isn't new.Closes #615