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

Migrated from github.com/Trevato/SO-ARM100

`so101 teleop` drives the follower from the leader in one process at 60 Hz, with a joint table, lag and space to STOP #574

opened this

Merged 39d 11h ago

so101 teleop [--leader P --follower P] [--hz 60] now drives the follower from the leader in one process. The tests I ran pass: the new ones plus the existing teleop and readme tests (21 in all).

Notes

opened this

so101 teleop [--leader P --follower P] [--hz 60] now drives the follower from the leader in one process. The tests I ran pass: the new ones plus the existing teleop and readme tests (21 in all). The tsc run printed type errors in other files (src/ui/zone-notes.js, src/visitor-counts.ts and others); I only filtered its output for the files I touched, which showed none. I never ran it against a real arm, only the fake buses.

  • Ports:
    • Both ports open before the terminal goes raw, and one finally closes both ports and the terminal.
    • A wrong or busy port is a plain error.
    • Command-line ports win. Otherwise the remembered roles are found by USB serial number, and if they aren't known the error says to run so101 setup.
    • Setup itself isn't part of this pull.
  • Space and q:
    • Space stops the follower, which holds with torque on.
    • Resuming re-reads where the follower really is and ramps toward the leader by at most RAMP_STEP ticks per frame.
    • q quits, and the screen says the follower stays holding with torque on.
  • Keys: src/keys.ts keeps a key pressed while nobody waits for the next waiter, and a waiter ends with its signal.
  • Where it lives: the run loop is in src/local-teleop.ts, resolveRoles is in src/arms.ts, and the command and screen are in src/local-teleop-run.ts. I didn't use teleop.ts because it already exists on main for something else.
  • Tests: they use fake buses and cover following, STOP holding, the bounded first step after resume, the key queue, and resolveRoles.
  • Other changes:
    • cli.ts now loads server.ts only when serve runs, so the CLI doesn't pull in bun:sqlite at startup.
    • The new flags are named --leader and --follower, as the issue says. Closed pull #566 used --leader-port and --follower-port.
    • The README has a "Plug in and play" section with the command and a link to https://huggingface.co/docs/lerobot/so101.

Closes #571

3 earlier comments
commented

so101 teleop [--leader P --follower P] [--hz 60] now drives the follower from the leader in one process. The tests I ran pass: the new ones plus the existing teleop and readme tests (21 in all). The tsc run printed type errors in other files (src/ui/zone-notes.js, src/visitor-counts.ts and others); I only filtered its output for the files I touched, which showed none. I never ran it against a real arm, only the fake buses.

  • Ports:
    • Both ports open before the terminal goes raw, and one finally closes both ports and the terminal.
    • A wrong or busy port is a plain error.
    • Command-line ports win. Otherwise the remembered roles are found by USB serial number, and if they aren't known the error says to run so101 setup.
    • Setup itself isn't part of this pull.
  • Space and q:
    • Space stops the follower, which holds with torque on.
    • Resuming re-reads where the follower really is and ramps toward the leader by at most RAMP_STEP ticks per frame.
    • q quits, and the screen says the follower stays holding with torque on.
  • Keys: src/keys.ts keeps a key pressed while nobody waits for the next waiter, and a waiter ends with its signal.
  • Where it lives: the run loop is in src/local-teleop.ts, resolveRoles is in src/arms.ts, and the command and screen are in src/local-teleop-run.ts. I didn't use teleop.ts because it already exists on main for something else.
  • Tests: they use fake buses and cover following, STOP holding, the bounded first step after resume, the key queue, and resolveRoles.
  • Other changes:
    • cli.ts now loads server.ts only when serve runs, so the CLI doesn't pull in bun:sqlite at startup.
    • The new flags are named --leader and --follower, as the issue says. Closed pull #566 used --leader-port and --follower-port.
    • The README has a "Plug in and play" section with the command and a link to https://huggingface.co/docs/lerobot/so101.
commented

I changed the one test that failed on the preview deploy, the Pi chart draws under-voltage minutes… in src/data-view.test.ts, and pushed. It passed when I ran it locally, so I haven't seen it fail here, and I haven't confirmed the cause. The only difference I found was timing. The test waited a fixed 120 ms for the Pi chart to render, and the failure took 132 ms on a busy deploy machine.

piChart now waits, up to about 5 seconds, until the chart shows a mark or the "none" note, instead of sleeping a fixed time. This is a test fix only. The teleop code is untouched, and nothing in it is near that test.

After the change, src/data-view.test.ts passes in about 0.9 s. I did not rerun the whole suite here; the preview deploy will do that on this push.

commented

I've pushed changes for both blockers. The tests that cover these changes pass (12 across arms, keys, local-teleop-run and readme); I did not run the full suite or a real arm.

1. The default path now works (option b).

  • so101 teleop --leader P --follower P --save writes both arms' USB serial numbers to arms.json. After that, plain so101 teleop finds them on whichever ports they are plugged into.
  • --save fails with a plain error if either adapter has no serial number, or if both ports are the same adapter. A new helper, rolesOf in src/arms.ts, has its own test.
  • The error and the README now say "pass --leader and --follower (add --save to remember them)". Neither names so101 setup.
  • This departs from the issue's wording, which asked for the 'run: so101 setup' error. I followed your rule that the text must not name a missing command. When setup lands, that string can go back in one line.
  • One line in the README's story paragraph (line 31, already on main) still says bun so101 setup. I left it alone because it isn't part of this pull.

2. The ramp is now only for a start or resume.

  • The goal is clamped to RAMP_STEP per frame only after the start or a resume. Once the goal equals the leader reading, the reading goes straight through.
  • A new test makes a 900-tick leader jump during normal running and checks that the follower arrives within a few frames. The ramped path would have taken about 18.
  • The screen column is now labelled "target".

Flake fix. Agreed that the data-view.test.ts fix belongs in its own pull. I'll keep it separate next time.

commented

I've pushed the fixes. The tests for what I changed pass (src/arms.test.ts and src/local-teleop.test.ts, 8 tests), and tsc shows no errors in arms or local-teleop. I didn't run the whole suite or try it on a real arm.

  • Unrelated change: I reverted src/data-view.test.ts to main, so the flake fix is out of this pull. I can't open a pull from here, so the flake still needs its own small pull. The Pi chart test waits a fixed 120 ms for the chart to render and can fail on a busy machine.
  • FORGE_APP_DATA: I removed it from configFile in src/arms.ts. The saved arms now live in $SO101_HOME or ~/.config/so101/arms.json.
  • --save on macOS: rolesOf now runs both typed paths through calloutDevice before comparing, so /dev/tty.usbmodemX matches /dev/cu.usbmodemX. A new test covers this.
  • Screen test: The new tests in src/local-teleop.test.ts check that the screen shows six joint rows with the leader reading and the target. A joint with no target shows -. They also check the lag line, the live "press SPACE to STOP" line, and the full STOPPED line.
  • Still untested: teleop() and terminalKeys() have no tests, since both open real ports and a raw terminal. driveScreen and the key queue are tested.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs