Skip to content

Match the deformable flex and flexcomp schema to MuJoCo - #545

Open
adityasingh2400 wants to merge 1 commit into
google-deepmind:mainfrom
adityasingh2400:fix-deformable-flex-schema
Open

Match the deformable flex and flexcomp schema to MuJoCo#545
adityasingh2400 wants to merge 1 commit into
google-deepmind:mainfrom
adityasingh2400:fix-deformable-flex-schema

Conversation

@adityasingh2400

Copy link
Copy Markdown

The PyMJCF spec for <deformable><flex> disagrees with MuJoCo in several ways that together make the element unusable. The vertex attribute was capped at five entries, but MuJoCo reads three floats per vertex, so even a single triangle needs nine and no valid flex could ever be parsed. node was capped at three for the same reason, flatskin is a boolean keyword in MuJoCo but was declared as a pair of floats, group is an int but was declared as a reference into a namespace that does not exist, and dim and radius were marked required even though MuJoCo defaults them to 2 and 0.005.

The same flatskin mistype also appears on both copies of <flexcomp>, where it was declared as an int. That rejected the documented flatskin="true" and accepted flatskin="1", which MuJoCo then refuses to compile.

This continues the type pass in cab6d38, which fixed group, dim, radius, material, body, element, texcoord and elemtexcoord on the same element but left the remaining entries wrong. Everything here was verified against mujoco 3.11.0, the version this repo pins, and the added test compiles the round-tripped XML through MuJoCo.

Verified by restoring schema.xml to main and rerunning: the round-trip test fails because dim is demanded, the flexcomp test fails with Expect an integer value: got true, and supplying dim and radius by hand then hits the vertex cap with Expect array with no more than 5 entries: got nine floats. With the change, dm_control/mjcf/ is 152 passed and the suite and composer tests are 327 passed.

This is disjoint from my open #543 and #544. The schema.xml hunks are at lines 1257, 1641 and 1810 against their 606 to 932 and 2102 to 2336, and I ran trial merges against both branches with no conflicts.

The PyMJCF spec for <deformable><flex> disagrees with MuJoCo in ways that
make the element unusable. `vertex` was capped at five entries, but MuJoCo
reads three floats per vertex, so even a single triangle needs nine and no
valid flex could be parsed. `node` was capped at three for the same reason.
`flatskin` is a boolean keyword in MuJoCo but was declared as a pair of
floats, `group` is an int but was declared as a reference into a namespace
that does not exist, and `dim` and `radius` were marked required even though
MuJoCo defaults them to 2 and 0.005.

The same `flatskin` mistype also appears on both copies of <flexcomp>, where
it was declared as an int. That rejected the documented flatskin="true" and
accepted flatskin="1", which MuJoCo then refuses to compile.

Verified against mujoco 3.11.0, the version this repo pins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant