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

Migrated from github.com/Trevato/SO-ARM100

/admin shows each joint's servo control registers in one read-only table #472

opened this

Merged 42d 12h ago

/admin now has a Servos section. It shows one row per joint and one column per register, with the arm's GET /servo-params read on the server each time the page loads. I ran the whole Software/so101 test suite (755 pass).

Notes

opened this

/admin now has a Servos section. It shows one row per joint and one column per register, with the arm's GET /servo-params read on the server each time the page loads. I ran the whole Software/so101 test suite (755 pass). I added servo-panel.test.ts for this, and it passes. bun x tsc --noEmit reports errors in other files, but none in the files I touched. src/web is untouched, so I did not run design-lint.

  • Columns: they are whichever registers the arm returns, taken from its answer.
  • Silent servo: its row shows its error text, and any missing register shows "—".
  • Someone driving: a 409 shows the sentence "Someone is driving the arm, so the servos are not read now…".
  • Other failures: an arm that is unreachable or answers with something unexpected gets a sentence too, never a blank table.
  • Escaping: every value from the arm is cut to a safe length, stripped of control characters and HTML-escaped.
  • Owner only: the section appears only for the owner. A moderator sees /admin without it, and anyone else gets 404.

The page logic is in the new src/servo-panel.ts. src/relay.ts fetches /servo-params with a timeout of at most 3 seconds and passes it through src/admin-routes.ts to src/admin-page.ts.

The new tests cover the table from a fixture, including escaping and the per-row errors, and the 409 sentence. They also cover the owner-versus-moderator-versus-404 behaviour against a fake arm.

Closes #443

3 earlier comments
commented

/admin now has a Servos section. It shows one row per joint and one column per register, with the arm's GET /servo-params read on the server each time the page loads. I ran the whole Software/so101 test suite (755 pass). I added servo-panel.test.ts for this, and it passes. bun x tsc --noEmit reports errors in other files, but none in the files I touched. src/web is untouched, so I did not run design-lint.

  • Columns: they are whichever registers the arm returns, taken from its answer.
  • Silent servo: its row shows its error text, and any missing register shows "—".
  • Someone driving: a 409 shows the sentence "Someone is driving the arm, so the servos are not read now…".
  • Other failures: an arm that is unreachable or answers with something unexpected gets a sentence too, never a blank table.
  • Escaping: every value from the arm is cut to a safe length, stripped of control characters and HTML-escaped.
  • Owner only: the section appears only for the owner. A moderator sees /admin without it, and anyone else gets 404.

The page logic is in the new src/servo-panel.ts. src/relay.ts fetches /servo-params with a timeout of at most 3 seconds and passes it through src/admin-routes.ts to src/admin-page.ts.

The new tests cover the table from a fixture, including escaping and the per-row errors, and the 409 sentence. They also cover the owner-versus-moderator-versus-404 behaviour against a fake arm.

commented

/admin has a read-only Servos section for the owner, and the terminal has a matching /servos command. I ran terminal.test.ts and servo-panel.test.ts, and both pass. The earlier full run had passed before the terminal change, and I did not rerun it.

  • README: the "Tuning the servos" section in Software/README.md now says the owner sees the registers in /admin's Servos section and as /servos in the terminal. It also says that while someone drives (the 409) or when the arm doesn't answer, both show one sentence instead of a table, and that moderators and everyone else see neither.
  • Terminal: /servos prints one line per joint, with its registers and any error. It uses readServos for the same parsing as the page, and src/tty.ts now wires it up. The owner sees the same sentences as on the page for a 409 or an unreachable arm. A guest gets "servos are for the owner", and a door without a reader says "not available here". A new test in terminal.test.ts covers all of these, including control characters being stripped.

I only filter for the owner. /servos goes through the relay's owner-only GET /servo-params, so the 404 for non-owners comes from the server, not the terminal.

commented

I merged main into the branch and pushed it. The only conflict was in src/terminal.ts.

I kept both sides in both places:

  • Help text: it now lists /zero <joint> [deg] (owner) from main and /servos (owner) from this branch.
  • Typed union: it has the zero variant and the servos variant.

terminal.test.ts and servo-panel.test.ts pass (38 tests), and tsc reports nothing in the files I touched. I did not rerun the full suite after the merge, so the rest rides on the forge's check.

commented

I merged main into the branch again and pushed. The conflict was in src/terminal.ts, in the same two places as last time.

  • Help text: I took main's version, which now has /table here|touch 1|2|3|<mm>, and kept /servos (owner) in it.
  • Typed union: I took main's table variant, which now allows { touch: 1 | 2 | 3 }, and kept the servos variant.

terminal.test.ts and servo-panel.test.ts pass (39 tests), and tsc shows no errors in the files I touched. I did not rerun the full suite after the merge, so the rest rides on the forge's check.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs