G1¶
G1 is a rigid articulated Unitree G1 model with STL link meshes attached to the Kimodo 34-joint skeleton.
Setup¶
G1 downloads automatically on first use from https://huggingface.co/abcamiletto/body-models.
The Hugging Face repo records the original GR00T-WholeBodyControl / LeRobot provenance. To prefetch
and save the path:
# Download the Unitree G1 XML and link meshes.
body-models download g1
When passed manually, model_path should contain xml/g1.xml and meshes/g1/*.STL.
Notes¶
G1 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.robots.g1.numpy.G1
¶
G1(model_path=None, *, convention='soma')
Bases: RigidBodyModel
Unitree G1 as rigid STL links attached to the Kimodo 34-joint skeleton.
Initialize the G1 model.
| PARAMETER | DESCRIPTION |
|---|---|
model_path
|
Path to model assets, or the default assets when omitted.
TYPE:
|
convention
|
Skeleton convention used when loading rigid model data.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
forward_skeleton |
Compute posed joint transforms. |
forward_meshes |
Compute posed model meshes. |
joint_index |
Resolve a standard joint to this model's native joint index. |
unpack_pose |
Unpack a flattened pose |
pack_pose |
Pack |
to_qpos |
Build full MuJoCo |
| ATTRIBUTE | DESCRIPTION |
|---|---|
common_joints |
Common anatomical joints mapped to this model's native joint names.
TYPE:
|
num_actuated |
Number of actuated pose coordinates.
TYPE:
|
actuated_joint_slices |
Consecutive scalar coordinate slices keyed by actuated joint name.
TYPE:
|
Source code in src/body_models/robots/g1/numpy.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
common_joints
property
¶
common_joints
Common anatomical joints mapped to this model's native joint names.
actuated_joint_slices
property
¶
actuated_joint_slices
Consecutive scalar coordinate slices keyed by actuated joint name.
forward_skeleton
¶
forward_skeleton(
body_pose,
global_translation=None,
*,
global_rotation=None,
joint_indices=None,
)
Compute posed joint transforms.
| PARAMETER | DESCRIPTION |
|---|---|
body_pose
|
Local hinge coordinates.
TYPE:
|
global_translation
|
Global model translation.
TYPE:
|
global_rotation
|
Global model rotation.
TYPE:
|
joint_indices
|
Optional subset of joints to return.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Float[ndarray, 'B J 4 4']
|
Joint transforms in the model hierarchy. |
Source code in src/body_models/robots/g1/numpy.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
forward_meshes
¶
forward_meshes(
body_pose, global_translation=None, *, global_rotation=None
)
Compute posed model meshes.
| PARAMETER | DESCRIPTION |
|---|---|
body_pose
|
Local hinge coordinates.
TYPE:
|
global_translation
|
Global model translation.
TYPE:
|
global_rotation
|
Global model rotation.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Trimesh]
|
One posed model mesh per batch element. |
Source code in src/body_models/robots/g1/numpy.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
joint_index
¶
joint_index(joint)
Resolve a standard joint to this model's native joint index.
Source code in src/body_models/base.py
190 191 192 193 194 195 196 197 198 | |
unpack_pose
¶
unpack_pose(pose)
Unpack a flattened pose [..., Q] into name -> [..., dof] arrays.
Source code in src/body_models/base.py
270 271 272 273 274 | |
pack_pose
¶
pack_pose(pose_by_joint)
Pack name -> [..., dof] arrays into a flattened pose [..., Q].
Source code in src/body_models/base.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
to_qpos
¶
to_qpos(
body_pose,
global_translation=None,
*,
global_rotation=None,
clamp_to_limits=False,
)
Build full MuJoCo qpos as [root_xyz, root_wxyz, body_pose].
body_pose is the model's flattened scalar coordinate vector [..., Q].
The root prefix is converted from the model coordinate frame to MuJoCo's
coordinate frame.
Source code in src/body_models/base.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |