Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Attachment frames's inertial property

オープン
#477 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
tooling

調査の方向性

dm_control/mjcf/README.md の attachment-frames セクションから始め、示されている Camera、parent-body、attach のコードを使って問題を再現します。生成された MJCF を要求された出力と比較します。attached bodies が 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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google-deepmind/dm_control のほかの issue

google-deepmind/dm_control の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。