Repository navigation
Add MuJoCo per-collider configuration - #6706
Conversation
Expose MJWarp's per-collider contact parameters through a typed schema fragment and canonical USD array authoring. Replace the task-local condim workaround in the migration guide and asset-preparation skill.
Mark the test-only Isaac Lab package change as requiring no release entry so the changelog gate recognizes every touched package.
Greptile SummaryThis PR introduces
Confidence Score: 4/5Safe to merge. The new applier is additive, well-tested, and follows existing codebase patterns closely. The implementation is clean and the two findings are minor inconsistencies in the applier's return-value contract and validation order — neither affects correctness under normal usage. All validations do fire before Newton reads the attributes, tests pass, and the documentation update is accurate. schemas.py — the scalar-write result and the mid-loop length-check ordering are worth a second look. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["apply_collision_properties(prim_path, [fragments], stage)"] --> B{Fragment type?}
B -->|MujocoCollisionCfg| C["apply_mujoco_collision(cfg, prim_path, stage)"]
B -->|Other fragments| D["apply_namespaced / other dispatch"]
C --> E{prim.IsValid?}
E -->|No| F["raise ValueError"]
E -->|Yes| G["Validate scalars upfront\ncondim ∈ {1,3,4,6}\ngroup ∈ [0,5]\npriority ≥ 0\nsolmix ≥ 0"]
G -->|Invalid| F
G -->|Valid| H["Write scalars via safe_set_attribute_on_usd_prim\nmjc:condim, mjc:group, mjc:priority, mjc:solmix"]
H --> I["For solimp, solref in loop:"]
I --> J{len == expected?}
J -->|No| F
J -->|Yes| K["Write Vt.DoubleArray via change_prim_property\nmjc:solimp as double[5]\nmjc:solref as double[2]"]
K --> L["return success"]
Reviews (1): Last reviewed commit: "Add Isaac Lab changelog fragment" | Re-trigger Greptile |
| success = True | ||
| for attr_name in ("condim", "group", "priority", "solmix"): | ||
| value = getattr(cfg, attr_name) | ||
| if value is not None: | ||
| safe_set_attribute_on_usd_prim(prim, f"mjc:{attr_name}", value, camel_case=False) |
There was a problem hiding this comment.
Scalar write results not tracked in
success
The return value of safe_set_attribute_on_usd_prim is silently dropped for all four scalar fields (condim, group, priority, solmix), while the array paths use change_prim_property whose result is correctly accumulated via and. The docstring promises True if all authored attributes were written successfully, but a silent failure on a scalar write would still return True (or whatever the array writes produce). The inconsistency means callers that gate on the return value can't rely on it to detect partial failures on the scalar path.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| for attr_name, expected_length in (("solimp", 5), ("solref", 2)): | ||
| value = getattr(cfg, attr_name) | ||
| if value is None: | ||
| continue | ||
| if len(value) != expected_length: | ||
| raise ValueError(f"'{attr_name}' must contain exactly {expected_length} values. Received: {len(value)}.") | ||
| success = ( | ||
| change_prim_property( | ||
| prop_path=f"{prim.GetPath()}.mjc:{attr_name}", | ||
| value=Vt.DoubleArray(value), | ||
| stage=stage, | ||
| type_to_create_if_not_exist=Sdf.ValueTypeNames.DoubleArray, | ||
| ) | ||
| and success | ||
| ) | ||
| return success |
There was a problem hiding this comment.
Array-length check fires mid-loop, allowing partial writes before ValueError
All scalar validations (condim, group, priority, solmix) run upfront and scalar attributes are fully written before the array loop begins. The length check for solimp/solref is then performed lazily inside the write loop. If both fields are provided and only solref has the wrong length, solimp is written to the prim and then the ValueError is raised — leaving the prim in a partially-authored state. Callers that catch the error and retry with a corrected solref would find the prim already has the solimp attribute, which may or may not be the desired behavior. Pre-validating all array lengths upfront (alongside the scalar checks) would prevent this.
# Description Adds a public `MujocoCollisionCfg` schema fragment for the per-collider custom attributes registered by Newton's MuJoCo solver: `condim`, `group`, `priority`, `solimp`, `solmix`, and `solref`. The custom applier writes scalar values under `mjc:*` and writes `solimp`/`solref` as canonical USD `double[]` arrays matching Newton's importer output. The PhysX-to-MJWarp migration guide and asset-preparation skill now use this config instead of defining a task-local collision fragment, document the other supported per-collider fields, and route margin/gap and mesh-cooking settings to the existing Newton configs. Follow-up to isaac-sim#6684. ## Type of change - New feature (non-breaking change which adds functionality) - Documentation update ## Testing - `isaaclab.bat -p -m pytest source/isaaclab/test/sim/test_collision_fragments.py -q` (15 passed) - `uv run --no-project python tools/skills/cli.py check` (19 skills validated) - Warning-as-error Sphinx dummy build for the changed API and migration pages (passed) - `uv run isaaclab -f` (passed before commit, before push, and after rebasing onto current `develop`) ## Screenshots Not applicable. ## 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 added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
Description
Adds a public
MujocoCollisionCfgschema fragment for the per-collider custom attributes registered by Newton's MuJoCo solver:condim,group,priority,solimp,solmix, andsolref.The custom applier writes scalar values under
mjc:*and writessolimp/solrefas canonical USDdouble[]arrays matching Newton's importer output. The PhysX-to-MJWarp migration guide and asset-preparation skill now use this config instead of defining a task-local collision fragment, document the other supported per-collider fields, and route margin/gap and mesh-cooking settings to the existing Newton configs.Follow-up to #6684.
Type of change
Testing
isaaclab.bat -p -m pytest source/isaaclab/test/sim/test_collision_fragments.py -q(15 passed)uv run --no-project python tools/skills/cli.py check(19 skills validated)uv run isaaclab -f(passed before commit, before push, and after rebasing onto currentdevelop)Screenshots
Not applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched packageCONTRIBUTORS.mdor my name already exists there