SCOPE: Motion plan replay plugin#782
Conversation
For now, no helpers are being placed in lib/snapshot.ts. Consider moving some of these helpers later.
|
|
1. Joints (frame_type: rotational) should not be apart of the main tree 2. Geometry: translations vs. translations. One is the offset from origin frame for the attachment point of the next link, the other is the offset from origin frame to geometry center of the link.
Cameras, grippers, and obstacles parented to model frames (e.g. "left-arm") were permanently orphaned because model frames are never spawned as ECS entities. They now redirect to the arm's end-effector via model.primary_output_frame, falling back to model.links[last].id: Viam's convention that the last link is always the end-effector.
Updated motion replay entities get their preserved opacity restored, so slider changes stick across scrubs.
Semantic error messages for duplicate or invalid motion plan JSON.
Fill in gaps (large jumps in angle change) with sub-steps, where every joint moves at a velocity proportional to its total delta.
- planToSnapshots unexported - GeometryDescriptor collapsed: parseGeometry() now returns Geometry | null directly - computeJointedLinkPose moved - LocalPose → Pose getting rid of unnecessary type.
Matthew MacFarquhar (mattmacf98)
left a comment
There was a problem hiding this comment.
Great POC! looks very nice!
my main things for when we do the full impl are
- we should try to be more koota native and create a plan entity and relationships for the plan <--> plan entities
- I think we can use zod to parse the plans a little easier
- we should strip back some of the (very cool) functionality you added in P0 (i.e. no linear interp between steps, no preserve opacity and visibility (yet), no multiple plans loaded at a time)
| } | ||
|
|
||
| /* Push toasts above the motion plan scrubber bar (fixed bottom-4, ~44px tall). */ | ||
| body.has-scrubber [aria-label='Toasts'] { |
There was a problem hiding this comment.
todo: for final impl we probably should look into how to do this with component placements instead of the app css
|
|
||
| const clearActivePlan = () => { | ||
| for (const entry of entityMap.values()) { | ||
| if (world.has(entry.entity)) hierarchy.destroyEntityTree(world, entry.entity) |
There was a problem hiding this comment.
for the final setup, lets look into making a new PlanEntity, which we can then give relationships to all the world entities that are part of it (see the selection plugin https://github.com/viamrobotics/visualization/blob/main/src/lib/plugins/Selection/traits.ts for inspo)
this way we can make this flow more koota native and the relationship has an auto destroy hook e.x. https://github.com/viamrobotics/visualization/blob/main/src/lib/plugins/Selection/relations.ts#L9 so we can make it so all world entities auto clean up when a plan entity is removed
There was a problem hiding this comment.
Tried mirroring the pattern from Selection plugin here: 5631b12. This makes the destroy plan path logically clearer! Is this up to your spec?
| provideMotionPlanReplayer(untrack(() => plans)) | ||
| </script> | ||
|
|
||
| {#if plans === undefined} |
There was a problem hiding this comment.
it would be cool if drag and drop just updated the plans array and then we could use the ui for both cases
There was a problem hiding this comment.
Designed a more explicit hook here (f3f70cb) which calls the same addPlan hook from app vs. standalone.
When a frame (e.g. gripper) is parented to a model frame (e.g. left-arm), it should first try to parent itself to the model frame's primary_output_frame, which is the primary tip/end-effector frame. If that metadata is not found, default to the last frame ofthe model frame
- Added src/lib/plugins/MotionPlanReplayer/relations.ts (PartOfPlan relation, autoDestroy: 'source') - Updated useMotionPlanReplayer.svelte.ts to spawn a planEntity, tag spawned entities (recursively through ChildOf) with PartOfPlan, replace the manual clearActivePlan teardown loop with a single planEntity.destroy(), and drive the coloring/opacity pass off world.query(planRelations.PartOfPlan(planEntity))
|
Marcus (@sucrammal) Some UX / UI feedback for you:
|
Jason (mrloureed)
left a comment
There was a problem hiding this comment.
added comment to the ticket for design feedback
- Motion plan items use eyes for toggle visibility - Scrubber matches color of selected buttons - Auto-select newly uploaded plans - Move exit button to the right.
|
Jason (@mrloureed) Re: your UI/UX feedback. Alongside persistent color, opacity, and visibility toggle edits, I'm going to push off implementing axes helpers and anything color at the moment, as per Matthew MacFarquhar (@mattmacf98):
But, implemented everything else! Screen.Recording.2026-07-06.at.4.43.34.PM.mov |
Changes
useMotionPlanReplayer.svelte.tscontext managing plan list state (add/remove/select/step) and driving playback throughreconcileSnapshotEntitiesparse-plan.ts(zod-validated extraction offrame_system/trajectoryfrom concatenated plan JSON chunks),build-frame-descriptors.ts(resolves static vs. revolute-joint frames, handles quaternion/euler/OV orientations, model-frame reparenting into per-step transforms), andplan-to-snapshots.ts(renders trajectory steps intoSnapshot[])MotionPlanReplayerUI.svelte(floating panel – upload, list, select, remove) andMotionPlanReplayerScrubber.svelte(play/pause/step/seek transport), wired into+layout.svelteand exported fromplugins/index.tsPartOfPlanrelation (relations.ts) tying every entity spawned for a plan, including nested model assets, to a single plan-root entity, so switching, clearing, or removing a plan cascades cleanup via koota's autoDestroy instead of manual entity bookkeepingLinks:
Testing:
POC demo:
motion-plan-replay-POC.mov
Salad1:
saladMotionPlanReplay.mov
Vino:
vinoMotionPlanReplay.mov
Cappucina
cappucinaMotionPlanReplay.mov