Using Isaac Sim 2022.2.1, I am just trying to get contact forces to check for collision. The asset that I am trying to check for contact forces is MyAsset.usd and has the following tree. It represents a gate that helps products to enter a room (from a belt-conveyor) by using guides (like a “V” shape where the open part is outside the room), called rails. Because other parts of the gate are not of interest, I only kept the rails.
Both the RailfLeft and RailfRight Xforms have Physics as shown in the figure below. The EntryGate and the BaseLink do not.
I import this asset using the following Python commands
prim_utils.create_prim(
prim_path='/World/EntryGate_0',
usd_path= ASSET_PATH + '/MyAsset.usd'
)
I then clone them and set up a RigidPrimView for one of the Rails, which is a rigid body.
cloner = GridCloner(spacing=8.0)
cloner.define_base_env("/World/Env")
view_gate = RigidPrimView(
prim_paths_expr="/World/Env/EntryGate_*/RailLeft",
name="railf_left_view",
reset_xform_properties=False,
track_contact_forces=True,
prepare_contact_sensors=True,
)
view_gate.initialize()
view_gate.post_reset()
Later, I try to get the contact forces to check for collision with
view_gate.get_net_contact_forces()
However, it ALWAYS returns zeros, even when I am seeing them colliding in the simulation. All collisions work, but the report of contact forces does not.
I tried setting up the collision and rigid body APIs on it, but I wasn’t successful.
prim = prim_utils.get_prim_at_path('/World/Env/EntryGate_0/RailLeft')
UsdPhysics.RigidBodyAPI.Apply(prim)
UsdPhysics.CollisionAPI.Apply(prim)
Can you explain all the requirements for the get_net_contact_forces()
to work? It seems that just doing the obvious is not enough.