App 16360 add llm 3 d scene generation#740
Conversation
Introduce a new SceneBuilder overlay feature: add SceneBuilder.svelte component, frameDeltaAdapter implementation and unit tests, and a server route (server/routes/scene-builder.ts). Wire the route into server.ts and update +layout.svelte to include the overlay. package.json updated for required dependencies.
Refactor frame-delta workflow to separate validation/preparation from application. Introduces validateProposedFrameDeltas which computes PreparedUpdate records (previous/new pose & parent) and returns errors without mutating config, and add applyPreparedUpdates to apply those prepared updates via updateFrame. Updated tests to cover both validation and application flows, and updated SceneBuilder.svelte to use pendingUpdates, derive diffRows for the preview table, call validateProposedFrameDeltas on submit, and applyPreparedUpdates on confirm (replaced revert->cancel and applied->pendingUpdates naming). Minor debug helper $inspect(localConfigProps, 'LOCAL') added to App.svelte.
🦋 Changeset detectedLatest commit: 1366025 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
this is dope! |
mattmacf98
left a comment
There was a problem hiding this comment.
This looks great! I left a couple of nits to think about when doing the final PR (I think this is non-invasive enough to just do one PR)
biggest thing is just to move this to a plugin see DrawService for an example on how to do that visualization/src/lib/plugins/DrawService/DrawService.svelte
| () => partID, | ||
| () => localConfigProps | ||
| ) | ||
| provideSceneBuilder() |
There was a problem hiding this comment.
we will probably want to put this provide only in the LLMSceneBuilder plugin, look at how the draw service sets it up
as inspo…pdates and Deps from frameDeltaAdapter.ts.
…ally, not viam's OV. Allow partial Euler orientation updates instead of replacing the full ov_degrees vector. Changes include: - frameDeltaAdapter: FrameDelta.orientation now accepts optional roll/pitch/yaw and applies Euler deltas to the previous pose (via applyEulerDeltaToPose) rather than overwriting the OV orientation. - transform: add poseToEulerDegrees and applyEulerDeltaToPose helpers to convert between poses and Euler angles and apply deltas. - useSceneBuilder: improve diff formatting (rounding for mm/deg) and show per-axis orientation changes (yaw/pitch/roll) using poseToEulerDegrees. - API (+server): update FrameDelta schema to accept optional roll/pitch/yaw, add field descriptions and enhance the system prompt with coordinate conventions, examples, and guidance to convert Viam orientation vectors to Euler angles. - Tests: update expectations and add cases covering yaw/pitch application and combining deltas with existing orientations. These changes make it easier to express incremental, intuitive rotations (e.g. "yaw 90°") and surface axis-specific diffs in the UI.
| * `Frame.svelte` uses to blend live kinematics with user-staged edits; | ||
| * `worldMatrix.ts` premultiplies the result by the parent's `WorldMatrix`. | ||
| */ | ||
| export const poseToEulerDegrees = (pose: Partial<Pose>): { roll: number; pitch: number; yaw: number } => { |
There was a problem hiding this comment.
Interesting, does the Typescript SDK not expose Viam's euler type signature?
There was a problem hiding this comment.
Yes, the TS SDK includes the Euler type signature (https://ts.viam.dev/classes/appRobotApi.Orientation_EulerAngles.html). It's just that Orientation_eulerAngles is defined in radians. The callers of these functions are intentionally in degrees just because degrees are a more natural unit for the end user for frame editing. I could edit this function to use the SDK defined type signature – will just need to add conversions from deg <-> radians. what do you think?
Everything must be prerenderable.
|
|
Hey @sucrammal — CI is green and no reviewer is assigned yet. Could you request one when you have a chance? Auto-comment from overwatch. Will not re-nudge for 7 days. |
There was a problem hiding this comment.
very close! there are just a couple more extractions to be made to fully plugin-ize this
- nothing should go in App.svelte your provideAnthropicKey, LLMSceneBuilder component etc... should just go in the +layout.svelte so they are used in local motion tools without baking them into the exported MotionTools component
- pull the AISettings out and inject from the top layer
| { label: 'Vision', component: VisionSettings }, | ||
| { label: 'Widgets', component: WidgetSettings }, | ||
| { label: 'Debug', component: DebugSettings }, | ||
| { label: 'AI', component: AISettings }, |
There was a problem hiding this comment.
move AISettings into the plugin dir for AI and then inject it in via settingsTabs from the top level look at XRSettings as an example https://github.com/viamrobotics/visualization/blob/main/src/routes/%2Blayout.svelte#L70
| <Logs /> | ||
| <AddFrames /> | ||
| {#if !localConfigProps || onInfer} | ||
| <LLMSceneBuilder onInfer={onInfer ?? standaloneInfer} /> |
There was a problem hiding this comment.
this should not go here, this App gets exported as the component, put it here https://github.com/viamrobotics/visualization/blob/main/src/routes/%2Blayout.svelte#L78-L81 like the other local plugins
| </fieldset> | ||
| </Portal> | ||
|
|
||
| <FloatingPanel |
There was a problem hiding this comment.
we can actually put this in <Portal id="dom"> I just found out (instead of having to put in the dashboard snippet
There was a problem hiding this comment.
LGTM 3 things before merge
- run npx @changesets/cli to create a .changeset minor bump
- remove the changes in src/lib/hooks/useFrames.svelte.ts
- wrap the floatingPanel in
<Portal id="dom">instead of putting in the dashboard snippet
This is a prototype for an LLM-powered frame builder. It allows you to type in a natural language query to edit frame orientation, position, and parent of one or more components in the visualizer.
Here's a short, imperfect demo that shows me moving an arm to a new position, as well as resetting it back to its origin.
basicdemo.mov
Here's another demo of using the frame builder alongside the other editor. Making edits in both ways creates a config diff together.
dragSessionAndFrameBuild.mov
However, I'm having a little trouble with local position vs. world position. I had a peek at the worldPose/worldMatrix implementation, and heard from @mattmacf98 that there was an ongoing bug there. In this demo, an update from the frame builder, although confirmed, does not show a visual preview in its new position. Looking at the component edit tab shows a stale World Position that is only later updated. Not sure if this is because it is waiting for it to update from the network, or something else.
bug.mov
TODOs