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

Migrated from github.com/Trevato/SO-ARM100

Speed and acceleration limits can differ per joint: maxSpeedDegS and maxAccelDegS2 take a per-joint override, defaults unchanged #484

Merged opened this

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

Merged

Speed and acceleration limits can now be set per joint with jointSpeedDegS and jointAccelDegS2. With nothing set, motion is the same as before. I ran src/safety.test.ts, src/server.test.ts and src/prediction.test.ts before pushing, not the whole suite.

Notes

shipped merged

opened this

Speed and acceleration limits can now be set per joint with jointSpeedDegS and jointAccelDegS2. With nothing set, motion is the same as before.

I ran src/safety.test.ts, src/server.test.ts and src/prediction.test.ts before pushing, not the whole suite. The full bun test run hit the 120-second tool timeout, so its result isn't in. The type check could not run in the sandbox because the bun type definitions are missing.

One test fails in server.test.ts: "serves the model, its meshes and the vendored libraries, and nothing outside them". It fails the same way without my change.

  • Governor: it uses a joint's own speed and acceleration when it has them, and the global values otherwise. A joint can be set above the global limit, up to the same ceiling. STOP, the zones and the gripper torque cap are untouched.
  • Servo registers: servoLimits and the ease-over speed write each joint's own limit to the servo, so the hardware limit matches what the Governor allows. This goes slightly past the issue text.
  • PUT /settings: both maps are checked against known joint names, finite numbers, and the same ranges as the global limits (30–360 °/s and 30–3600 °/s²). A null value clears a joint's override. Joints you don't mention keep their saved values, and the maps are saved and returned like jointLimitsDeg.
  • motionLimits: it returns a per-joint map only when some joint has an override, so the motion field is unchanged when none do.
  • Tests: the fixed-trace test pins the first eight steps (501, 503, 507, 511, 517, 524, 532, 541). I recorded them from the code before this change and confirmed the old and new code give the same numbers. A second test shows a joint with a lower limit is held to it while another joint reaches its goal. A third covers the validation.

Review: the settings page in viewer.html doesn't expose the per-joint fields yet.

🤖 Generated with Claude Code

Closes #477

2 earlier comments · 2 events
commented

Speed and acceleration limits can now be set per joint with jointSpeedDegS and jointAccelDegS2. With nothing set, motion is the same as before.

I ran src/safety.test.ts, src/server.test.ts and src/prediction.test.ts before pushing, not the whole suite. The full bun test run hit the 120-second tool timeout, so its result isn't in. The type check could not run in the sandbox because the bun type definitions are missing.

One test fails in server.test.ts: "serves the model, its meshes and the vendored libraries, and nothing outside them". It fails the same way without my change.

  • Governor: it uses a joint's own speed and acceleration when it has them, and the global values otherwise. A joint can be set above the global limit, up to the same ceiling. STOP, the zones and the gripper torque cap are untouched.
  • Servo registers: servoLimits and the ease-over speed write each joint's own limit to the servo, so the hardware limit matches what the Governor allows. This goes slightly past the issue text.
  • PUT /settings: both maps are checked against known joint names, finite numbers, and the same ranges as the global limits (30–360 °/s and 30–3600 °/s²). A null value clears a joint's override. Joints you don't mention keep their saved values, and the maps are saved and returned like jointLimitsDeg.
  • motionLimits: it returns a per-joint map only when some joint has an override, so the motion field is unchanged when none do.
  • Tests: the fixed-trace test pins the first eight steps (501, 503, 507, 511, 517, 524, 532, 541). I recorded them from the code before this change and confirmed the old and new code give the same numbers. A second test shows a joint with a lower limit is held to it while another joint reaches its goal. A third covers the validation.

Review: the settings page in viewer.html doesn't expose the per-joint fields yet.

🤖 Generated with Claude Code

Changes requested — before the latest push

The Governor and validation work is sound and the default trace is pinned, but three things fail the list. Fix first: Software/README.md:761 documents every PUT /settings knob in a table (jointLimitsDeg is there) and has no rows for jointSpeedDegS and jointAccelDegS2. Add them, with the 30-360 deg/s and 30-3600 deg/s2 ranges, null clearing, and that a joint may be set above the global value up to the ceiling. 2) Tests: nothing exercises the server path you changed. Add a server.test.ts case that PUTs the maps, shows a partial patch keeps the other joints, a null clears, a bad name returns 400, and the value survives a restart. Also test that servoLimits writes the per-joint Goal_Velocity and Acceleration, since that part goes past the issue and is hardware-facing. 3) Both doors: the page does not expose the fields (you said so), and the change adds nothing to src/tty.ts. Either wire both doors or say in the pull why the settings API alone is the door, and confirm that tty has no settings command to match. Also: the full bun test and the type check were not run, and the import in safety.test.ts is out of alphabetical order.

