Skip to content

assign 3d models current after all clients resolve#678

Merged
mattmacf98 merged 2 commits into
mainfrom
FIX-multi-3d-arm-viz
May 14, 2026
Merged

assign 3d models current after all clients resolve#678
mattmacf98 merged 2 commits into
mainfrom
FIX-multi-3d-arm-viz

Conversation

@mattmacf98
Copy link
Copy Markdown
Member

Description

in this thread https://viaminc.slack.com/archives/C071CRAU7EJ/p1778765771671389

we saw issue when visualizing multiple 3d models for different resources in the same scene, I was setting current in the inner loop so it would update for the first arm but just add more keys on subsequent sets (which svelte was not reactive to since it is a state.raw). This worked fine on other real arms since the geometry labels are set by the module (so base_top is always xarm:base_top for all arms) the fake and simulated change the label prefix to match the frame e.x. arm1:base_top and arm2:base_top

This PR sets current outside of the loop after the full object is accumulated

Testing

  • tested on Brandon's example with sim arms
Screenshot 2026-05-14 at 2 56 01 PM - tested on a real robot with 2 arms Screenshot 2026-05-14 at 2 58 35 PM

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

🦋 Changeset detected

Latest commit: 4aca432

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

This PR includes changesets to release 1 package
Name Type
@viamrobotics/motion-tools Patch

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

}
const geometryLabel = geometries[0].label
const prefix = geometryLabel.split(':')[0]
const models = await client.current.get3DModels()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we get to. point where we have tons of different 3d models in the scene at once, we could parallelize these calls with promise.all, seemed pre-mature to do in this pr

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even better, it would be nice to know if we already fetched the arm for a matching model and just use local cache

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-14 20:14 UTC

@mattmacf98 mattmacf98 merged commit cc409c0 into main May 14, 2026
12 checks passed
@mattmacf98 mattmacf98 deleted the FIX-multi-3d-arm-viz branch May 14, 2026 20:14
@claude claude Bot mentioned this pull request May 14, 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