Utilities
- mink.utils.move_mocap_to_frame(model: MjModel, data: MjData, mocap_name: str, frame_name: str, frame_type: str) None
Initialize mocap body pose at a desired frame.
- Parameters:
model (MjModel) – Mujoco model.
data (MjData) – Mujoco data.
mocap_name (str) – The name of the mocap body.
frame_name (str) – The desired frame name.
frame_type (str) – The desired frame type. Can be “body”, “geom” or “site”.
- Return type:
None
- mink.utils.get_freejoint_dims(model: MjModel) tuple[list[int], list[int]]
Get all floating joint configuration and tangent indices.
- Parameters:
model (MjModel) – Mujoco model.
- Returns:
A (q_ids, v_ids) pair containing all floating joint indices in the configuration and tangent spaces respectively.
- Return type:
tuple[list[int], list[int]]
- mink.utils.custom_configuration_vector(model: MjModel, key_name: str | None = None, **kwargs) ndarray
Generate a configuration vector where named joints have specific values.
- Parameters:
model (MjModel) – Mujoco model.
key_name (str | None) – Optional keyframe name to initialize the configuration vector from. Otherwise, the default pose qpos0 is used.
kwargs – Custom values for joint coordinates.
- Returns:
- Configuration vector where named joints have the values specified in
keyword arguments, and other joints have their neutral value or value defined in the keyframe if provided.
- Return type:
ndarray
- mink.utils.get_body_body_ids(model: MjModel, body_id: int) list[int]
Get immediate children bodies belonging to a given body.
- Parameters:
model (MjModel) – Mujoco model.
body_id (int) – ID of body.
- Returns:
A list containing all child body ids.
- Return type:
list[int]
- mink.utils.get_subtree_body_ids(model: MjModel, body_id: int) list[int]
Get all bodies belonging to subtree starting at a given body.
- Parameters:
model (MjModel) – Mujoco model.
body_id (int) – ID of body where subtree starts.
- Returns:
A list containing all subtree body ids.
- Return type:
list[int]
- mink.utils.get_body_geom_ids(model: MjModel, body_id: int) list[int]
Get immediate geoms belonging to a given body.
Here, immediate geoms are those directly attached to the body and not its descendants.
- Parameters:
model (MjModel) – Mujoco model.
body_id (int) – ID of body.
- Returns:
A list containing all body geom ids.
- Return type:
list[int]
- mink.utils.get_subtree_geom_ids(model: MjModel, body_id: int) list[int]
Get all geoms belonging to subtree starting at a given body.
Here, a subtree is defined as the kinematic tree starting at the body and including all its descendants.
- Parameters:
model (MjModel) – Mujoco model.
body_id (int) – ID of body where subtree starts.
- Returns:
A list containing all subtree geom ids.
- Return type:
list[int]