unilab.envs.motion_tracking.g1.motion_loader¶
Motion loading and sampling for motion tracking tasks.
Classes
Container for motion data at specific frame(s). |
|
Loads and provides access to motion data from NPZ files. |
|
Handles motion frame sampling with different strategies. |
- class unilab.envs.motion_tracking.g1.motion_loader.MotionData[source]¶
Bases:
objectContainer for motion data at specific frame(s).
- Parameters:
- class unilab.envs.motion_tracking.g1.motion_loader.MotionLoader[source]¶
Bases:
objectLoads and provides access to motion data from NPZ files.
- get_clip_end_frames(frame_idx)[source]¶
Return the inclusive global end frame for each indexed clip.
- make_motion_data_buffer(num_frames)[source]¶
Allocate a reusable
MotionDatabuffer for frame-index gathers.- Parameters:
num_frames (
int)- Return type:
- 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:
- Returns:
MotionData at specified frames
- class unilab.envs.motion_tracking.g1.motion_loader.MotionSampler[source]¶
Bases:
objectHandles motion frame sampling with different strategies.
- Parameters:
- __init__(motion_loader, mode, num_envs, bin_count=None, adaptive_lambda=0.8, adaptive_kernel_size=1, adaptive_uniform_ratio=0.1, adaptive_alpha=0.001, start_ratio=0.0)[source]¶
Initialize motion sampler.
- Parameters:
motion_loader (
MotionLoader) – Motion loader instancemode (
Literal['start','clip_start','uniform','adaptive','mixed']) – Sampling mode (“start”, “clip_start”, “uniform”, “adaptive”, “mixed”)num_envs (
int) – Number of parallel environmentsbin_count (
int|None) – Number of bins for adaptive sampling (auto if None)adaptive_lambda (
float) – Decay factor for adaptive kerneladaptive_kernel_size (
int) – Kernel size for adaptive samplingadaptive_uniform_ratio (
float) – Uniform sampling ratio for adaptive modeadaptive_alpha (
float) – EMA alpha for failure count updatesstart_ratio (
float) – Fraction of envs forced to frame 0 in “mixed” mode (remaining envs are uniformly sampled). Lets buffer concentrate launch-transition samples while keeping motion-clip coverage.
- update_failure_stats(terminated, current_frames=None)[source]¶
Update failure statistics for adaptive sampling.
- get_current_motion(out=None)[source]¶
Get motion data at current frames for all environments.
- Parameters:
out (
MotionData|None)- Return type: