protomotions.agents.evaluators.smoothness_evaluator module¶
- class protomotions.agents.evaluators.smoothness_evaluator.SmoothnessEvaluator(device, dt=0.03333333333333333, window_sec=0.4, high_jerk_threshold=6500.0)[source]¶
Bases:
objectEvaluator for motion smoothness metrics like normalized jerk.
This class computes smoothness metrics from collected motion data, particularly using rigid body positions to derive velocity via finite differences and then computing normalized jerk.
- __init__(device, dt=0.03333333333333333, window_sec=0.4, high_jerk_threshold=6500.0)[source]¶
Initialize the smoothness evaluator.
- Parameters:
- compute_normalized_jerk_from_pos(rigid_body_pos_metric, num_bodies, window_sec=0.4, eps=0.1)[source]¶
Compute normalized jerk from rigid body position data using sliding windows.
Similar to motion_visualizer_smoothness.py, computes normalized jerk over rolling windows rather than the entire motion sequence.
The normalized jerk is computed as: NJ = (T^5 * ∫|jerk|^2 dt) / (path_length^2)
Using T^5 makes the metric dimensionless and FPS-invariant, allowing fair comparison across motions sampled at different frame rates.
- Parameters:
rigid_body_pos_metric (MotionMetrics) – MotionMetrics containing rigid body positions Shape: [num_motions, max_frames, num_bodies*3]
num_bodies (int) – Number of rigid bodies
window_sec (float) – Window size in seconds for rolling window computation
eps (float) – Small epsilon for numerical stability
- Returns:
Mean normalized jerk per motion [num_motions] per_body_per_motion_nj: Mean normalized jerk per body per motion [num_motions, num_bodies] windowed_nj_per_motion: List of windowed NJ tensors per motion [num_windows, num_bodies]
- Return type:
per_motion_nj