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

Merged opened this

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

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.

shipped merged

opened this

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: startServer now takes the bus or null. The route lists and the stand-in bus are in the new src/absent-bus.ts; openArm in src/cli.ts does the opening.
  • Test: src/absent-arm.test.ts starts the server with no bus. It reads the case lines of server.ts and 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: /follow is accepted and closed at once with code 1013 and the reason arm 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: serve with no port set used to block until a servo board appeared (waitForArm). It now starts without one. I removed that import from cli.ts and left the helper in place, since stations.test.ts still 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.close never 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

commented

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: startServer now takes the bus or null. The route lists and the stand-in bus are in the new src/absent-bus.ts; openArm in src/cli.ts does the opening.
  • Test: src/absent-arm.test.ts starts the server with no bus. It reads the case lines of server.ts and 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: /follow is accepted and closed at once with code 1013 and the reason arm 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: serve with no port set used to block until a servo board appeared (waitForArm). It now starts without one. I removed that import from cli.ts and left the helper in place, since stations.test.ts still 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.close never 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

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:

  1. 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 serve is restarted, until the reconnect issue lands.
  2. Remove waitForArm in arm-wait.ts, which only a test uses now, or use it. Also make absentBus return undefined for then. Today await bus would hang forever, because the Proxy returns a rejecting function for every key.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs