google-deepmind / google-deepmind/dm_control

Nested default does not accept muscle children in PyMJCF

Đang mở
#537 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
4.7k
Fork
764
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.