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

Migrated from github.com/Trevato/SO-ARM100

Leader teleop: with the leader connected in Chrome, moving it moves the real arm - live, during your turn #65

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

With a leader arm connected in Chrome, a Teleop switch now makes the real arm follow it live during your turn. The type check passes, and the teleop, leader-arm and admin-relay tests pass, run together six times in a row. I didn't run the whole check.

Notes

shipped merged

opened this

With a leader arm connected in Chrome, a Teleop switch now makes the real arm follow it live during your turn. The type check passes, and the teleop, leader-arm and admin-relay tests pass, run together six times in a row. I didn't run the whole check.

  • Sending (src/teleop.ts, new): the page reads the leader at 60 Hz and maps it through the driver's calibration, gripper included. Teleop sends at most 30 frames a second over the existing /follow WebSocket. Only the latest reading goes out and nothing queues behind it.
  • When it may send: only while the switch is on, a leader is connected, it is your turn and the tab is visible.

- When any of these stops being true, it stops sending and closes the stream on purpose, so the arm server holds the arm where it is. - The end of a turn, an unplugged leader, or the server ending the stream also turns the switch off, with the reason shown. - If the connection drops, nothing is sent and teleop reconnects by itself. - When teleop starts, the server eases the arm over to the leader's pose instead of snapping; the server's speed and joint limits still apply.

  • Who can drive: the owner's switch takes control at once, ending whoever is driving. Anyone else's switch waits for their turn and sends nothing before it.
  • Seeing the lag (src/viewer.html): the switch sits beside Connect leader arm, and the old "Drive with leader" button in Controls is now the same Teleop toggle.

- While teleop drives, each joint gets a track showing the leader's target (ring) and the follower's reported position (dot). - The lag from leader to follower, p50 and p95, is shown there and on the metrics page. It turns amber when p95 is above 200 ms.

  • Measuring the lag: the browser matches the follower's reported pose against the frames it sent. That makes it this browser's own measurement; the server doesn't record it.

Tests (src/teleop.test.ts):

  • Sending is held to 30 Hz with the latest reading winning.
  • Outside your turn nothing is sent.
  • Hiding the tab, a lost socket and the end of a turn each stop it as described.
  • How lag is worked out is covered.
  • A fake Web Serial leader (src/fake-serial.ts, shared with leader-arm.test.ts) moves the simulated follower, gripper included, through the relay. Unplugging it mid-move stops the follower within one frame, and the arm then holds.

admin-relay.test.ts only gets a type annotation. The Software README's leader section describes Teleop.

What I chose not to do: the server doesn't collect lag from browsers, because that would need a new endpoint that writes data.

To try it: open the preview in Chrome and press Connect leader arm. Turn on Teleop, take control, move the leader, and watch the joint tracks in Controls and the lag readout.

🤖 Generated with Claude Code

Closes #56

commented

With a leader arm connected in Chrome, a Teleop switch now makes the real arm follow it live during your turn. The type check passes, and the teleop, leader-arm and admin-relay tests pass, run together six times in a row. I didn't run the whole check.

  • Sending (src/teleop.ts, new): the page reads the leader at 60 Hz and maps it through the driver's calibration, gripper included. Teleop sends at most 30 frames a second over the existing /follow WebSocket. Only the latest reading goes out and nothing queues behind it.
  • When it may send: only while the switch is on, a leader is connected, it is your turn and the tab is visible.

- When any of these stops being true, it stops sending and closes the stream on purpose, so the arm server holds the arm where it is. - The end of a turn, an unplugged leader, or the server ending the stream also turns the switch off, with the reason shown. - If the connection drops, nothing is sent and teleop reconnects by itself. - When teleop starts, the server eases the arm over to the leader's pose instead of snapping; the server's speed and joint limits still apply.

  • Who can drive: the owner's switch takes control at once, ending whoever is driving. Anyone else's switch waits for their turn and sends nothing before it.
  • Seeing the lag (src/viewer.html): the switch sits beside Connect leader arm, and the old "Drive with leader" button in Controls is now the same Teleop toggle.

- While teleop drives, each joint gets a track showing the leader's target (ring) and the follower's reported position (dot). - The lag from leader to follower, p50 and p95, is shown there and on the metrics page. It turns amber when p95 is above 200 ms.

  • Measuring the lag: the browser matches the follower's reported pose against the frames it sent. That makes it this browser's own measurement; the server doesn't record it.

