Let nested default classes accept the same children as the top level default - #543
Closed
adityasingh2400 wants to merge 1 commit into
Closed
Let nested default classes accept the same children as the top level default#543adityasingh2400 wants to merge 1 commit into
adityasingh2400 wants to merge 1 commit into
Conversation
…default The nested <default> element in the PyMJCF schema carried a hand written copy of the top level <default> children, and the copy had fallen behind. Because the nested spec is self recursive, every default class below the top level used the stale copy, so valid MJCF was rejected: <muscle> was missing entirely, <material> had lost metallic, roughness and its <layer> child, and group, actrange, fromto, springlength, solreffriction, projection and limited="auto" were missing from various elements. The nested element now inherits the enclosing element's children through a new inherit_children schema flag while keeping its own required class attribute, which removes 316 lines of duplication and makes the two lists impossible to desynchronise as MuJoCo gains elements. Fixes google-deepmind#537
Author
|
Closing this as superseded by 985d094, which replaced the hand-maintained I checked rather than assuming, since this PR changed That is exactly the property this PR was adding an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The nested
<default>element inschema.xmlcarried a hand written copy of the top level<default>children, and that copy had drifted. Since the nested spec is self recursive, every default class below the top level used the stale copy, so PyMJCF rejected MJCF that MuJoCo itself accepts.<muscle>was missing entirely, which is the failure reported in #537, and<material>had lostmetallic,roughnessand its<layer>child. Also missing weregroupon eight actuator and tendon elements,actlimitedandactrangeon<general>,fromtoon<site>,springlengthon<tendon>,solreffrictionon<pair>,projectionon<camera>, andlimited="auto"on<joint>and<tendon>.Rather than re-copying the block, the nested element now inherits the enclosing element's children through a new
inherit_childrenschema flag while keeping its own requiredclassattribute. That deletes 316 lines of duplication and makes the two lists impossible to desynchronise as MuJoCo gains elements.I confirmed with
mujoco.MjSpec.from_stringon MuJoCo 3.11.0 that all sixteen affected constructs are valid MJCF, and that all sixteen were rejected by PyMJCF before this change. The new tests inelement_test.pycover the reported<muscle>case, the fourteen previously rejected attributes, and the invariant that the nested and top level specs stay in sync.Fixes #537