google-deepmind / google-deepmind/dm_control

Nested default does not accept muscle children in PyMJCF

Offen
#537 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
4.7k
Forks
764
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi, I am having an issue with PyMJCF handling nested default classes containing muscle elements.

### Environment

- dm_control==1.0.41
- mujoco==3.8.1

### Minimal repro

```python
from dm_control import mjcf

xml = """







"""

mjcf.from_xml_string(xml)
```

### Observed behavior

This fails with:

```text
KeyError: "Line 4: error while parsing element : 'muscle'"
```

### Manual construction also fails

```python
from dm_control import mjcf

root = mjcf.RootElement(model="repro")
d = root.default.add("default", dclass="forearm_muscle")
d.add("muscle", ctrllimited="true", ctrlrange="-1 1")
```

This raises:

```text
AttributeError: is not a valid child of
```

### Additional observation

```python
from dm_control import mjcf

root = mjcf.RootElement(model="debug")
outer = root.default
inner = outer.add("default", dclass="forearm_muscle")

print("muscle" in outer.spec.children) # True
print("muscle" in inner.spec.children) # False
```

So it looks like the top-level default accepts muscle, but nested default does not.

### Expected behavior

I would expect nested default classes to accept children as well.

This came up while parsing a musculoskeletal MJCF model that uses blocks like:

```xml




```

I am fairly new to using this parser, so please let me know if there is something I am missing

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.