Collider and Rigid_Body preset error (PhysicsUSD: Parse collision - triangle mesh collision)

Hello,
I tried to load a .usd file without rigid body preset in a scene to drop them in a box. When I load them in the mesh is really poor quality and not at all realistic, it just creates a box around my object. When I want to change the properties with “rep.physics.collider(approximation_shape = “meshSimplification”)” it gives me the error

PhysicsUSD: Parse collision - triangle mesh collision (approximation None/MeshSimplifixation) without SDF cannot be a part of a dynamic body, falling back to convexHull approximation:

I know it is like that because I also use

rep.physics.rigid_body(
                velocity= (0,0,-1)
                )

for my instances. Is there a possibility to use rigid_body and collider function for the same part, or any other possibility to give my imported parts a good collision mesh?

Code:

def env_props(size=50):
       

        # Define paths for the character, the props, the environment and the surface where the assets will be scattered in.
        instances = rep.randomizer.instantiate(rep.utils.get_usd_files(PROPS, recursive=True), size=size, mode='scene_instance')
        with instances:
            rep.modify.semantics([('class', 'ring')])
            rep.modify.pose(
                position=rep.distribution.uniform((-0.5, -0.5, 0.2), (0.5, 0.5, 0.3)),
                rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
                scale = 1
            )

            rep.physics.rigid_body(
                velocity= (0,0,-1)
                )
            rep.physics.collider(approximation_shape = "meshSimplification")
            rep.randomizer.materials(materials=materials_list)


            
        return instances.node

Thank you!

Dynamic rigid bodies cant contain triangle meshes, so meshSimplification that would produce a triangle mesh wont work with a dynamic body.
You can either:

  1. use convex decomposition as approximation - this will convex decomposition and simulation will run as a rigid body with many convexes
  2. use SDF collision approximation - this will run as a rigid body with a mesh using SDF collision.

I am not 100% sure how does one create this through the IsaacSim scripts, but you can select the collider and change its properties in the property window.

So you mean to edit the " rep.physics.collider(approximation_shape = “meshSimplification”)" command to " rep.physics.collider(approximation_shape = “convexDecomposition”)"?

I tried and it gives the same error message:

2023-02-28 14:31:37 [125,523ms] [Warning] [omni.physx.plugin] PhysicsUSD: Parse collision - triangle mesh collision (approximation None/MeshSimplifixation) without SDF cannot be a part of a dynamic body, falling back to convexHull approximation: /Replicator/SampledAssets/Population_8c7a9940/Ref_Xform_5. To enable SDF collisions, sdfResolution should be > 0.

If I edit it in the Property window it will simply change back to Triangle Mesh in the next iteration of Replicator and give the error message from above.

Hi Valentin,

You should be able to set it to a convex decomposition approximation using the command you provided (rep.physics.collider(approximation_shape = “convexDecomposition”) ). It is odd that it sees it as a triangle mesh simplification still. Can you try running a fresh boot of Kit with the convexDecomposition script to clear whatever was in the cache previously, and then see if it gets the same error?

If error is the same, can you send me some code i can paste in the script editor to repro it and try to identify if there is a bug?

Thanks,
Henry

Hello Henry,

The same error occurs even with a reboot of my computer and a fresh boot of ISAAC.
Since some of the parts I use are confidential, I edited the script a little bit so it uses ISAAC Props. It does not look exactly like my script, since I can’t use the original props of mine. With this script you will also get an error message

2023-03-01 08:07:22 [2,521,991ms] [Warning] [omni.physicsschema.plugin] RigidBodyAPI on an instance proxy not supported. /Replicator/SampledAssets/Population_0919d018/Ref_Xform_10/Ref/Cube

but just ignore this, this only happens because I couldn’t find a prop without Rigid Body assigned in the Nvidia folder. You will also get the error message I described in my previous posts.

import omni.replicator.core as rep
import omni.kit.viewport.utility as vp_utils
from omni.isaac.core.utils.stage import add_reference_to_stage, get_current_stage
from omni.isaac.core.utils.prims import create_prim, delete_prim, get_prim_at_path
from pxr import  Usd #UsdGeom, UsdShade, Gf, Sdf,
import numpy as np
from omni.isaac.core.utils.bounds import  create_bbox_cache, compute_aabb
import os

# Define paths for the character, the props, the environment and the surface where the assets will be scattered in.
BIN = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.0/Isaac/Props/KLT_Bin/small_KLT.usd"
PROPS = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.0/Isaac/Props/Blocks/basic_block.usd"

