Body Construction Logic and Hierarchical
This section provides a clear and structured overview of how bodies are organized in MuJoCo, and how their child elements (joint, geom, site, camera, light) relate to them. No element attributes are explained here—only conceptual structure and hierarchy.
1. Body: The Fundamental Spatial Unit in MuJoCo
Each
bodyrepresents a local coordinate frame with a position (pos) and orientation (quat).The entire scene forms a tree starting from
worldbody, where each body is nested inside its parent.All child elements define their transforms relative to the coordinate system of their parent body.
In short: 👉 MuJoCo scenes are built as a tree of bodies, each serving as a spatial reference node.
2. Types of Child Elements Under a Body
A body may contain several types of child elements:
joint
Defines motion between the body and its parent
geom
Defines physical/visual geometry
site
A reference point used for sensing, targeting, or marking
camera
A view frame attached to the body
light
A light source attached to the body
3. Relationship Between Body and Joint
3.1 Joint connects a body to its parent
Every body (except
worldbody) may contain 0 or more joints.A joint specifies the degree of freedom (DOF) with respect to the parent body.
3.2 Joint defines body mobility
A body with joints is movable.
A body without joints is fixed relative to its parent.
3.3 Multiple joints
Multiple joints combine in sequence, forming compound motion.
4. Relationship Between Body and Geom
4.1 Geom attaches geometry to a body
Each
geomis positioned and oriented relative to the parent body.A body may have multiple geoms to define:
Collision geometry
Visual mesh
Mass and inertia contribution
4.2 Complex shapes
A single link can be represented by multiple geoms combined.
5. Relationship Between Body and Site
5.1 Site is a reference point
A site carries no mass and has no physical role.
Common uses include:
End-effector targets
Task/goal markers
Sensor mounting points
IK target frames
5.2 Site transforms with the body
Its world transform = body transform × site local transform.
6. Relationship Between Body and Camera
6.1 Camera is defined in the body’s frame
A camera’s position and orientation are based on the body it is attached to.
This enables:
Head-mounted cameras
Hand-eye cameras
Vehicle onboard cameras
6.2 Cameras do not affect physics
They only define viewpoints.
7. Relationship Between Body and Light
7.1 Light behaves similarly to a camera
Attached to a body and moves with it.
Useful for:
Robot-mounted flashlights
Vehicle headlights
Moving scene lights
7.2 Light affects rendering only
It does not influence physical simulation.
8. Example: Body Hierarchy Structure
Summary:
Bodies form the tree structure
Joints define motion relationships
Geoms / sites / cameras / lights are spatial attachments
9. Summary
MuJoCo uses bodies as the core hierarchical unit of a scene. Each body defines a local coordinate system and may contain joints, geoms, sites, cameras, and lights. Bodies connect to parent bodies through joints to form the kinematic tree, while the other child elements attach spatially to the body to define geometry, reference frames, vision, and lighting. This architecture forms a complete structure for physical simulation, rendering, and observation.
Last updated