Skip to content

mjcf: restore schema declarations lost in the schema.xml regeneration - #553

Open
shoemoney wants to merge 1 commit into
google-deepmind:mainfrom
shoemoney:fix/schema-regeneration-regressions
Open

mjcf: restore schema declarations lost in the schema.xml regeneration#553
shoemoney wants to merge 1 commit into
google-deepmind:mainfrom
shoemoney:fix/schema-regeneration-regressions

Conversation

@shoemoney

Copy link
Copy Markdown

Fixes #552.

The schema regeneration in 985d094 dropped three declarations that the pre-regeneration schema.xml carried and that MuJoCo 3.12 still accepts. Each one breaks a previously working PyMJCF model at HEAD:

  1. sensor lost its contact child element. Parsing a model with <sensor><contact .../></sensor> raises KeyError while raw MuJoCo loads the same XML.
  2. jointinparent on the nine actuator elements degraded from type="reference" reference_namespace="joint" to type="string". attach() therefore emits the joint name unprefixed and the composed model fails to compile with unknown transmission target.
  3. custom/numeric data degraded from type="array" array_type="float" to type="string", so root.custom.add('numeric', name='x', data=[1, 2, 3]) raises ValueError.

This PR restores the three declarations exactly as they were in the pre-regeneration schema and adds a SchemaRegressionTest to schema_test.py covering all three (parse and compile of a contact sensor, attach round-trip that must scope jointinparent, and array data on a custom numeric). All three tests fail at HEAD and pass with the fix; the full dm_control/mjcf test suite passes (157 tests).

If the preferred fix is in the schema generator rather than the checked-in file, the regression tests here should transfer directly.

The schema regeneration in 985d094 dropped three declarations that
MuJoCo 3.12 still accepts, breaking previously working PyMJCF models:

- sensor lost its contact child element, so parsing a model with
  <sensor><contact .../></sensor> raises KeyError while raw MuJoCo
  loads it fine.
- jointinparent on the nine actuator elements degraded from
  type="reference" reference_namespace="joint" to type="string", so
  attach() no longer prefixes the joint name and the composed model
  fails to compile with "unknown transmission target".
- custom/numeric data degraded from a float array to a string, so
  add('numeric', name='x', data=[1, 2, 3]) raises ValueError.

Restore the three declarations as they were before the regeneration
and add regression tests covering all three.
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.

Schema regeneration in 985d0940 dropped three declarations MuJoCo 3.12 accepts (contact sensor, jointinparent references, custom numeric arrays)

1 participant