-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Adds friction force reporting to ContactSensor #3563
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
source/isaaclab/isaaclab/sensors/contact_sensor/contact_sensor.py
Outdated
Show resolved
Hide resolved
source/isaaclab/isaaclab/sensors/contact_sensor/contact_sensor.py
Outdated
Show resolved
Hide resolved
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" |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Description
This PR extends the
ContactSensor
class to expose aggregated friction forces for each filtered body. It uses the same vectorized approach used forcontact_points
.Concretely, this change introduces:
ContactSensorCfg.track_friction_forces
toggle to turn on friction trackingContactSensorData.friction_forces_w
where the sum of friction forces for each filtered body are storedFixes
#2074
Performance
Results of
check_contact_sensor.py
withtrack_friction_data = False
:Results of
check_contact_sensor.py
withtrack_friction_data = True
:Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there