Hello team,
I am running robotic simulations with YCB objects placed on a table (see attached image below). I spawn all the objects at appropriate locations in the scene using Isaac’s bounding box computations and use the contact sensor to detect collisions between the robot and objects.
Previously, I have been running the simulations (for reinforcement learning) in Isaac Sim 2021.1.1 and I have recently been porting everything to Isaac Sim 2022.1.0. I am now using all the new APIs and am using the same setup as OmniIsaacGymEnvs [https://OmniIsaacGymEnvs)GitHub - NVIDIA-Omniverse/OmniIsaacGymEnvs: Reinforcement Learning Environments for Omniverse Isaac Gym]. However, I’m having difficulty working with the collision objects in the world in the new Isaac 2022…
-
Firstly, I don’t yet understand the correct usage of RigidPrims and GeometryPrims. It would seem that GeometryPrims are for ‘static’ objects that have a geometry defined (with or without collisions), while RigidPrims are for ‘dynamic’ objects (with or without collisions). However, the examples with dynamic objects have BOTH Rigid and Geometry Prim properties applied to them (For eg. omni.isaac.core.objects.DynamicCuboid). Why do I need both of these properties?
-
I can make do with just ‘static’ objects in the scene for now. Using just the GeometryPrim class works fine for the most part. However, the contact sensor does not work with only the GeometryPrim property…
I use the following code snippet:
from omni.isaac.core.prims.geometry_prim import GeometryPrim
import torch
add_reference_to_stage(object_usd_path, prim_path + "/obstacle/" + name)
obj = GeometryPrim(
prim_path=prim_path + "/obstacle/" + name,
name=name,
position= torch.tensor([0.0, 0.0, 0.0], device=device),
orientation= torch.tensor([0.707106, 0.707106, 0.0, 0.0], device=device),
scale=[0.01,0.01,0.01], # Has to be scaled down to metres. Default usd units for these objects is cms
collision=True
)
# Enable tight collision approximation
obj.set_collision_approximation("convexDecomposition")
I checked and the CollisionAPI is definitely applied to the prim so this lack of contact sensing is strange. I also verified this with the contact sensor example (isaac_sim-2022.1.0/standalone_examples/api/omni.isaac.ros_bridge/contact.py). If you use a ‘FixedCuboid’ instead of a ‘DynamicCuboid’ and place it on the ground, contacts with the ground are not detected…
- I am now using applying both Rigid and Geometry Prim properties to my objects and am able to move them and detect contacts:
from omni.isaac.core.prims.geometry_prim import GeometryPrim
from omni.isaac.core.prims.rigid_prim import RigidPrim
import torch
add_reference_to_stage(object_usd_path, prim_path + "/obstacle/" + name)
obj = GeometryPrim(
prim_path=prim_path + "/obstacle/" + name,
name=name,
position= torch.tensor([0.0, 0.0, 0.0], device=device),
orientation= torch.tensor([0.707106, 0.707106, 0.0, 0.0], device=device),
scale=[0.01,0.01,0.01], # Has to be scaled down to metres. Default usd units for these objects is cms
collision=True
)
# Enable tight collision approximation
obj.set_collision_approximation("convexDecomposition")
RigidPrim.__init__(
obj,
prim_path=prim_path + "/obstacle/" + name,
name=obj.name,
position= torch.tensor([0.0, 0.0, 0.0], device=device),
orientation= torch.tensor([0.707106, 0.707106, 0.0, 0.0], device=device),
scale=[0.01,0.01,0.01], # Has to be scaled down to metres. Default usd units for these objects is cms
)
However, whenever I move the object using obj.set_world_pose(orientation=torch.tensor([0.707106, 0.707106, 0.0, 0.0], device=device))
, it successfully moves the object to the correct position/orientation but shows the error on the command line: "PhysX error: PxRigidDynamic::setGlobalPose: pose is not valid. /source/physx/src/NpRigidDynamic.cpp, LINE 85"
. This only happens when the RigidPrim class is also applied to the object. It does not happen when only the GeometryPrim class is applied to the object. What is the reason for this error? And if it can be ignored, how can I suppress it?
Regards,
Snehal Jauhri