Skip to content

[BugFix] fix bug of joint relationship process in USDAsset._as_trimesh_scene() #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kobayashi-z
Copy link

Why

Previously, joints were being processed twice due to USD's bidirectional nature, causing incorrect hierarchy issues. This fix ensures consistent scene graph construction. So I skip processing when encountering the reversed entry
USD joints are bidirectional (A-B is same as B-A).

                joints[(body_0, body_1)] = joint_prim

                joints[(body_1, body_0)] = "reversed"

here

@clemense
Copy link
Collaborator

Do you have an example USD file that fails, and for which this change improves things? I'm getting errors with some test file imports due to this change.

@clemense
Copy link
Collaborator

Just to be clear joints are not being processed twice currently.

@Kobayashi-z
Copy link
Author

Kobayashi-z commented Apr 9, 2025

Thanks for your response. You can test with the USD file in the attachment (note: you'll need to rename the file extension to .usd). I encountered an error when running the following code.

import scene_synthesizer
from scene_synthesizer.assets import USDAsset
scene = scene_synthesizer.Scene()
asset = USDAsset("FoodMixer.usd")
scene.add_object(asset, "foodmixer")

The traceback is below

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xiaolin.zhou/code/scene_synthesizer/src/scene_synthesizer/scene.py", line 1388, in add_object
    scene_to_add = asset.as_trimesh_scene(
  File "/home/xiaolin.zhou/code/scene_synthesizer/src/scene_synthesizer/assets.py", line 648, in as_trimesh_scene
    trimesh_scene = self._as_trimesh_scene(
  File "/home/xiaolin.zhou/code/scene_synthesizer/src/scene_synthesizer/assets.py", line 1195, in _as_trimesh_scene
    raise ValueError("Can't parse USD. Tree structure incorrect.")
ValueError: Can't parse USD. Tree structure incorrect.

FoodMixer.txt

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.

3 participants