Convert .obj mesh to usd with colliders

Dear Support Team,

I am currently in the process of migrating a robotic assembly benchmark from Isaac Gym to Omniverse with Orbit. While I have successfully converted the meshes from OBJ to USD format utilizing the asset_usd_converter.py script, I have encountered an issue related to the absence of colliders.

Although the Omniverse GUI allows me to manually add SDF colliders, this approach is not feasible given the scale of the project, which involves processing over 10,000 meshes. Consequently, I am exploring options for automating this collider addition process via Python scripts.

Would you be able to provide guidance or code examples on how this can be achieved programmatically? E.g., add colliders, mass, inertial. Your expertise in this matter would be greatly appreciated.

Thank you for your time and assistance.

Yes, this is absolutely possible, physics is defined through UsdPhysics schema:
https://openusd.org/dev/api/usd_physics_page_front.html

There are also these concepts explained and show how to apply it through python in omni.physx documentation:
http://omniverse-docs.s3-website-us-east-1.amazonaws.com/omni_physics/105.0/source/extensions/omni.physx/docs/index.html#working-with-physics

So let me add few snippets that should help:
Apply rigid body:

UsdPhysics.RigidBodyAPI.Apply(rigidPrim)

Apply SDF collision:

        meshcollisionAPI = UsdPhysics.MeshCollisionAPI.Apply(prim)
        sdf_api = PhysxSchema.PhysxSDFMeshCollisionAPI.Apply(prim)
        meshcollisionAPI.CreateApproximationAttr().Set("sdf")

Apply mass:

    massAPI = UsdPhysics.MassAPI.Apply(rbPrim)
    massAPI.CreateMassAttr().Set(mass)

Regards,
Ales

Hi Ales,

Thanks a lot for the examples! I’ll try them ASAP and share to code/results here.

Best,
Xinghao