Skip to content

feat: take RobotPad's motion stream readout, update order and logging into MotionStreamConnection - #657

Merged
temmuz merged 2 commits into
revampfrom
feat/motion-stream-from-robotpad
Nov 20, 2026
Merged

temmuz merged 2 commits into
revampfrom
feat/motion-stream-from-robotpad

Conversation

@temmuz

@temmuz temmuz commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

RobotPad keeps its own, newer copies of the library's jogging logic (MotionStreamConnection, JoggerConnection, JoggingStore, 54–79% alike). The plan: bring RobotPad's changes into the library one class per PR into revamp, then RobotPad uses the library's classes and deletes its copies. This is the first: MotionStreamConnection and its helpers.

What changes

  • readoutState: what pose readouts show. It holds the previous reading while the joints only jitter (less than 0.0002 rad from it, a UR's noise at standstill, measured in RobotPad), so 2-decimal readouts stop flickering; slow movement still adds up and shows, and a TCP switch shows at once. A MobX computed kept alive, so it also holds for reads from requestAnimationFrame. readoutOf and readoutsEqual are exported for the same use elsewhere.
  • Update order: the stream stores the TCP pose before the joints, so a reaction that sees new joints in the readout also sees the matching pose.
  • Logging: an optional logger (ConnectionLogger, default: the console), for open() and the constructor. An incomplete TCP pose, which comes with every message during motion, is a debug line instead of a console warning per message. RobotPad passes its own logger.
  • jointValuesEqual now answers false for a different number of joints (it answered true). The stream's dedupe keeps the old meaning as jointValuesUnchanged, also used by ConnectedMotionGroup, so both behave as before.

Public API

Added only: readoutState, readoutOf, readoutsEqual, MotionStateReadout, jointValuesUnchanged, ConnectionLogger, and an optional last constructor parameter { logger }. jointValuesEqual keeps its signature; only its answer for different joint counts changes. API reports updated.

Checked

  • RobotPad's four readout tests, ported (jitter held, new pose with new joints, slow movement adds up, TCP switch), plus tests for the logger and the joint checks. They failed before the change; breaking the update order or the jitter hold fails a test.
  • Lint, typecheck, all 272 unit tests, build, API reports, and on a NOVA instance test:e2e (2) and all 17 playground tests.

… into MotionStreamConnection

RobotPad's copy of MotionStreamConnection (src/jogging/) has moved ahead
of the library's. This brings its changes here, so that RobotPad can use
the library's class and drop its copy:

- readoutState: what pose readouts show. It holds the previous reading
  while the joints only jitter (less than 0.0002 rad from it, a UR's
  noise at standstill), so 2-decimal readouts stop flickering; slow
  movement still adds up and shows, and a TCP switch shows at once. It
  is kept alive, so it also holds for reads from requestAnimationFrame.
  readoutOf and readoutsEqual are exported for the same use elsewhere.
- The stream stores the TCP pose before the joints, so a reaction that
  sees new joints in the readout also sees the matching pose.
- Logging goes to an optional logger (ConnectionLogger, default: the
  console); an incomplete TCP pose, which comes with every message during
  motion, is a debug line instead of a console warning per message.
- jointValuesEqual now answers false for a different number of joints
  (it answered true). The stream's dedupe keeps the old meaning as
  jointValuesUnchanged, also used by ConnectedMotionGroup.

The tests of the readout are RobotPad's, ported.
…to a const that is not exported

api:check failed on the {@link} to JOINT_NOISE_THRESHOLD, which is not
exported.
@temmuz
temmuz merged commit 54c9b95 into revamp Nov 20, 2026
3 checks passed
@temmuz
temmuz deleted the feat/motion-stream-from-robotpad branch November 20, 2026 11:13
temmuz added a commit that referenced this pull request Nov 20, 2026
… JoggerConnection (#658)

The second PR that brings RobotPad's newer jogging logic into the
library, so that RobotPad can use the library's classes and delete its
copies (the first is #657, `MotionStreamConnection`; this one is stacked
on it). This one: `JoggerConnection` and its step jogging.

## What changes

- **"Move relative to":** a `coordinateSystem` option and field.
Continuous TCP jogs move along, or turn about, the axes of a chosen
coordinate system, as in RobotPad.
- **Steps follow the frame:** `runIncrementalCartesianMotion` steps
along the tool's axes in tool orientation and along the coordinate
system's axes otherwise, through the pure function
`computeIncrementalTargetPose` (RobotPad's). They always moved along the
world's axes.
- **TCP offset:** a step sends the active TCP's offset to the planner,
so it moves by the requested distance instead of jumping by the offset.
- **A step ends at standstill:** it resolves once the robot stands still
again, not right after the trajectory is sent, guarded by a watchdog
(twice the planned time plus 5 s). Each step has its own socket; a step
asked for while one runs is dropped; `dispose()` or a change of the
jogging mode ends a running step.
- **Errors:** a plan with `error_feedback`, or a trajectory the
controller refuses, is not started. Errors go to `onError`, or reject
the step without it, instead of being thrown inside websocket listeners.
- **Options:** `motionGroupModel` for the planner, and an optional
`logger` (`ConnectionLogger`, from #657), which `open()` also hands to
its motion stream.
- `IncrementalCartesianMotionRequest` is exported; its `coordSystemId`
is optional and deprecated (the coordinate system comes from the
jogger).

The library's own improvements stay: `open()` and its disposal of the
motion stream it opened, the jogging init that always settles,
`setOptions` returning the re-init promise, the internal client.

## Behavior changes for current users

- A step's promise now resolves after the motion, so a motion lock
around it covers the whole step.
- A step asked for during another one is dropped.
- Errors reach `onError` or the step's promise instead of being thrown
in a listener.
- A refused trajectory, or a failed plan, is not executed.
- With a TCP offset, a step moves by the requested distance.
- In tool orientation, steps follow the tool's axes (the library's panel
never steps in tool orientation, so only direct API users see this).

## Public API

Additions only: the options `coordinateSystem`, `motionGroupModel` and
`logger`, the `coordinateSystem` field, and the exported types
`IncrementalCartesianMotionRequest` and `IncrementalMotion`;
`coordSystemId` becomes optional. API reports updated.

## Checked

- RobotPad's tests of the steps (`incrementalCartesianMotion`,
`incrementalJoggingConcurrency`, `Pose3`) ported, plus new tests for the
coordinate system, the TCP offset and the error paths: 17 failed before
the change. Breaking any of eight rules (refusal guard, in-flight drop,
tool-frame step, coordinate-system rotation, end on dispose, TCP offset,
`error_feedback` guard, model option) fails a test.
- Lint, typecheck, all 311 unit tests, build, `api:check`, consumer
tests, and on a NOVA instance `test:e2e` (2) and all 17 playground
tests.
temmuz added a commit that referenced this pull request Nov 20, 2026
…o", jog errors, velocity defaults (#659)

The third PR that brings RobotPad's newer jogging logic into the
library, so that RobotPad can use the library's classes and delete its
copies (#657 `MotionStreamConnection`, #658 `JoggerConnection`; this one
is stacked on #658). This one: `JoggingStore`.

## What changes

- **"Move relative to":** `jogCoordSystemId` (saved with the other
settings under `joggingToolStore`), `jogCoordSystem`,
`setMoveRelativeToCoordSystem`, `setMoveRelativeToSelectedTcp`.
`activate()` hands the coordinate system, resolved into world, to the
jogger (#658). Coordinate systems that refer to others are resolved
through `PoseTransformer` (ported in part: the coordinate-system half).
World is always known, also when a controller lists no coordinate
systems (RobotPad's resolver threw then).
- **`tcpPoseInSelectedCoordSystem`:** the TCP's readout (#657) in the
selected coordinate system.
- **Jog errors:** the store latches the jogger's errors in
`lastJogError`, with a translation key (en and de, RobotPad's texts),
and still calls an `onError` the app set; `activate()` clears it. The
old `JoggingPanel`'s stream state line shows it.
- **Velocity defaults as in RobotPad:** 10 % of the T1 limit for
translation (25 mm/s, at most 250), 5 °/s for rotation, a minimum of 1
mm/s. `setVelocityFromSlider` ignores values that are not finite or out
of range.
- **`onBeforeActivate`:** an optional hook that `activate()` awaits
(RobotPad releases a staged Move to there).
- **Steps in tool orientation** stay available, as steps now follow the
tool's axes (#658).
- **`JoggingStore.create(jogger, { coordinateSystems, description,
kinematicModel })`** from data an app already loaded; `loadFor` uses it.
- `tabs` typed as a non-empty tuple.

The library's own improvements stay: `loadFor`, `ORIENTATION_IDS`,
`activate()` awaiting the jogging mode, `unblock()` catching errors.

## Behavior changes for current users

- Default velocities 25 mm/s and 5 °/s instead of 10 mm/s and 1 °/s; the
slider minimum is 1 mm/s instead of 5.
- `setVelocityFromSlider` ignores out-of-range or non-finite values.
- Errors no longer reject `activate()` or a step: they latch in
`lastJogError` (and reach the app's `onError`). The old panel shows
them.
- Steps are offered in tool orientation.
- Each cartesian `activate()` sets the jogger's coordinate system to the
jog coordinate system (world unless the app picks another).

## Public API

Additions: `create`, `jogCoordSystem`, `jogCoordSystemId`,
`lastJogError`, `lastJogErrorTranslationKey`, `onBeforeActivate`,
`setLastJogError`, `setMoveRelativeToCoordSystem`,
`setMoveRelativeToSelectedTcp`, `tcpPoseInSelectedCoordSystem`, and
`jogCoordSystemId` in the saved settings. `tabs`, `currentTab` and
`tabsById` are typed with `JoggingTab` (still usable as before). API
reports updated.

## Checked

- 45 new tests (store, velocity defaults and checks, `PoseTransformer`,
`Pose3`) failed before the change, plus two for an empty
coordinate-system list. Five tests of the old panel that encoded the old
defaults were updated. Breaking the velocity range check, the finite
check, the awaited `onBeforeActivate`, the coordinate system handed to
the jogger, its resolution into world, the readout's coordinate system,
or the call of the app's `onError` fails a test.
- Lint, typecheck, all 367 unit tests, build, `api:check`, consumer
tests, and on a NOVA instance `test:e2e` (2) and all 17 playground
tests.
temmuz added a commit that referenced this pull request Nov 20, 2026
…load, start and pause a move to a pose (#660)

The fourth PR that brings RobotPad's newer logic into the library, so
that RobotPad can use it and delete its copies (#657
`MotionStreamConnection`, #658 `JoggerConnection`, #659 `JoggingStore`;
this one is stacked on #659). This one adds RobotPad's Move to engine,
`TrajectoryExecutionStore`, without the app around it.

## The API

- `new TrajectoryExecutionStore({ joggingStore, isLocked?,
ensureMovementOwnership?, logger? })` uses the jogging store's jogger:
its NOVA connection, cell, motion group, motion stream and planner
model, and the store's TCP and velocities. `isLocked` defaults to never
locked.
- `planTrajectory(target)`: a PTP move to a cartesian pose (`{ type:
"cartesian", pose, coordinateSystemId? }`, in world or in a coordinate
system that is transformed into world with the `PoseTransformer` of
#659) or to joints (`{ type: "joint", joints }`). It loads the
trajectory on an execution websocket, so that `start()` runs it at once.
A planner rejection is a result (`{ ok: false, errorFeedbackName }`),
not an exception; `planErrorTranslationKey` turns it into a message
(RobotPad's texts, en and de).
- `start()`, `pause()` (until the robot stands still), `stopAndReset()`,
`reset()`, `clearError()`, `dispose()`; `trajectoryState` (`idle`,
`planning`, `planned`, `moving`, `stopping`), `plannedTrajectory`,
`lastError`, `executionState`. It resets at the end of the trajectory.
- By default a move takes the robot over from jogging (it deactivates
the jogging store and switches the jogger to its trajectory mode), as
RobotPad does; an app can pass its own `ensureMovementOwnership`.

## Differences from RobotPad's copy

- A planner that cannot be reached no longer leaves the store in
"planning".
- State changes after an `await` run in MobX actions (RobotPad's copy
logs strict-mode warnings there).
- An initialization that NOVA answers with an error `message` is a
refusal, as for the steps of #658, and the message goes to `lastError`
(RobotPad's copy counted it as accepted).
- It waits for standstill on the motion stream, as `JoggerConnection`
does, instead of comparing NATS joint values; no `tcpId` in the target
(RobotPad plans with the selected TCP too).

The playground's Move to demo (#656) switches to this engine in a
follow-up, once #656 is in.

## Public API

Additions only: `TrajectoryExecutionStore`, its options,
`TrajectoryTarget`, `PlanTrajectoryResult`, `PlannedTrajectory`,
`TrajectoryState`, `planErrorTranslationKey`. API reports updated.

## Checked

- RobotPad's tests of its engine, ported, plus tests for the default
ownership, joint targets, the unreachable planner, MobX actions, the
error texts and a refusal by message: 45 new tests, all failing before
the code. Breaking the coordinate-system transform, the reset at the end
of the trajectory, the rule for a pause acknowledgement after the motion
settled, or the default ownership fails a test.
- Lint, typecheck, all 412 unit tests, build, `api:check`, consumer
tests, and on a NOVA instance `test:e2e` (2) and all 17 playground
tests.

## Known, older than this PR

`JoggerConnection`'s step jogs (in the library before and in RobotPad)
send the controller's limits as `global` in the motion group setup;
NOVA's field is `global_limits`. To check and fix on its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant