Skip to content

MyoFullBody

MyoFullBody is a MuJoCo-derived musculoskeletal full-body model from amathislab/musclemimic_models. It exposes rigid STL link meshes, body-frame skeleton transforms, site positions, and tendon metadata through the same NumPy, PyTorch, and JAX backend layout as the other models.

Setup

MyoFullBody downloads automatically on first use. To prefetch and save the path:

# Download the MyoFullBody MJCF and referenced mesh assets.
body-models download myofullbody

When passed manually, model_path should contain body/myofullbody.xml and the referenced mesh assets from the upstream musclemimic_models/model/ tree.

Usage

from body_models.myofullbody.numpy import MyoFullBody

# Load the rigid articulated model and start from its bundled A-pose.
model = MyoFullBody()
params = model.get_apose(batch_dims=(1,))

# Evaluate the concatenated link meshes, body-frame skeleton, and link transforms.
vertices = model.forward_vertices(**params)
skeleton = model.forward_skeleton(**params)
links = model.forward_links(**params)

# Lift MuJoCo site positions from local body frames into world coordinates.
sites = model.world_sites(skeleton)

Notes

MyoFullBody is a rigid articulated model, so it does not define skin_weights. Use forward_links, link_mesh, or joint_meshes when rendering or inspecting individual STL links.

API

body_models.skeletons.myofullbody.numpy.MyoFullBody

MyoFullBody(model_path=None)

Bases: BodyModel

MyoSuite-derived full-body MJCF model with rigid STL link meshes.

Initialize the MyoFullBody model.

PARAMETER DESCRIPTION
model_path

Path to model assets, or the default assets when omitted.

TYPE: Path | str | None DEFAULT: None

METHOD DESCRIPTION
forward_skeleton

Compute posed joint transforms.

forward_vertices

Compute posed mesh vertices.

joint_index

Resolve a standard joint to this model's native joint index.

prepare_skinning

Pack prepared model state into renderer-ready skinning inputs.

ATTRIBUTE DESCRIPTION
common_joints

Common anatomical joints mapped to this model's native joint names.

TYPE: Mapping[Joint, str]

Source code in src/body_models/skeletons/myofullbody/numpy.py
27
28
29
30
31
32
33
def __init__(self, model_path: Path | str | None = None) -> None:
    """Initialize the MyoFullBody model.

    Args:
        model_path: Path to model assets, or the default assets when omitted.
    """
    self.weights = load_model_data(model_path)

common_joints property

common_joints

Common anatomical joints mapped to this model's native joint names.

forward_skeleton

forward_skeleton(
    body_pose,
    global_translation=None,
    *,
    global_rotation=None,
    joint_indices=None,
)

Compute posed joint transforms.

PARAMETER DESCRIPTION
body_pose

Local body joint rotations.

TYPE: Float[ndarray, 'B Q']

global_translation

Global model translation.

TYPE: Float[ndarray, 'B 3'] | None DEFAULT: None

global_rotation

Global model rotation.

TYPE: Float[ndarray, 'B 3'] | None DEFAULT: None

joint_indices

Optional subset of joints to return.

TYPE: Any | None DEFAULT: None

RETURNS DESCRIPTION
Float[ndarray, 'B J 4 4']

Joint transforms in the model hierarchy.

Source code in src/body_models/skeletons/myofullbody/numpy.py
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
def forward_skeleton(
    self,
    body_pose: Float[np.ndarray, "B Q"],
    global_translation: Float[np.ndarray, "B 3"] | None = None,
    *,
    global_rotation: Float[np.ndarray, "B 3"] | None = None,
    joint_indices: Any | None = None,
) -> Float[np.ndarray, "B J 4 4"]:
    """Compute posed joint transforms.

    Args:
        body_pose: Local body joint rotations.
        global_translation: Global model translation.
        global_rotation: Global model rotation.
        joint_indices: Optional subset of joints to return.

    Returns:
        Joint transforms in the model hierarchy.
    """
    return backend.forward_skeleton(
        weights=self.weights,
        body_pose=body_pose,
        global_translation=global_translation,
        global_rotation=global_rotation,
        joint_indices=joint_indices,
    )

forward_vertices

forward_vertices(
    body_pose,
    global_translation=None,
    *,
    global_rotation=None,
    vertex_indices=None,
)

Compute posed mesh vertices.

PARAMETER DESCRIPTION
body_pose

Local body joint rotations.

TYPE: Float[ndarray, 'B Q']

global_translation

Global model translation.

TYPE: Float[ndarray, 'B 3'] | None DEFAULT: None

global_rotation

Global model rotation.

TYPE: Float[ndarray, 'B 3'] | None DEFAULT: None

vertex_indices

Optional subset of vertices to return.

TYPE: Any | None DEFAULT: None

RETURNS DESCRIPTION
Float[ndarray, 'B V 3']

Posed vertex positions.

Source code in src/body_models/skeletons/myofullbody/numpy.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
def forward_vertices(
    self,
    body_pose: Float[np.ndarray, "B Q"],
    global_translation: Float[np.ndarray, "B 3"] | None = None,
    *,
    global_rotation: Float[np.ndarray, "B 3"] | None = None,
    vertex_indices: Any | None = None,
) -> Float[np.ndarray, "B V 3"]:
    """Compute posed mesh vertices.

    Args:
        body_pose: Local body joint rotations.
        global_translation: Global model translation.
        global_rotation: Global model rotation.
        vertex_indices: Optional subset of vertices to return.

    Returns:
        Posed vertex positions.
    """
    return backend.forward_vertices(
        weights=self.weights,
        body_pose=body_pose,
        global_translation=global_translation,
        global_rotation=global_rotation,
        vertex_indices=vertex_indices,
    )

joint_index

joint_index(joint)

Resolve a standard joint to this model's native joint index.

Source code in src/body_models/base.py
77
78
79
80
81
82
83
84
85
def joint_index(self, joint: Joint) -> int:
    """Resolve a standard joint to this model's native joint index."""
    if not isinstance(joint, Joint):
        raise TypeError("joint_index() expects a body_models.Joint; use joint_names.index(...) for native names.")
    try:
        native_name = self.common_joints[joint]
    except KeyError as exc:
        raise KeyError(f"{self.__class__.__name__} has no standard joint {joint.value!r}") from exc
    return self.joint_names.index(native_name)

prepare_skinning

prepare_skinning(*, identity, pose)

Pack prepared model state into renderer-ready skinning inputs.

Source code in src/body_models/base.py
161
162
163
164
165
166
167
168
169
170
171
172
173
174
def prepare_skinning(self, *, identity: Mapping[str, Any], pose: Mapping[str, Any]) -> SkinningPayload:
    """Pack prepared model state into renderer-ready skinning inputs."""
    if self.is_rigid_body:
        raise NotImplementedError(f"{self.__class__.__name__} is rigid and does not support skinning.")

    skinning: SkinningPayload = {
        "rest_vertices": identity["rest_vertices"],
        "skinning_transforms": pose["skinning_transforms"],
        "skin_weights": self.skin_weights,
        "faces": self.faces,
    }
    if "pose_offsets" in pose:
        skinning["pose_offsets"] = pose["pose_offsets"]
    return skinning