Skip to content

Conversation

gattra-rai
Copy link

@gattra-rai gattra-rai commented Sep 25, 2025

Description

This PR extends the ContactSensor class to expose aggregated friction forces for each filtered body. It uses the same vectorized approach used for contact_points.

Concretely, this change introduces:

  • ContactSensorCfg.track_friction_forces toggle to turn on friction tracking
  • ContactSensorData.friction_forces_w where the sum of friction forces for each filtered body are stored

Fixes

#2074

Performance

Results of check_contact_sensor.py with track_friction_data = False:

avg dt real-time 0.017448579105403043
avg dt real-time 0.017589360827958443
avg dt real-time 0.016146250123070787

Results of check_contact_sensor.py with track_friction_data = True:

avg dt real-time 0.01818224351439858
avg dt real-time 0.017720674386015163
avg dt real-time 0.01777262271923246

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions bot added the isaac-lab Related to Isaac Lab team label Sep 25, 2025
@gattra-rai gattra-rai marked this pull request as ready for review September 26, 2025 13:44
Copy link
Collaborator

@jtigue-bdai jtigue-bdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good just some docstring stuff and a slight augmentation of the test. Thanks @gattra-rai

friction_force = scene["contact_sensor"]._data.friction_forces_w[0, 0, :]
friction_magnitude = friction_force.norm().item()

assert friction_magnitude > 1e-2, "Friction forces should be non-zero"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the mass of this prim using the scene["shape"].root_physx_view.set_masses() and then have a tighter value for this magnitude assert? (mostly a canary if default values for things change)

Copy link
Author

@gattra-rai gattra-rai Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can expand on what i attempted but i was unable to reproduce the friction forces returned by the physx api within my test.

so instead of validating that the magnitude of the reported friction matches some expected friction force, i decided to instead trust that the underlying physx api is returning correct friction force values and added a test to ensure those values matched what the ContactSensor was reporting after unpacking.

i think this is sufficient as this test should only test that our packing code is correct, and not also test the physx api friction code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
isaac-lab Related to Isaac Lab team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Contact Sensor force not showing x,y directional force
2 participants