Repository navigation
Adds friction force reporting to ContactSensor - #3563
Conversation
jtigue-bdai
left a comment
There was a problem hiding this comment.
Looks good just some docstring stuff and a slight augmentation of the test. Thanks @gattra-rai
ooctipus
left a comment
There was a problem hiding this comment.
LGTM, I like how you refactor and docstring the unpack
|
I am curious how do you use the friction force for your learning setup, would love to learn how you guys are using it : )) |
a08d71c to
1fbdb77
Compare
| * If the :attr:`ContactSensorCfg.track_friction_forces` is False, then this quantity is None. | ||
| * If the :attr:`ContactSensorCfg.filter_prim_paths_expr` is empty, then this quantity is an empty tensor. | ||
| * If the :attr:`ContactSensorCfg.max_contact_data_per_prim` is not specified or less than 1, then this quantity | ||
| will not be calculated. |
There was a problem hiding this comment.
These three conditions are mentioned but in the code, the checks are only performed when track_friction_forces are provided. Is this intentional? Do we handle the cases where the configuration is provided incorrectly?
There was a problem hiding this comment.
Also this is not the net contact forces, right? Just making sure.
There was a problem hiding this comment.
i've added a validation check per gremlin's recommendation, in which a value error is raised if track_friction_forces = True but either filter_prim_paths_expr = None | [] or max_contact_data_per_prim = None | < 1
There was a problem hiding this comment.
and yes this is not the net contact forces
| expected_friction, _, _, _ = scene["contact_sensor"].contact_physx_view.get_friction_data(dt=sim_dt) | ||
| reported_friction = scene["contact_sensor"].data.friction_forces_w[0, 0, :] |
There was a problem hiding this comment.
I think instead of comparing the two to the same PhysX buffers, it would make more sense to compare the physical realism of this. For example, if the cube is on a ground with friction of coefficient as 1 and we add a push velocity, then the friction force is mu * Mg.
There was a problem hiding this comment.
my thinking was that we shouldn't be testing the underlying functionality of the physx API, and instead just test that the friction force reporting code is doing what is intended, which is to provide the unpacked friction tensor from the physx view
There was a problem hiding this comment.
it would also require reverse engineering the physx friction force implementation, which could change and break the test, despite the code under test not being broken
|
@greptileai some help ;) |
There was a problem hiding this comment.
I'd be happy to help! Could you please clarify what you need assistance with regarding this PR?
For example, are you asking about:
- How the friction force tracking implementation works?
- Understanding specific parts of the code changes?
- Testing the new feature?
- Integration with existing code?
- Performance considerations?
- Something else entirely?
Let me know what specific aspect you'd like me to explain or help with! 😊
|
@greptileai everything you said. Whatever it takes to improve the MR and make it less error-prone and feature complete :) |
0fcc821 to
bdbb347
Compare
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Signed-off-by: Kelly Guo <kellyg@nvidia.com>
# 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`](isaac-sim#2842). 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 isaac-sim#2074, isaac-sim#2064 ## 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 - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
# 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`](isaac-sim#2842). 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 isaac-sim#2074, isaac-sim#2064 ## 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 - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
# 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`](isaac-sim#2842). 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 isaac-sim#2074, isaac-sim#2064 ## 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 - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
# 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`](isaac-sim#2842). 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 isaac-sim#2074, isaac-sim#2064 ## 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 - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
Description
This PR extends the
ContactSensorclass 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_forcestoggle to turn on friction trackingContactSensorData.friction_forces_wwhere the sum of friction forces for each filtered body are storedFixes #2074, #2064
Performance
Results of
check_contact_sensor.pywithtrack_friction_data = False:Results of
check_contact_sensor.pywithtrack_friction_data = True:Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there