From c2e9bfa3e87d6b173cf2337bacb70d7a97b4a5a3 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Thu, 20 Nov 2025 10:53:59 -0800 Subject: [PATCH] Clarify semantic of `body_rootid` and `body_weldid` PiperOrigin-RevId: 834827589 Change-Id: I562e0aa374ce59d8b769e8d003e4c63ee434a1fc --- doc/includes/references.h | 4 ++-- include/mujoco/mjmodel.h | 4 ++-- python/mujoco/introspect/structs.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/includes/references.h b/doc/includes/references.h index 8a54a54f..b3e36fe5 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -1092,8 +1092,8 @@ struct mjModel_ { // bodies int* body_parentid; // id of body's parent (nbody x 1) - int* body_rootid; // id of root above body (nbody x 1) - int* body_weldid; // id of body that this body is welded to (nbody x 1) + int* body_rootid; // ancestor that is direct child of world (nbody x 1) + int* body_weldid; // top ancestor with no dofs to this body (nbody x 1) int* body_mocapid; // id of mocap data; -1: none (nbody x 1) int* body_jntnum; // number of joints for this body (nbody x 1) int* body_jntadr; // start addr of joints; -1: no joints (nbody x 1) diff --git a/include/mujoco/mjmodel.h b/include/mujoco/mjmodel.h index c3ff376a..3c1eba18 100644 --- a/include/mujoco/mjmodel.h +++ b/include/mujoco/mjmodel.h @@ -751,8 +751,8 @@ struct mjModel_ { // bodies int* body_parentid; // id of body's parent (nbody x 1) - int* body_rootid; // id of root above body (nbody x 1) - int* body_weldid; // id of body that this body is welded to (nbody x 1) + int* body_rootid; // ancestor that is direct child of world (nbody x 1) + int* body_weldid; // top ancestor with no dofs to this body (nbody x 1) int* body_mocapid; // id of mocap data; -1: none (nbody x 1) int* body_jntnum; // number of joints for this body (nbody x 1) int* body_jntadr; // start addr of joints; -1: no joints (nbody x 1) diff --git a/python/mujoco/introspect/structs.py b/python/mujoco/introspect/structs.py index 13ebbfce..88aac321 100644 --- a/python/mujoco/introspect/structs.py +++ b/python/mujoco/introspect/structs.py @@ -1328,7 +1328,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ type=PointerType( inner_type=ValueType(name='int'), ), - doc='id of root above body', + doc='ancestor that is direct child of world', array_extent=('nbody',), ), StructFieldDecl( @@ -1336,7 +1336,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ type=PointerType( inner_type=ValueType(name='int'), ), - doc='id of body that this body is welded to', + doc='top ancestor with no dofs to this body', array_extent=('nbody',), ), StructFieldDecl(