google-deepmind / google-deepmind/dm_control

Nested default does not accept muscle children in PyMJCF

未关闭
#537 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
4.7k
派生
764
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

调研方向

首先使用 dm_control==1.0.41 和 mujoco==3.8.1 运行 XML 和手动构造 repro,然后检查 PyMJCF 的默认子级规范,其中 outer.spec.children 包含 muscle,而 inner.spec.children 不包含。嵌套的默认类能够接受 muscle 子级,并且两个 repro 都在没有报告错误的情况下完成,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。