google-deepmind / google-deepmind/mujoco

mjcPhysics USD schema missing sleep and body gravcomp attributes

Open
#3,457 0 comments 0 reactions 1 assignee Claimed by @havess View on GitHub
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Summary

The `mjcPhysics` USD schema shipped in `mujoco/experimental/usd/mjcPhysics/` is missing attributes for three MJCF features that MJCF itself accepts. Models using them cannot be round-tripped through USD.

Checked against `mujoco` 3.11.0.

### Missing attributes

| MJCF | accepted by 3.11 MJCF | `mjcPhysics` USD attribute |
| --- | --- | --- |
| `` | yes | **none** |
| `` | yes | **none** |
| `` | yes | **none** |
| `` | yes | **none** |

`MjcPhysicsSceneAPI` defines 25 `mjc:option:*` attributes:

```
actuatorgroupdisable, ccd_iterations, ccd_tolerance, cone, density, impratio,
integrator, iterations, jacobian, ls_iterations, ls_tolerance, magnetic,
noslip_iterations, noslip_tolerance, o_friction, o_margin, o_solimp, o_solref,
sdf_initpoints, sdf_iterations, solver, timestep, tolerance, viscosity, wind
```

None is sleep-related. A case-insensitive search for `sleep` across the whole `mjcPhysics` directory returns no hits at all, so there is no differently-spelled equivalent.

For gravity compensation, the schema has `mjc:actuatorgravcomp` on `MjcPhysicsJointAPI` and a `mjc:flag:gravity` scene flag, but no body-level equivalent of MJCF's `` (which compiles to `body_gravcomp`). Those are different quantities.

Sleeping appears to have been added to MJCF in 3.11 without a corresponding schema extension.

### Why it matters

Tools that convert MJCF to USD have nowhere to record these values, so they are silently dropped. Consumers then fall back to defaults, which is a behavioral difference rather than a missing annotation — a model authored with a non-default `sleep_tolerance`, or with `gravcomp` on a body, does not simulate the same way after a USD round trip.

There is also a knock-on effect: downstream projects have started inventing `mjc:`-prefixed attribute names to fill the gap (e.g. `mjc:option:sleep_tolerance`, `mjc:sleep`, `mjc:gravcomp`). These look schema-defined but are not, so different consumers can diverge on naming. Defining them upstream would settle the spelling before that spreads further.

### Request

Add `MjcPhysicsSceneAPI` attributes for the sleep option and flag, and body-level attributes for sleep policy and `gravcomp` — or confirm the intended spellings if they are already planned, so downstream tools can align.

### Reproduction

```python
import mujoco

# MJCF accepts all of these
for xml in [
'',
'',
''
'',
]:
mujoco.MjSpec.from_string(xml).compile() # all compile
```

```bash
# but the schema has no sleep attribute in any spelling
grep -ri sleep "$(python -c 'import mujoco,os;print(os.path.dirname(mujoco.__file__))')/include/mujoco/experimental/usd/mjcPhysics/"
# (no output)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.