I designed a box and an object in SolidWorks and saved them as .STEP files. After converting them to .usd files in Isaac Sim and using a Script Node to load the box and object during playback, I noticed that the box’s opening seems blocked, preventing the object from entering. How should I modify my code so that the box’s opening allows the object to enter while maintaining rigid body properties so that it can be picked up by a gripper?
My Python script is as follows:
import omni.kit.commands
import omni.kit.tool.asset_importer as ai
import omni.usd
from omni.isaac.core.utils.prims import create_prim
from omni.physx.scripts.utils import setRigidBody
from pxr import UsdGeom, Gf, PhysxSchema
def setup(db):
state = db.per_instance_state
state.cube_count = 0
def compute(db):
state = db.per_instance_state
state.cube_count += 1
if state.cube_count == 1:
stage = omni.usd.get_context().get_stage()
name= '/World/Box'
newPrim = stage.DefinePrim(name, "Xform")
newPrim.GetReferences().AddReference("/home/user/Downloads/Box.usd")
xform_api = UsdGeom.XformCommonAPI(newPrim)
position = (-0.16383, -0.46536, 0.32685)
scale = (0.001, 0.001, 0.001)
xform_api.SetTranslate(position)
xform_api.SetScale(scale)
prim = omni.usd.get_context().get_stage().GetPrimAtPath(name)
setRigidBody(prim, 'convexHukll', False)
name= '/World/Product_01'
newPrim = stage.DefinePrim(name, "Xform")
newPrim.GetReferences().AddReference("/home/user/Downloads/Product_SW.usd")
xform_api = UsdGeom.XformCommonAPI(newPrim)
position = (-0.16383, -0.46536, 0.82685)
scale = (0.001, 0.001, 0.001)
xform_api.SetTranslate(position)
xform_api.SetScale(scale)
prim = omni.usd.get_context().get_stage().GetPrimAtPath(name)
setRigidBody(prim, 'convexHukll', False)
Isaac Sim Version : 4.2.0
Operating System : Ubuntu 22.04
GPU Information
- Model: RTX 4080
- Driver Version: 550.107.2