commented

Per-joint speed and acceleration limits (jointSpeedDegS, jointAccelDegS2) now have README rows and server tests. I did not wire the settings page. src/tty.ts has no settings command to match.

Changes since the last push

  • README: Software/README.md has rows for both maps. They give the ranges (30–360 °/s and 30–3600 °/s²) and say null clears a joint's value. They also say a joint may be set above the global value, up to the ceiling, and that a patch keeps the joints it doesn't name.
  • Server test: the new server.test.ts case covers, through PUT /settings:

- a partial patch keeps the other joints; - null clears a joint; - a bad joint name and an out-of-range value return 400; - the values survive a server restart.

  • Servo registers: the same test checks that the stream arm writes each joint's own Goal_Velocity and Acceleration (45 °/s gives 512 on one joint, the global 90 °/s gives 1024 on another).
  • Import order: the import in safety.test.ts is now in alphabetical order.

Why the settings API alone is the door The page has no per-joint speed fields; viewer.html is untouched. The other per-joint settings go through the settings API as well. #469 is the change that will raise one joint's limits, so it can add the page controls.

Test results

  • Full bun test: 776 pass, 1 fail. The failure is the lobby "ban" test, a timing flake that passes when src/lobby.test.ts is run alone (51 pass).
  • server.test.ts flake: the model-routes test that failed earlier, on an unchanged tree, passed this time.
  • Type check: bun x tsc --noEmit reports errors in src/ui/zone-notes.js, src/ui/zone-notes.test.ts and src/visitor-counts.ts. None are in files I touched.

🤖 Generated with Claude Code

Changes requested — before the latest push

The Governor, validation, persistence and stream-arm paths are sound and tested. But the per-joint cap is not enforced everywhere the README says it is, and this is a safety limit.

First fix: the joint move in server.ts (~line 977) sets speed = Math.min(..., speedLimits().speed) and writes it straight to that servo's Goal_Velocity. A joint with a lower jointSpeedDegS therefore moves at the global speed there. The same global-only clamp is at ~658 (number(body.speed, 300, 20, speedLimits().speed)) and in the playback rate at ~1070 (speedLimits().speed / (step*hz)). With a lower override, playback is not slowed to fit, so the arm trails the recording. The ease-over write at ~1366 also uses the global value. Use jointMotion(speedLimits(), id).speed per joint in each of these places, and slow playback by the slowest joint it uses. The README row says the limit holds on a move and a playback, so add tests for a move and a playback with one joint capped lower.

Second: the settings page and src/tty.ts have no way to set these. Smith explained the API-only choice, but the task bar asks for both doors. Either add a tty route or note in the README that this is API-only until #469.

commented

Per-joint speed caps now hold on a move, a grip, the ease-over and a playback. server.test.ts passes (63 tests), as do motion, safety, readme and trajectory. tsc shows no errors in the files I touched.

  • Move: moveToPose takes a speedCaps map and slows the whole move until every joint is within its own cap, so the joints still arrive together. /move passes each joint's jointMotion(...).speed.
  • Grip: the gripper's speed is clamped to its own joint's limit (it used the global one).
  • Playback: the rate is cut by the joint closest to its own cap (a new jointSteps in trajectory.ts gives each joint's largest step). The ease to the first frame gets the same caps.
  • Ease-over write (~1366): clamped per joint.
  • Tests: the new server test caps shoulder_pan at 30°/s (341 ticks/s) and checks that the velocity written to the servos for a move stays at or under 341. A recording that asks 1000 ticks/s of that joint plays at rate 0.341. The same recording on an uncapped joint plays at 1.
  • Settings page and terminal: I took your second option and did not add a tty route. The README row for jointSpeedDegS now says it is API-only (PUT /settings) until #469, and lists where the limit holds.

A joint with an override above the global value can still only go as fast as the global ceiling on /move, because the request's speed is clamped to the global value. That is the conservative side. Raising it would be a separate change.

Approved

Per-joint jointSpeedDegS and jointAccelDegS2 are validated at the boundary (known joint names, finite numbers, global ranges, null clears) and merged like jointLimitsDeg. Defaults are unchanged, and a recorded-trace test pins that. The limit reaches the Governor, the servo registers, move, grip, ease-over and playback, each with a test. The README says it is API-only, and the page has no control either, so the two doors match. Not run by me: the preview or the full suite. Next: (1) add the page and terminal controls in #469 so the README caveat can go; (2) decide whether /move may let a joint exceed the global speed, since its request speed is still clamped to the global value. Smith named this as the conservative choice.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs