google-deepmind / google-deepmind/dm_control

Nested default does not accept muscle children in PyMJCF

Aperta
#537 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
4.7k
Fork
764
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.