Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] filter_prim_paths_expr in contact sensor not working #828

Open
supersglzc opened this issue Aug 14, 2024 · 3 comments
Open
Assignees
Labels
question Further information is requested

Comments

@supersglzc
Copy link

Describe the bug

I recently updated my IsaacSim to 4.1.0 and pulled the newest IsaacLab. However, when I run add_sensors_on_robot.py, it gives the following warning:

[Warning] [omni.usd] Warning (secondary thread): in GetInstanceIndices at line 2190 of /buildAgent/work/ac88d7d902b57417/USD/pxr/usdImaging/usdImaging/pointInstancerAdapter.cpp -- ProtoIndex 1 out of bounds (prototypes size = 1) for (/Visuals/ContactSensor, /Visuals/ContactSensor.proto1_mesh_id0)

[Warning] [omni.usd] Warning (secondary thread): in GetInstanceIndices at line 3256 of /buildAgent/work/ac88d7d902b57417/USD/pxr/usdImaging/usdImaging/delegate.cpp -- Empty InstanceIndices (/Visuals/ContactSensor, /Visuals/ContactSensor.proto1_mesh_id0)

I also tested filter_prim_paths_expr, but seems like the filtering does not work as expected. I modified the contact sensor cfg to

contact_forces = ContactSensorCfg(
        prim_path="{ENV_REGEX_NS}/Robot/LF_FOOT", update_period=0.0, history_length=6, debug_vis=True, track_air_time=True, filter_prim_paths_expr=["{ENV_REGEX_NS}/Robot/RF_FOOT"]
    )

This only uses one prim and one filter prim. I suppose this cfg means that we only want to detect the contact between LF_Foot and RF_Foot. However, the sensor still detects the contact between the LF_Foot and the ground plane.

I am wondering if I misunderstand something or this is actually a bug.

@Mayankm96
Copy link
Contributor

Mayankm96 commented Aug 15, 2024

Are you using the right attribute? The net_forces_w reports you still the total net normal force. The filtered forces are in a separate attribute force_matrix_w. Please check the documentation below.

https://isaac-sim.github.io/IsaacLab/source/api/lab/omni.isaac.lab.sensors.html#omni.isaac.lab.sensors.ContactSensorData.force_matrix_w

@Mayankm96 Mayankm96 added the question Further information is requested label Aug 15, 2024
@Mayankm96 Mayankm96 self-assigned this Aug 15, 2024
@supersglzc
Copy link
Author

supersglzc commented Aug 15, 2024

I used the current_air_time to detect if there is a contact. I found that this was computed by net_forces_w so that's why it didn't work. Now I changed to manually compute the norm using force_matrix_w.

Also, do you have any idea why the warning pops up? The warning is not there if I don't use filter_prim_paths_expr.

@supersglzc
Copy link
Author

Follow-up: I occasionally encountered this error on some usd objects. Basically the net_force is not zero but the force_matrix is always zero. I converted the usd from urdfs. Thanks! @Mayankm96
[Warning] [omni.physx.tensors.plugin] GPU contact filter for collider '/World/envs/env_3853/Object_0' is not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants