Repository navigation
Fixes mesh converter not setting mesh collision approximation attribute - #4082
Conversation
Greptile OverviewGreptile SummaryThis PR fixes a critical bug where mesh collision approximation attributes were not being set on USD prims during mesh conversion. The fix ensures that collision approximation tokens (convex decomposition, triangle mesh, SDF, etc.) are properly applied to mesh collision APIs. Key changes:
The implementation correctly uses Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant MeshConverter
participant schemas.py
participant MeshCollisionAPI
participant Prim
User->>MeshConverter: Convert mesh with collision config
MeshConverter->>schemas.py: modify_mesh_collision_properties(prim_path, cfg)
schemas.py->>Prim: Get prim at path
schemas.py->>MeshCollisionAPI: Apply(prim) if not already applied
schemas.py->>MeshCollisionAPI: Set Approximation attribute using cfg.mesh_approximation_token
Note over schemas.py,MeshCollisionAPI: NEW: Explicit approximation setting
schemas.py->>schemas.py: extract_mesh_collision_api_and_attrs(cfg)
Note over schemas.py: Excludes mesh_approximation_token from custom_attrs
schemas.py->>MeshCollisionAPI: Apply api_func (USD or PhysX)
schemas.py->>MeshCollisionAPI: Set custom attributes (hull_vertex_limit, etc.)
MeshCollisionAPI-->>schemas.py: Collision properties applied
schemas.py-->>MeshConverter: Properties set
MeshConverter-->>User: Mesh converted with correct approximation
|
|
|
||
| physx_func: callable = MISSING | ||
|
|
||
| mesh_approximation_token: UsdPhysics.Tokens | PhysxSchema.Tokens = MISSING |
There was a problem hiding this comment.
Can we add docstrings to all the attributes in this class? It seems previous MR missed out on this during the review process.
There was a problem hiding this comment.
Instead of tokens, can we make them "str" which gets remapped to tokens internally?
|
|
||
| mesh_collision_appx_type = type(cfg).__name__.partition("PropertiesCfg")[0] | ||
|
|
||
| if use_usd_api: |
There was a problem hiding this comment.
It is still useful to keep docstrings for the logic on mesh API decision making
Co-authored-by: Mayank Mittal <[email protected]> Signed-off-by: Fan Dongxuan <[email protected]>
|
Updated the code according to the review. Key Changes1. Replaced token-based API with string-based API
2. Enhanced validation and error handling
3. Updated all mesh collision configuration classes
4. Updated tests and version
|
|
@Mayankm96 @jtigue-bdai @kellyguo11 Someone take a look? |
There was a problem hiding this comment.
@Soappyooo Thanks for contribution, the changes look good to me! : ))
|
could you please resolve conflict? |
|
@ooctipus Conflicts resolved |
…te (isaac-sim#4082) # Description This PR fixes a bug in the mesh converter where collision approximation was missing when applying mesh collision properties. The fix ensures that the collision approximation token is properly set on the USD mesh collision API. Fixes isaac-sim#4077 ### Key changes 1. Added `mesh_approximation_token` attribute to all `MeshCollisionPropertiesCfg` classes 2. Modified `modify_mesh_collision_properties` to explicitly set the mesh collision approximation using the token 3. Updated `extract_mesh_collision_api_and_attrs` to exclude `mesh_approximation_token` from custom attributes 4. Fixed a bug where `len(custom_attrs > 0)` was used instead of `len(custom_attrs) > 0` 5. Added comprehensive unit tests for various collision approximation types (convex decomposition, triangle mesh, SDF) ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## 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` - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Fan Dongxuan <[email protected]> Co-authored-by: Mayank Mittal <[email protected]> Co-authored-by: ooctipus <[email protected]>
…te (isaac-sim#4082) # Description This PR fixes a bug in the mesh converter where collision approximation was missing when applying mesh collision properties. The fix ensures that the collision approximation token is properly set on the USD mesh collision API. Fixes isaac-sim#4077 ### Key changes 1. Added `mesh_approximation_token` attribute to all `MeshCollisionPropertiesCfg` classes 2. Modified `modify_mesh_collision_properties` to explicitly set the mesh collision approximation using the token 3. Updated `extract_mesh_collision_api_and_attrs` to exclude `mesh_approximation_token` from custom attributes 4. Fixed a bug where `len(custom_attrs > 0)` was used instead of `len(custom_attrs) > 0` 5. Added comprehensive unit tests for various collision approximation types (convex decomposition, triangle mesh, SDF) ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## 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` - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Fan Dongxuan <[email protected]> Co-authored-by: Mayank Mittal <[email protected]> Co-authored-by: ooctipus <[email protected]>
…te (isaac-sim#4082) # Description This PR fixes a bug in the mesh converter where collision approximation was missing when applying mesh collision properties. The fix ensures that the collision approximation token is properly set on the USD mesh collision API. Fixes isaac-sim#4077 ### Key changes 1. Added `mesh_approximation_token` attribute to all `MeshCollisionPropertiesCfg` classes 2. Modified `modify_mesh_collision_properties` to explicitly set the mesh collision approximation using the token 3. Updated `extract_mesh_collision_api_and_attrs` to exclude `mesh_approximation_token` from custom attributes 4. Fixed a bug where `len(custom_attrs > 0)` was used instead of `len(custom_attrs) > 0` 5. Added comprehensive unit tests for various collision approximation types (convex decomposition, triangle mesh, SDF) ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## 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` - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Fan Dongxuan <[email protected]> Co-authored-by: Mayank Mittal <[email protected]> Co-authored-by: ooctipus <[email protected]>
…te (isaac-sim#4082) # Description This PR fixes a bug in the mesh converter where collision approximation was missing when applying mesh collision properties. The fix ensures that the collision approximation token is properly set on the USD mesh collision API. Fixes isaac-sim#4077 ### Key changes 1. Added `mesh_approximation_token` attribute to all `MeshCollisionPropertiesCfg` classes 2. Modified `modify_mesh_collision_properties` to explicitly set the mesh collision approximation using the token 3. Updated `extract_mesh_collision_api_and_attrs` to exclude `mesh_approximation_token` from custom attributes 4. Fixed a bug where `len(custom_attrs > 0)` was used instead of `len(custom_attrs) > 0` 5. Added comprehensive unit tests for various collision approximation types (convex decomposition, triangle mesh, SDF) ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## 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` - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Fan Dongxuan <[email protected]> Co-authored-by: Mayank Mittal <[email protected]> Co-authored-by: ooctipus <[email protected]>
Description
This PR fixes a bug in the mesh converter where collision approximation was missing when applying mesh collision properties. The fix ensures that the collision approximation token is properly set on the USD mesh collision API.
Fixes #4077
Key changes
mesh_approximation_tokenattribute to allMeshCollisionPropertiesCfgclassesmodify_mesh_collision_propertiesto explicitly set the mesh collision approximation using the tokenextract_mesh_collision_api_and_attrsto excludemesh_approximation_tokenfrom custom attributeslen(custom_attrs > 0)was used instead oflen(custom_attrs) > 0Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there