[Question] How to set the 'filter_prim_paths_expr' attribute for ContactSensors correctly? #4357
Replies: 1 comment
-
|
Thank you for posting this.You’re hitting that error because the PhysX tensor contact filter expects a fixed, known number of rigid bodies for each filter pattern at sensor creation time, and your regex does not resolve to any rigid body prims (or resolves to a different number than expected) in the current stage layout.12 What the error actually meansThe message
comes from the GPU contact filtering backend in It means:
This typically happens if:
Why your patterns fail with procedural terrainWith procedurally generated train/eval terrains:
On top of that, the filter works on rigid bodies, not arbitrary prims; if your terrain is not a How to make it work and get friction forces into observationsTo reliably get friction forces from the contact sensor, you need to ensure that:
from isaaclab.sensors import ContactSensorCfg
contact_sensor = ContactSensorCfg(
prim_path="{ENV_REGEX_NS}/Robot/LF_FOOT",
update_period=0.0,
history_length=6,
debug_vis=False,
track_friction_forces=True,
filter_prim_paths_expr=["{ENV_REGEX_NS}/ground/.*/mesh"],
)
A minimal observation snippet after the commit you referenced would look like: # assuming you added the sensor to the scene with name "contact_forces"
contact_data = scene["contact_forces"].data # ContactSensorData
# latest net friction forces (no filtering, summed over contacts at each body)
friction_latest = contact_data.friction_forces_w # (N, B, 3)
# if you enabled history_length > 0, you can use:
friction_hist = contact_data.friction_forces_w_history # (N, T, B, 3)
# e.g. flatten per-env friction for observations
obs["friction_forces"] = friction_latest.reshape(friction_latest.shape[0], -1)This may vary eventually depending on the contact sensor data structure from that commit.45
Footnotes
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Cheers,
I just saw the commit #3563 here and wanted to include the friction forces in my observation space. However, I get the following error:
2026-01-08T16:01:08Z [25,224ms] [Error] [omni.physx.tensors.plugin] Filter pattern '/World/ground/*/mesh' did not match the correct number of entries (expected 118784, found 0)I generate different terrain for training and evaluation, and name those accordingly. Using the regex expression
filter_prim_paths_expr=["/World/ground/.*/mesh"]results in the aforementioned error. Explicitly setting the value to e.g./World/ground/train/meshdoes result in a similar error with changed filter pattern string. (I tried close to any string combination, omitting parts)Here an image of my stage entities:

Anyone here that could help me out and explain why I'm not able to acquire the friction forces using the used expressions? I'm a bit lost and not sure where I could further dig into and resolve the issue myself.
Thanks!!!
Best Janosch
Beta Was this translation helpful? Give feedback.
All reactions