google-deepmind / google-deepmind/dm_control

Nested default does not accept muscle children in PyMJCF

Abierto
#537 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
4.7k
Forks
764
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.