unilab.envs.motion_tracking.g1.motion_loader.MotionLoader

class unilab.envs.motion_tracking.g1.motion_loader.MotionLoader[source]

Bases: object

Loads and provides access to motion data from NPZ files.

Parameters:

Methods

__init__(motion_file[, body_indices])

Initialize motion loader.

get_clip_end_frames(frame_idx)

Return the inclusive global end frame for each indexed clip.

get_clip_indices(frame_idx)

Map global frame indices to clip indices.

get_motion_at_frame(frame_idx[, out])

Get motion data at specified frame indices.

make_motion_data_buffer(num_frames)

Allocate a reusable MotionData buffer for frame-index gathers.

__init__(motion_file, body_indices=None)[source]

Initialize motion loader.

Parameters:
  • motion_file (str | Sequence[str]) – Path to one NPZ file, or a sequence of NPZ files

  • body_indices (ndarray | None) – Optional indices into the NPZ body axis. The exported motion files currently keep MuJoCo body-id layout, so these indices are expected to follow that convention.

get_clip_indices(frame_idx)[source]

Map global frame indices to clip indices.

Parameters:

frame_idx (ndarray)

Return type:

ndarray

get_clip_end_frames(frame_idx)[source]

Return the inclusive global end frame for each indexed clip.

Parameters:

frame_idx (ndarray)

Return type:

ndarray

make_motion_data_buffer(num_frames)[source]

Allocate a reusable MotionData buffer for frame-index gathers.

Parameters:

num_frames (int)

Return type:

MotionData

get_motion_at_frame(frame_idx, out=None)[source]

Get motion data at specified frame indices.

Parameters:
  • frame_idx (ndarray) – Frame indices (N,)

  • out (MotionData | None) – Optional reusable output buffer.

Return type:

MotionData

Returns:

MotionData at specified frames