unilab.envs.motion_tracking.g1.motion_box_loader.BoxMotionLoader

class unilab.envs.motion_tracking.g1.motion_box_loader.BoxMotionLoader[source]

Bases: MotionLoader

Motion loader that also loads object state from NPZ files.

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 – Path to one NPZ file, or a sequence of NPZ files

  • body_indices – 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_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:

BoxMotionData

Returns:

MotionData at specified frames

get_clip_end_frames(frame_idx)

Return the inclusive global end frame for each indexed clip.

Parameters:

frame_idx (ndarray)

Return type:

ndarray

get_clip_indices(frame_idx)

Map global frame indices to clip indices.

Parameters:

frame_idx (ndarray)

Return type:

ndarray

make_motion_data_buffer(num_frames)

Allocate a reusable MotionData buffer for frame-index gathers.

Parameters:

num_frames (int)

Return type:

MotionData