#Bin platzieren
def bin_place():
    bin = rep.create.from_usd(BIN, semantics=[('class', 'bin')])
    with bin:
        rep.modify.pose(
            position=rep.distribution.uniform((-.02, -.02, 0.4), (.02, .02, 0.4)),
            rotation=rep.distribution.uniform((0,0,-10), (0, 0, 10)),
            scale= 1
        )
        rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (0.002, 0.002, 0.002)))
        #rep.randomizer.texture(textures=["omniverse://localhost/NVIDIA/Materials/vMaterials_2/Plastic/textures/pcb_solder_mask_rough.jpg"])
        rep.physics.collider(approximation_shape = "meshSimplification")
        return bin.node
rep.randomizer.register(bin_place)


def bbox_bin():
    cache = create_bbox_cache()
    bin_prim_path = "/Replicator/Ref_Xform"
    bbox = compute_aabb(cache,bin_prim_path,include_children=True)
    print(bbox)


# Drop Parts
def env_props(size=50):
    instances = rep.randomizer.instantiate(rep.utils.get_usd_files(PROPS, recursive=True), size=size, mode='scene_instance')
    with instances:
        rep.modify.semantics([('class', 'ring')])
        rep.modify.pose(
            position=rep.distribution.uniform((-0.3, -0.2, 0.3), (0.3, 0.2, 0.4)),
            rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
            scale = 1
        )
        rep.physics.rigid_body(
            velocity= (0,0,-1)
            )
        rep.physics.collider(approximation_shape = "convexDecomposition")
    return instances.node

# Register randomization
rep.randomizer.register(env_props)

# Setup the static elements
surface = rep.create.plane(
    position = (0,0,0),
    scale = (200,200,1),
    rotation = (0,0,0)
)
with surface:
    rep.physics.collider()

# Setup camera and attach it to render product
camera = rep.create.camera(
    look_at=surface,
    position=(2,2,1)
)
render_product = rep.create.render_product(camera, resolution=(1024, 1024))
#TODO 
# Kamera mittig über Kiste spawnen und Position leicht variieren (dafür BBOX notwendig)


#Set Viewport
cam = "/Replicator/Camera_Xform/Camera"
viewport_window = vp_utils.get_active_viewport_window()
viewport_window.viewport_api.set_active_camera(cam)

# sphere lights for extra randomization
def sphere_lights(num):
    lights = rep.create.light(
        light_type="Sphere",
        temperature=rep.distribution.normal(6500, 500),
        intensity=rep.distribution.normal(35000, 5000),
        position=rep.distribution.uniform((-300, -300, -300), (300, 300, 300)),
        scale=rep.distribution.uniform(50, 100),
        count=num
    )
    return lights.node
rep.randomizer.register(sphere_lights)


# Trigger on time
with rep.trigger.on_time(interval= 8, num=2):
    rep.randomizer.bin_place()
    rep.randomizer.env_props(10)
    rep.randomizer.sphere_lights(10)
    bbox_bin()
    


# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize( output_dir="_output_physics10", rgb=True,   bounding_box_2d_tight=True)
writer.attach([render_product])

Fun fact: I also get these error messages when I use the offline_pose_generation.py script in “isaac_sim-2022.2.0\standalone_examples\replicator\offline_pose_generation”. So this seems to be a bug of some sort?

OK - I tried your script in the script editor but I don’t get the same problem. It creates the bin using bin_place and assigns it a triangle meshSimplification collider like you specified, but it’s not making env_props or producing any error. Was there anything else you did besides clicking run on the script?

Yes, I did start the replicator in the UI. That’s when the env_props are spawning and the error occurs.

Ah - i clicked start and it created the basic blocks. It looks like they are convexDecompositions on my end though - and I don’t see your error with meshSimplification.


I wonder if this is because I’m running Isaac Sim 2022.2.1 and you seem to have 2022.2.0? Let me know if you think that’s the issue and I’ll download the older one and try to repro.

Maybe that’s the reason. I actually thought there was something wrong with my isaac installation and reinstalled isaac, but the error did not change. Is the 2022.2.1 public yet? Then I will check if the error occurs with the new version tomorrow morning.

OK - I’m installing the production 2022.2.0 now. You may not have access to the version I was on before. But if i get your error on the production branch … then yes it would seem to be a version issue where the latest is fixed, and I will see what I can do to you get a workaround.

Indeed, I can repro your error on the production branch 2022.2.0. So it seems there has been a fix for this I just need to figure out where it is. Will get back to you soon.

@valentinhendrik 2022.2.1 will be released next week. Can you wait for that?

Sure! I am excited for the new features/bugfixes and glad that my code wasn’t the problem after all. Thank you anyways for the kind support.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.