Skip to content

Offer interpolated preview playback, filling in frames between planned waypoints - #1014

Merged
Devin T. Currie (DTCurrie) merged 3 commits into
mainfrom
preview/5-interpolated-playback
Sep 3, 2026
Merged

Offer interpolated preview playback, filling in frames between planned waypoints#1014
Devin T. Currie (DTCurrie) merged 3 commits into
mainfrom
preview/5-interpolated-playback

Conversation

@DTCurrie

@DTCurrie Devin T. Currie (DTCurrie) commented Aug 27, 2026

Copy link
Copy Markdown
Member

Adds a Waypoints / Interpolated toggle to the preview, the last of five stacked PRs and based on preview/4-scrub-execute. Interpolated fills in frames between planned waypoints along the straight joint path RDK collision-checks, so a two-waypoint plan sweeps instead of snapping, and marks which played frames are real waypoints on the scrubber.

Motion

  • interpolateTrajectory.ts is new. waypointFrames returns the plan unchanged, interpolatedFrames subdivides each segment against a per-frame budget of DEFAULT_DEGREES_PER_FRAME and DEFAULT_MILLIMETRES_PER_FRAME, and MAX_INTERPOLATED_FRAMES caps the result, reporting how much the cap coarsened it.
  • lerpTrajectoryStep mirrors RDK's interpolateInputs from referenceframe/input.go.
  • largestJointDelta reports the largest single-joint change between two steps.

Hooks

  • usePreviewMove separates what the scrubber walks from what execute receives. playbackFrames is the played sequence, trajectory stays the planned one, and only trajectory is ever handed to execute. detail selects the framing, waypointIndices says which played frames are waypoints, and setting detail rebuilds the frames and restarts playback.

Move panel

  • MovePreview.svelte gains the toggle and a frame count that reads correctly for either framing. The scrubber takes waypointIndices as markers.

Why?

Why keep playbackFrames separate from trajectory rather than replacing it?

Interpolated frames are a display concern. The plan is what the service agreed to run, and handing interpolated steps to execute would ask the machine to run a trajectory the planner never produced.

Why does changing detail restart playback instead of mapping the current frame?

A frame index does not carry across the two framings. Frame 7 of an interpolated sweep and frame 7 of a waypoint list are unrelated positions, so mapping one to the other would jump the ghost somewhere the user did not ask for.

Why is largestJointDelta not named for a unit?

It maxes Math.abs across every joint indiscriminately, so a revolute joint contributes radians and a prismatic one contributes millimetres. It was previously called jointTravelRadians, which asserted a unit the function does not have.

Why an on:input directive, when svelte.md bans every on:-prefixed directive?

ToggleButtons is a legacy createEventDispatcher component in prime-core with no callback prop, so the alternative is rebuilding the segmented control out of two buttons. frontend-aesthetics.md says to extend PRIME rather than re-derive its primitives, and it is the repo-owned rule where the kit rule disagrees. The directive goes when prime-core replaces the dispatcher, which is noted at the call site.

Why is one fixture minified and in .prettierignore?

plan-linear-constrained.json is a 225-step capture that runs about 2,000 lines pretty-printed and is never read by eye. Its three sibling fixtures are small and stay formatted.

Testing

Ran pnpm exec vitest --run, pnpm exec svelte-check --tsconfig ./tsconfig.json, pnpm exec eslint ., and pnpm exec prettier --check .. All four are green: 96 test files, 1215 tests, zero failures, and no svelte-check errors or warnings.

Added src/lib/motion/__tests__/interpolateTrajectory.spec.ts and four recorded plan fixtures: free space, a gantry, a linear-constrained capture, and a synthetic obstacle route. Extended the hook and panel specs to cover which sequence the scrubber walks, the frame-count wording for both framings, and the toggle's aria-pressed state.

@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc3c865

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from f31201a to 5d7730e Compare August 27, 2026 15:50
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-03 14:13 UTC

@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from 5d7730e to e9f198b Compare August 27, 2026 17:47
@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from e9f198b to 8a5eef9 Compare August 28, 2026 15:40
@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from 8a5eef9 to ac1e6ec Compare August 31, 2026 13:11
@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from ac1e6ec to 25ed01a Compare August 31, 2026 13:42
Base automatically changed from preview/4-scrub-execute to main August 31, 2026 18:08
@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch 2 times, most recently from ca8fcfd to 13c4f1e Compare August 31, 2026 18:49
@DTCurrie
Devin T. Currie (DTCurrie) force-pushed the preview/5-interpolated-playback branch from 13c4f1e to cc3c865 Compare September 2, 2026 17:49
@DTCurrie
Devin T. Currie (DTCurrie) merged commit 0ce3365 into main Sep 3, 2026
8 checks passed
@DTCurrie
Devin T. Currie (DTCurrie) deleted the preview/5-interpolated-playback branch September 3, 2026 14:13
@claude claude Bot mentioned this pull request Sep 3, 2026
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.

2 participants