USD decoder: PhysicsFilteredPairsAPI fails or is ignored for collider endpoints, and newton:selfCollisionEnabled is not read
Los mantenedores suelen responder en 6 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 49/100
Línea de trabajo
Start in plugin/usd_decoder with ParseUsdFilteredPairsAPI, ParseUsdPhysicsRigidbody, and ParseNewtonArticulationRootAPI; the issue identifies these entry points but no test file. Trace how filtered-pair targets become MuJoCo excludes and how articulation bodies are collected, then add regression coverage for the five reproduction cases. Done means valid collider pairs no longer fail or get ignored, and disabled Newton self-collisions produce no contacts between non-parent-child articulation bodies.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
The USD decoder only handles PhysicsFilteredPairsAPI when it is applied to a rigid body and targets another rigid body. Other forms that UsdPhysics allows either fail to compile the whole model or are silently ignored. Separately, newton:selfCollisionEnabled on NewtonArticulationRootAPI is declared in newton_tokens.h but never read.
Verified at runtime with the mujoco-usd 4.0.1 wheel. plugin/usd_decoder is unchanged on main since the 4.0.1 tag.
Details
UsdPhysics says "The FilteringPairsAPI can be applied to objects with a UsdPhysicsRigidBodyAPI, UsdPhysicsCollisionAPI, or UsdPhysicsArticulationRootAPI", and that a relationship from A to B implies the one from B to A (overview.dox, and the PhysicsFilteredPairsAPI schema doc: "can be applied either to a body or collision or even articulation").
ParseUsdFilteredPairsAPI is only called from ParseUsdPhysicsRigidbody, and copies each target path into mjsExclude::bodyname2. So:
| Authored | Result |
|---|---|
| Rigid body → rigid body | <exclude>, correct |
| Rigid body → static collider (e.g. a floor) | Compile error: body '/World/floor' not found in bodypair 0 |
| Rigid body → collider under another rigid body | Compile error: body '/World/A/geom' not found in bodypair 0 |
| API applied on a collider | Ignored; the pair still collides |
The compile errors are the worst part: a single spec-valid filtered pair makes the whole stage fail to load.
For self collisions, ParseNewtonArticulationRootAPI reads newton:jointsAddMobility but not newton:selfCollisionEnabled. The Newton schema (v0.4.0, the version MuJoCo pins) defines false as "equivalent to applying PhysicsFilteredPairsAPI relationships between all bodies in the articulation", so there is a direct MuJoCo equivalent: an <exclude> for each pair of bodies in the articulation.
Why it matters
- Collider-level filtered pairs are valid UsdPhysics, and one of them is enough to make the whole stage fail to load in MuJoCo. Filtering a body against a static collider such as a floor is a common case.
- When the API is applied on a collider, the filtering is silently lost, so the model loads but generates contacts the asset explicitly disabled.
newton:selfCollisionEnabled = falseis the Newton schema's way to disable self collisions for an articulation, and MuJoCo already parsesNewtonArticulationRootAPI. Ignoring it silently re-enables self collisions.
Request
- Resolve each filtered-pair endpoint to the colliders it covers: a rigid body to its colliders, a collider to itself, a static collider to that geom on the world body, and an articulation root to all colliders in the articulation. When both sides cover whole MuJoCo bodies, emit
<exclude>as today, usingworldfor static colliders when the pair covers all of the world body's colliders. - Parse
PhysicsFilteredPairsAPIon colliders and articulation roots as well as rigid bodies. - For collider-level pairs that
<exclude>can't express, setcontype/conaffinityon the affected geoms, or at minimum warn and skip the pair instead of failing to compile. - For
newton:selfCollisionEnabled = false, add an<exclude>for each pair of bodies in the articulation. Parent-child pairs are already filtered by default, so those can be skipped.
Reproduction
pip install mujoco-usd==4.0.1, then:
repro.py
import tempfile
import mujoco
import mujoco._usd # registers the USD decoder plugin
from pxr import Gf, Sdf, Usd, UsdGeom, UsdPhysics
def collider(stage, path, pos, body=True):
prim = UsdGeom.Sphere.Define(stage, path)
prim.CreateRadiusAttr(0.1)
prim.AddTranslateOp().Set(Gf.Vec3d(*pos))
if body:
UsdPhysics.RigidBodyAPI.Apply(prim.GetPrim())
UsdPhysics.CollisionAPI.Apply(prim.GetPrim())
return prim.GetPrim()
def stage_for(case):
stage = Usd.Stage.CreateInMemory()
UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z)
stage.SetDefaultPrim(UsdGeom.Xform.Define(stage, "/World").GetPrim())
UsdPhysics.Scene.Define(stage, "/World/scene")
floor = UsdGeom.Cube.Define(stage, "/World/floor")
floor.AddTranslateOp().Set(Gf.Vec3d(0, 0, -1))
UsdPhysics.CollisionAPI.Apply(floor.GetPrim()) # static collider
if case == "selfCollisionEnabled":
links = [collider(stage, f"/World/L{i}", (x, 0, 1)) for i, x in enumerate((0.0, 0.15, 0.05))]
UsdPhysics.ArticulationRootAPI.Apply(links[0])
links[0].ApplyAPI("NewtonArticulationRootAPI")
links[0].CreateAttribute("newton:selfCollisionEnabled", Sdf.ValueTypeNames.Bool).Set(False)
for name, b0, b1, p0, p1 in (("j01", 0, 1, 0.075, -0.075), ("j12", 1, 2, -0.05, 0.05)):
joint = UsdPhysics.RevoluteJoint.Define(stage, f"/World/{name}")
joint.CreateBody0Rel().AddTarget(links[b0].GetPath())
joint.CreateBody1Rel().AddTarget(links[b1].GetPath())
joint.CreateLocalPos0Attr(Gf.Vec3f(p0, 0, 0))
joint.CreateLocalPos1Attr(Gf.Vec3f(p1, 0, 0))
joint.CreateAxisAttr("Z")
return stage
a = UsdGeom.Xform.Define(stage, "/World/A")
a.AddTranslateOp().Set(Gf.Vec3d(0, 0, 0.05))
UsdPhysics.RigidBodyAPI.Apply(a.GetPrim())
geom_a = collider(stage, "/World/A/geom", (0, 0, 0), body=False)
b = collider(stage, "/World/B", (0.1, 0, 0.05))
source, target = {
"body -> body": (a.GetPrim(), "/World/B"),
"body -> static collider": (a.GetPrim(), "/World/floor"),
"body -> collider of a body": (b, "/World/A/geom"),
"collider -> body": (geom_a, "/World/B"),
}[case]
UsdPhysics.FilteredPairsAPI.Apply(source).CreateFilteredPairsRel().AddTarget(target)
return stage
for case in ("body -> body", "body -> static collider", "body -> collider of a body", "collider -> body", "selfCollisionEnabled"):
path = tempfile.mkdtemp() + "/scene.usda"
stage = stage_for(case)
stage.GetRootLayer().Export(path)
try:
model = mujoco.MjSpec.from_file(path).compile()
except Exception as e:
print(f"{case:28} compile error: {str(e).splitlines()[0]}")
continue
data = mujoco.MjData(model)
mujoco.mj_forward(model, data)
name = lambda g: mujoco.mj_id2name(model, mujoco.mjtObj.mjOBJ_BODY, int(model.geom_bodyid[g])) or "world"
pairs = sorted({tuple(sorted((name(c.geom1), name(c.geom2)))) for c in data.contact[: data.ncon]})
print(f"{case:28} nexclude={model.nexclude} contacts={pairs}")
body -> body nexclude=1 contacts=[('/World/A', 'world'), ('/World/B', 'world')]
body -> static collider compile error: Error: body '/World/floor' not found in bodypair 0
body -> collider of a body compile error: Error: body '/World/A/geom' not found in bodypair 0
collider -> body nexclude=0 contacts=[('/World/A', '/World/B'), ('/World/A', 'world'), ('/World/B', 'world')]
selfCollisionEnabled nexclude=0 contacts=[('/World/L0', '/World/L2')]
The last two rows should have no contact between /World/A and /World/B, and none between /World/L0 and /World/L2.
Environment
mujoco 4.0.1, mujoco-usd 4.0.1, usd-core 25.11, newton-usd-schemas 0.7.0, Python 3.12, Linux x86_64 (Ubuntu, kernel 6.8).
- Lenguaje dominante
- C++
- Estrellas
- 18.3k
- Forks
- 2.2k
- Merge medio
- 9 d 11 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de google-deepmind/mujoco
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google-deepmind/mujoco#3932 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
google-deepmind/mujoco#3929 ·
Los mantenedores suelen responder en 6 días
-
`import mujoco.mjx` fails with TypeError when warp-lang is too oldPosiblemente ocupada @moah0911 la tomó hace 22 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google-deepmind/mujoco#3738 ·
Los mantenedores suelen responder en 6 días
-
Unity 6.6 supportQuizá libre de nuevo @Balint-H la tomó hace 53 días y no hay ningún pull request abierto. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
google-deepmind/mujoco#3615 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 6 días
-
Filament: `filament.ao.bilateral_threshold` and six other model options are ignored since 4.0.1, which changed the default ambient occlusionPosiblemente ocupada @jeongseok-meta la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
google-deepmind/mujoco#3933 ·
Los mantenedores suelen responder en 6 días
Todos los issues de google-deepmind/mujoco
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
maplibre/maplibre-native#5072 ·
Los mantenedores suelen responder en 1 día
-
[UBSan] spawn_simulator passes null child_options.args to uv_spawn (execvp nonnull violation)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
tenstorrent/tt-umd#4017 ·
Los mantenedores suelen responder en 3 días
-
difficulty:easy func:gui prio:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NatronGitHub/Natron#1538 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
hyprwm/hyprsunset#103 · 1 comentario ·