USD decoder ignores inertiaGroupRange unless both min and max are authored
メンテナーはふだん 6 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
調査の方向性
The issue points to the check in plugin/usd_decoder/usd_decoder.cc around lines 866–883; start by reading how it handles authored inertiaGroupRange attributes and their schema fallbacks. Reproduce with the provided Python snippet, comparing the decoded range and body mass when only max is authored versus when both ends are authored. Done means a single authored end is decoded using the other end's resolved default, matching the expected [0, 1] range and 8 kg mass.
索引モデルが issue の本文から書いたものです。
説明
Intro
Hi!
I work on mujoco-usd-converter, which converts MJCF to OpenUSD with the MjcPhysics schemas, and I check its output with MuJoCo's USD decoder.
My setup
MuJoCo 4.0.1 with mujoco-usd 4.0.1 from PyPI (usd-core 25.11), Python 3.12, Linux x86_64. The same code is in 3.17.0 and on main.
What's happening? What did you expect?
The decoder applies mjc:compiler:inertiaGroupRange:min and mjc:compiler:inertiaGroupRange:max only when both have an authored value. If only one is authored, it warns and ignores both:
WARNING: Only one of inertiaGroupRangeMin and inertiaGroupRangeMax was authored, ignoring both.
An unauthored attribute resolves to its schema fallback, which for these attributes is MuJoCo's default (min = 0, max = 5). So a stage that authors only max = 1 describes inertiagrouprange="0 1", but it decodes as 0 5. That is the natural way to author a range that keeps one default end, such as "0 1" or "0 3", since authoring tools commonly skip values that match the schema fallback. Geoms in groups MuJoCo should exclude from inertia then contribute mass.
I expected the decoder to use the resolved value of each attribute, taking the schema fallback for whichever end is not authored. The other MjcSceneAPI compiler attributes are applied independently whenever each one is authored.
The check is in usd_decoder.cc.
Steps for reproduction
pip install mujoco-usd==4.0.1- Run the code below. It builds the same stage twice, with only
maxauthored and with both ends authored. The body has a 0.2 m box in group 0 (8 kg) and a 0.3 m radius sphere collider in group 2, which is outside the range. - With only
maxauthored, the range decodes as[0, 5]and the body mass is 121.10 kg. Authoring the defaultmin = 0as well gives the expected[0, 1]and 8.00 kg.
WARNING: Only one of inertiaGroupRangeMin and inertiaGroupRangeMax was authored, ignoring both.
min authored=False: inertiagrouprange=[0, 5] body mass=121.10
min authored=True: inertiagrouprange=[0, 1] body mass=8.00
Minimal model for reproduction
The stage is built in memory by the code below. The equivalent MJCF, which compiles to 8 kg:
minimal XML
<mujoco>
<compiler inertiagrouprange="0 1"/>
<worldbody>
<body>
<freejoint/>
<geom type="box" size="0.1 0.1 0.1" group="0"/>
<geom type="sphere" size="0.3" group="2"/>
</body>
</worldbody>
</mujoco>
Code required for reproduction
import mujoco
from pxr import Usd, UsdGeom, UsdPhysics
def make_stage(author_min: bool) -> Usd.Stage:
stage = Usd.Stage.CreateInMemory()
UsdGeom.SetStageMetersPerUnit(stage, 1.0)
UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z)
scene = UsdPhysics.Scene.Define(stage, "/PhysicsScene").GetPrim()
scene.ApplyAPI("MjcSceneAPI")
# Equivalent to <compiler inertiagrouprange="0 1"/>. The min of 0 is the schema default.
scene.GetAttribute("mjc:compiler:inertiaGroupRange:max").Set(1)
if author_min:
scene.GetAttribute("mjc:compiler:inertiaGroupRange:min").Set(0)
body = UsdGeom.Xform.Define(stage, "/World/body").GetPrim()
UsdPhysics.RigidBodyAPI.Apply(body)
# 0.2 m box in group 0: 8 kg at the default density of 1000.
box = UsdGeom.Cube.Define(stage, "/World/body/box")
box.GetSizeAttr().Set(0.2)
UsdPhysics.CollisionAPI.Apply(box.GetPrim())
# 0.3 m radius sphere in group 2, outside the range, so it should not contribute mass.
sphere = UsdGeom.Sphere.Define(stage, "/World/body/sphere")
sphere.GetRadiusAttr().Set(0.3)
UsdPhysics.CollisionAPI.Apply(sphere.GetPrim())
sphere.GetPrim().ApplyAPI("MjcCollisionAPI")
sphere.GetPrim().GetAttribute("mjc:group").Set(2)
return stage
for author_min in (False, True):
stage = make_stage(author_min)
spec = mujoco.MjSpec.from_file(stage.GetRootLayer().identifier)
model = spec.compile()
print(
f"min authored={author_min}: inertiagrouprange={[int(x) for x in spec.compiler.inertiagrouprange]} "
f"body mass={model.body('/World/body').mass[0]:.2f}"
)
Confirmations
- I searched the latest documentation thoroughly before posting.
- I searched previous Issues and Discussions, I am certain this has not been raised before.
- 主要言語
- C++
- スター
- 18.3k
- フォーク
- 2.2k
- 平均マージ
- 9日 11時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google-deepmind/mujoco のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google-deepmind/mujoco#3932 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google-deepmind/mujoco#3929 ·
メンテナーはふだん 6 日以内に返信
-
`import mujoco.mjx` fails with TypeError when warp-lang is too old対応中かも @moah0911 が 22 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google-deepmind/mujoco#3738 ·
メンテナーはふだん 6 日以内に返信
-
Unity 6.6 support再び着手できるかも @Balint-H が 53 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
google-deepmind/mujoco#3615 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 6 日以内に返信
-
Filament: `filament.ao.bilateral_threshold` and six other model options are ignored since 4.0.1, which changed the default ambient occlusion対応中かも @jeongseok-meta が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
google-deepmind/mujoco#3933 ·
メンテナーはふだん 6 日以内に返信
google-deepmind/mujoco の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
maplibre/maplibre-native#5072 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
tenstorrent/tt-umd#4017 ·
メンテナーはふだん 3 日以内に返信
-
difficulty:easy func:gui prio:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NatronGitHub/Natron#1538 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hyprwm/hyprsunset#103 · コメント 1 件 ·