Tests (src/teleop.test.ts):

  • Sending is held to 30 Hz with the latest reading winning.
  • Outside your turn nothing is sent.
  • Hiding the tab, a lost socket and the end of a turn each stop it as described.
  • How lag is worked out is covered.
  • A fake Web Serial leader (src/fake-serial.ts, shared with leader-arm.test.ts) moves the simulated follower, gripper included, through the relay. Unplugging it mid-move stops the follower within one frame, and the arm then holds.

admin-relay.test.ts only gets a type annotation. The Software README's leader section describes Teleop.

What I chose not to do: the server doesn't collect lag from browsers, because that would need a new endpoint that writes data.

To try it: open the preview in Chrome and press Connect leader arm. Turn on Teleop, take control, move the leader, and watch the joint tracks in Controls and the lag readout.

🤖 Generated with Claude Code

commented

With a leader arm connected in Chrome, a Teleop switch now makes the real arm follow it live during your turn. This update merges the latest main (f89a72f). The type check passes, and 44 tests pass across teleop, leader-arm, admin-relay and relay; the full check runs on the push.

Merge: two files conflicted, and both sides were kept.

  • viewer.html: the status line keeps main's "reconnecting…" state and amber dot. Otherwise it shows teleop · N frames. Each status poll still feeds the follower's pose into the lag measurement and redraws the joint tracks.
  • admin-relay.test.ts: keeps main's 200 ms wait before reading /link, and this branch's type annotation.

Teleop:

  • Sending (src/teleop.ts, new): the page reads the leader at 60 Hz and maps it through the driver's calibration, gripper included. Teleop sends at most 30 frames a second over the existing /follow WebSocket. Only the latest reading goes out and nothing queues behind it.
  • When it may send: only while the switch is on, a leader is connected, it is your turn and the tab is visible.

- When any of these stops being true, it stops sending and closes the stream on purpose, so the arm server holds the arm where it is. - The end of a turn, an unplugged leader, or the server ending the stream also turns the switch off, with the reason shown. - If the connection drops, nothing is sent and teleop reconnects by itself. - When teleop starts, the server eases the arm over to the leader's pose instead of snapping; the server's speed and joint limits still apply.

  • Who can drive: the owner's switch takes control at once, ending whoever is driving. Anyone else's switch waits for their turn and sends nothing before it.
  • Seeing the lag (src/viewer.html): the switch sits beside Connect leader arm, and the old "Drive with leader" button in Controls is now the same Teleop toggle.

- While teleop drives, each joint gets a track showing the leader's target (ring) and the follower's reported position (dot). - The lag from leader to follower, p50 and p95, is shown there and on the metrics page. It turns amber when p95 is above 200 ms.

  • Measuring the lag: the browser matches the follower's reported pose against the frames it sent. That makes it this browser's own measurement; the server doesn't record it.

Tests (src/teleop.test.ts):

  • Sending is held to 30 Hz with the latest reading winning.
  • Outside your turn nothing is sent.
  • Hiding the tab, a lost socket and the end of a turn each stop it as described.
  • How lag is worked out is covered.
  • A fake Web Serial leader (src/fake-serial.ts, shared with leader-arm.test.ts) moves the simulated follower, gripper included, through the relay. Unplugging it mid-move stops the follower within one frame, and the arm then holds.

The Software README's leader section describes Teleop.

What I chose not to do: the server doesn't collect lag from browsers, because that would need a new endpoint that writes data.

To try it: open the preview in Chrome and press Connect leader arm. Turn on Teleop, take control, move the leader, and watch the joint tracks in Controls and the lag readout.

🤖 Generated with Claude Code

Approved

Approved on the source; I could not reach the preview from my sandbox (403), so I did not use it in a browser, and there is no leader arm here anyway. The state machine in teleop.ts is sound: nothing is sent unless the switch is on, a leader is connected, it is your turn and the tab is visible; stops are clean closes so the arm holds; a latest-wins 30 Hz sender; the server's own gates are untouched. Tests cover the rate, the turn gate, a hidden tab, a lost socket and an unplug through the real relay. Two things I would do next: (1) give #teleopLive role=group or role=img with a text equivalent and announce the lag; aria-label on a plain div is ignored by screen readers, so the per-joint tracks are invisible to them. (2) The README says a non-owner's switch 'waits for their turn', but driveLeader refuses with 'take control to join the line, then switch it on'. Make the page or the README match, and add a test for that wiring since viewer.html has none. Teleop has no tty door because it needs a Web Serial leader in a browser; worth saying so in the README.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs