How to detect any collisions during navigation

I’m trying to detect if any collision happens during navigation task for multi robots with standalone python script. I found it can be done with either contact sensor or rigid contact view.

Now I’m trying to implement with rigid contact view. I want to detect any collision happens with my robot. So I’m setting the view like this:

rigid_prim_view = RigidPrimView(
    prim_paths_expr="/World/Nova_Carter_ROS_[1-3]/chassis_link",
    track_contact_forces=True,
    contact_filter_prim_paths_expr=["/World/*"],
    max_contact_count=3 * 5,
)

And I got:

2024-12-17 10:06:49 [49,869ms] [Error] [omni.physx.tensors.plugin] Filter pattern '/World/*' did not match the correct number of entries (expected 3, found 8)

Does it mean that contact prim view can only detect collision when the number of object in contact_filter_prim_paths_expr equals the number of object in prim_paths_expr? If that so, I should choose to add a contact sensor for every robot to detect any collision? Is that the best way?

Isaac Sim Version

4.2.0

Operating System

Ubuntu 24.04

GPU Information

  • Model: RTX3090
  • Driver Version: 560.35.03

One way to detect contact between a body of your robot with other world objects is to use the get_net_contact_force which will be non-zero if there is any contact. However, this doesn’t work for wheels and objects that have contacts with the ground at all times.
rigidContactView objects are meant to be used more for tensorized use cases. So if you want to use it for contact-with-any-object purposes you will need to include those prims in the filter prim expression.
Lastly, there is a one-to-one relationship between filter_prim and prim_paths, meaning if you include three objects in your prim_path_expression you must ensure the filter_prim expression also picks up three prims. (you can include a list of expression, or list of prims to make it easier to build the object). See the API documentation of omni.physics.tensors (python/api.py) for more example use cases and tests.