I want to detect contact/collision for a procedurally generated articulation. The implementation is like adding two additional rigid bodies and then creating RigidPrimView for them:
self.bar = RigidPrimView(
f"/World/envs/env_*/*/bar",
reset_xform_properties=False,
# track_contact_forces=True,
contact_filter_prim_paths_expr=[
"/World/envs/env_*/obstacle_0",
"/World/envs/env_*/obstacle_1"
]
)
self.bar.initialize()
self.obstacles = RigidPrimView(
"/World/envs/env_*/obstacle_*",
reset_xform_properties=False,
shape=[self.num_envs, -1],
# track_contact_forces=True
)
self.obstacles.initialize()
self.payload = RigidPrimView(
f"/World/envs/env_*/*/payload",
reset_xform_properties=False,
contact_filter_prim_paths_expr=[
"/World/envs/env_*/obstacle_0",
"/World/envs/env_*/obstacle_1"
]
)
self.payload.initialize()
The strange things happened:
- When I do
collision = (
self.bar
.get_net_contact_forces()
.any(-1, keepdim=True)
) | (
self.payload
.get_net_contact_forces()
.any(-1, keepdim=True)
)
it gives out CUDA errors like
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [2,0,0], thread: [98,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [13,0,0], thread: [73,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [14,0,0], thread: [73,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [2,0,0], thread: [12,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [15,0,0], thread: [99,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [15,0,0], thread: [76,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [12,0,0], thread: [46,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [8,0,0], thread: [2,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [12,0,0], thread: [86,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/ScatterGatherKernel.cu:144: operator(): block: [15,0,0], thread: [22,0,0] Assertion `idx_dim >= 0 && idx_dim < index_size && "index out of bounds"` failed.
after running for a short while.
- Only detecting collision for bars would have a significantly lower probability to get this error.
- The results given by ·RiginPrimView.get_net_contact_forces()
and
RigidPrimView.get_contact_force_matric()` do not seem to be consistent.
I wonder what is the reason and solution here. Is it because the articulation is procedurally generated? If this is currently not solvable, what alternatives do I have to perform efficient collision/contact detection in an RL setting?