Help with RigidContactView Implementation in Isaac Sim

Hi everyone, I’m working on an application using Isaac Sim to extract all physical data from the simulation. Based on this documentation, I implemented RigidContactView to capture contact forces, but I’m encountering issues and it doesn’t seem to be working. You can see the problem in this video:

Here is the error:

Opening usd file at  /home/giangnguyen/test/tiago_dual_in_dlr_kitchen.usda  ...Done.
[18.209s] app ready
[20.633s] Simulation App Startup Complete
Loading stage...
Loading Complete
2024-10-20 17:39:17 [20,729ms] [Warning] [omni.usd] Coding Error: in AddXformOp at line 208 of /builds/omniverse/usd-ci/USD/pxr/usd/usdGeom/xformable.cpp -- XformOp </tiago_dual/tiago_dual.xformOp:translate> has typeName 'double3' which does not match the requested precision 'PrecisionFloat'. Proceeding to use existing typeName / precision.

2024-10-20 17:39:17 [20,729ms] [Warning] [omni.usd] Coding Error: in AddXformOp at line 208 of /builds/omniverse/usd-ci/USD/pxr/usd/usdGeom/xformable.cpp -- XformOp </tiago_dual/tiago_dual.xformOp:orient> has typeName 'quatd' which does not match the requested precision 'PrecisionFloat'. Proceeding to use existing typeName / precision.

2024-10-20 17:39:17 [20,734ms] [Warning] [omni.usd] Coding Error: in AddXformOp at line 208 of /builds/omniverse/usd-ci/USD/pxr/usd/usdGeom/xformable.cpp -- XformOp </milk_box/milk_box.xformOp:translate> has typeName 'double3' which does not match the requested precision 'PrecisionFloat'. Proceeding to use existing typeName / precision.

2024-10-20 17:39:17 [20,734ms] [Warning] [omni.usd] Coding Error: in AddXformOp at line 208 of /builds/omniverse/usd-ci/USD/pxr/usd/usdGeom/xformable.cpp -- XformOp </milk_box/milk_box.xformOp:orient> has typeName 'quatd' which does not match the requested precision 'PrecisionFloat'. Proceeding to use existing typeName / precision.

2024-10-20 17:39:18 [20,975ms] [Warning] [carb] Client omni.stageupdate.plugin has acquired [omni::hydra::IOmniHydra v2.0] 100 times. Consider accessing this interface with carb::getCachedInterface() (Performance warning)
2024-10-20 17:39:18 [21,190ms] [Error] [omni.physx.tensors.plugin] Size of the filter pattern list must match the size of the sensor pattern list
2024-10-20 17:39:18 [21,190ms] [Error] [omni.physx.tensors.plugin] Provided patterns for sensor and filters did not match any rigid contact entries

Traceback (most recent call last):
  File "/home/giangnguyen/test/test.py", line 48, in <module>
    body_contact_prim_view.initialize(simulation_context.physics_sim_view)
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/prims/rigid_contact_view.py", line 239, in initialize
    self._num_shapes = self._physics_view.sensor_count
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/extsPhysics/omni.physics.tensors/omni/physics/tensors/impl/api.py", line 1413, in sensor_count
    return self._backend.sensor_count
AttributeError: 'NoneType' object has no attribute 'sensor_count'
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Annotators' for removal
2024-10-20 17:39:18 [21,210ms] [Warning] [omni.graph.core.plugin] Could not find category 'Replicator:Core' for removal
2024-10-20 17:39:18 [21,264ms] [Warning] [carb] Recursive unloadAllPlugins() detected!

Here is the code to reproduce:
test.zip (5.2 MB)

To reproduce, just command:

~/.local/share/ov/pkg/isaac-sim-4.2.0/python.sh test.py

Let me know how to fix this error and any optimizations I should consider to avoid further issues.

I’ve encountered another issue with RigidPrimView. After following this example, I tried changing the prim_paths_expr to a list of prims, but it doesn’t work. Below is the code I used to reproduce the problem:

import asyncio
import numpy as np
from omni.isaac.core.world import World
from omni.isaac.core.prims import RigidPrimView
from omni.isaac.core.objects import DynamicCuboid

async def example():
    if World.instance():
        World.instance().clear_instance()
    world = World()
    await world.initialize_simulation_context_async()
    world.scene.add_default_ground_plane(z_position=-1.0)

    # Create rigid cubes
    for i in range(3):
        DynamicCuboid(prim_path=f"/World/cube_{i}")

    # Create the view object to batch manipulate the cubes
    rigid_prim_view = RigidPrimView(prim_paths_expr=["/World/cube_0", "/World/cube_1"], track_contact_forces=True)
    world.scene.add(rigid_prim_view)
    await world.reset_async()

    print(rigid_prim_view.get_net_contact_forces())

asyncio.ensure_future(example())

When running this code, I encountered the following error:

2024-10-21 11:37:15 [290,805ms] [Error] [omni.physx.tensors.plugin] Size of the filter pattern list must match the size of the sensor pattern list
2024-10-21 11:37:15 [290,805ms] [Error] [omni.physx.tensors.plugin] Provided patterns for sensor and filters did not match any rigid contact entries

2024-10-21 11:37:15 [290,806ms] [Error] [asyncio] Task exception was never retrieved
future: <Task finished name='Task-7156' coro=<example() done, defined at /tmp/carb.O5f6Q6/script_1729510634.py:7> exception=AttributeError("'NoneType' object has no attribute 'sensor_count'")>
Traceback (most recent call last):
  File "/tmp/carb.O5f6Q6/script_1729510634.py", line 21, in example
    await world.reset_async()
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/world/world.py", line 501, in reset_async
    await self.reset_async_no_set_up_scene(soft=soft)
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/world/world.py", line 462, in reset_async_no_set_up_scene
    self._scene._finalize(self.physics_sim_view)
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/scenes/scene.py", line 375, in _finalize
    rigid_prim_view.initialize(physics_sim_view)
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/prims/rigid_prim_view.py", line 279, in initialize
    self._contact_view.initialize(self._physics_sim_view)
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.core/omni/isaac/core/prims/rigid_contact_view.py", line 239, in initialize
    self._num_shapes = self._physics_view.sensor_count
  File "/home/giangnguyen/.local/share/ov/pkg/isaac-sim-4.2.0/extsPhysics/omni.physics.tensors/omni/physics/tensors/impl/api.py", line 1413, in sensor_count
    return self._backend.sensor_count
AttributeError: 'NoneType' object has no attribute 'sensor_count'

Any insights on how to resolve this error would be greatly appreciated!"

Hi hoanggiang
Try this
filter_paths_expr=[body_paths for i in range(len(body_paths))]
for your filter paths;
the reason is that when you provide a list of patterns (not paths) then you must provide a list of list of filter patterns; each list indicates the filter list for each sensor pattern and they should have the same size for all sensors given that this is how we can tensorize the data most effectively

Thank you, I just figured it out as well. It might be better if this behavior was set as the default.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.