Attachment frames's inertial property
还没有人认领这个 Issue。
评估
调研方向
从 dm_control/mjcf/README.md 的 attachment-frames 部分开始,并使用其中展示的 Camera、parent-body 和 attach 代码复现该问题。将生成的 MJCF 与所要求的输出进行比较;当附加的 body 保留其 inertial 元素,且未引入额外的 unnamed_model body 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hello,
I am trying to attach a body to another one, similar to your example here of child and parent.
However, my child body does have inertial-properties. Attaching the following child body
class Camera:
#===================#
# C O N S T A N T #
#===================#
_com_pos = (0, 0, 0.015)
_dclass = 'wam\\viz'
_mass = 0.095
_mesh_name = 'intel_realsense_l515'
_name = '\\rgb'
_quat = (0, 0, 1, 0)
#===============================#
# I N I T I A L I Z A T I O N #
#===============================#
def __init__(self, name, fovy):
# Make a MujoCo Root
self.mjcf_model = mjcf.RootElement()
# Add a body element: No need to add position info, as that will be added based on which `site` this body is going to be attached (https://github.com/google-deepmind/dm_control/blob/main/dm_control/mjcf/README.md#attachment-frames)
self.camera_body = self.mjcf_model.worldbody.add('body',
name = name)
# Add Inertial properties
self.camera_body.add('inertial',
pos = self._com_pos,
mass = self._mass)
# Add the Geometry (https://github.com/google-deepmind/dm_control/blob/ed424509c0a0e8ddf7a43824924de483026ad9cc/dm_control/locomotion/soccer/humanoid.py#L50)
self.camera_body.add('geom',
mesh = self._mesh_name,
dclass = self._dclass)
# Add camera sensor
self.camera_body.add('camera',
name = name+self._name,
pos = (0, 0, 0),
quat = self._quat,
fovy = fovy)
as such in the parent body
# Add camera locations
# An empty array to hold camera-sites
camera_site = []
for x in range(len(self._camera_pos)):
camera_site.append(self.summit_body.add('site',
pos = self._camera_pos[x],
quat = self._camera_quat[x],
dclass = self._site_name))
# Create camera
# Initialize empty list of camera
cameras = []
for x in range(len(self._camera_pos)):
cameras.append(Camera(name = self._name_summit+'_'+prefix+self._camera_name[x],
fovy = self._camera_fovy[x]))
# Attach the cameras
for x in range(len(self._camera_pos)):
camera_site[x].attach(cameras[x].mjcf_model)
causes the generated file to introduce an unnecessary body called unnamed_model, which is derived from the name of the worldbody (which, in this case, was initialized without a name).
<body name="smt_0" pos="0 0 0">
<inertial pos="0 0 0.37" mass="125" diaginertia="1.391 6.8529999999999998 6.125"/>
<geom name="smt_0\viz\base_link" class="summit\body\viz" mesh="base_link_summit"/>
<body pos="0 0.36199999999999999 0.373" quat="0 0 0.70710700000000004 0.70710700000000004" name="unnamed_model/">
<body name="unnamed_model/smt_0\front\camera\intel">
<inertial pos="0 0 0.014999999999999999" mass="0.095000000000000001"/>
<geom name="unnamed_model//unnamed_geom_0" class="unnamed_model/wam\viz" mesh="unnamed_model/intel_realsense_l515"/>
<camera name="unnamed_model/smt_0\front\camera\intel\rgb" class="unnamed_model/" fovy="55" pos="0 0 0" quat="0 0 1 0"/>
</body>
</body>
</body>
What I am aiming for is a representation similar to your example here, such that I should have:
<body name="smt_0" pos="0 0 0">
<inertial pos="0 0 0.37" mass="125" diaginertia="1.391 6.8529999999999998 6.125"/>
<geom name="smt_0\viz\base_link" class="summit\body\viz" mesh="base_link_summit"/>
<body pos="0 0.36199999999999999 0.373" quat="0 0 0.70710700000000004 0.70710700000000004" name="unnamed_model/">
<inertial pos="0 0 0.014999999999999999" mass="0.095000000000000001"/>
<geom name="unnamed_model//unnamed_geom_0" class="unnamed_model/wam\viz" mesh="unnamed_model/intel_realsense_l515"/>
<camera name="unnamed_model/smt_0\front\camera\intel\rgb" class="unnamed_model/" fovy="55" pos="0 0 0" quat="0 0 1 0"/>
</body>
</body>
but I am not allowed to do this because AttributeError: <inertial> is not a valid child of <worldbody>.
Question;
How can I get such a clean representation while introducing inertial properties for attached-bodies?
- 主要语言
- Python
- 星标
- 4.7k
- 派生
- 765
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google-deepmind/dm_control 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 76/100
google-deepmind/dm_control#552 ·
-
难度 3/5 1-2 天 新手友好度 45/100
google-deepmind/dm_control#540 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
google-deepmind/dm_control#537 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
google-deepmind/dm_control#529 ·
-
难度 5/5 一周以上 新手友好度 25/100
google-deepmind/dm_control#527 · 1 条评论 ·
查看 google-deepmind/dm_control 的全部 Issue
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100