Post-Processing Bindings#

Post-processing utilities for motion generation output.

kimodo.postprocess.extract_input_motion_from_constraints(
constraint_lst,
skeleton,
num_frames,
num_joints,
)[source]#

Extract hip translations and local rotations from constraints for postprocessing.

Parameters:
  • constraint_lst – List of constraints (FullBodyConstraintSet, EndEffectorConstraintSet, etc.)

  • skeleton – Skeleton instance

  • num_frames – Total number of frames in the motion

  • num_joints – Number of joints

Returns:

  • hip_translations_input: Hip translations, shape (T, 3)

  • rotations_input: Local joint rotations as quaternions, shape (T, J, 4)

Return type:

Tuple of (hip_translations_input, rotations_input)

kimodo.postprocess.create_working_rig_from_skeleton(skeleton, above_ground_offset=0.007)[source]#

Create the working rig as a list of SimpleNamespace objects from skeleton.

Parameters:
  • skeleton – SkeletonBase instance with bone_order_names, neutral_joints, joint_parents

  • above_ground_offset – Additional offset to position the rig slightly above ground

Returns:

List of SimpleNamespace objects representing the working rig

kimodo.postprocess.post_process_motion(
local_rot_mats,
root_positions,
contacts,
skeleton,
constraint_lst=None,
contact_threshold=0.5,
root_margin=0.04,
)[source]#

Post-process generated motion to reduce foot skating and improve quality.

Parameters:
  • local_rot_mats – Local joint rotation matrices, shape (B, T, J, 3, 3)

  • root_positions – Root joint positions, shape (B, T, 3)

  • contacts – Foot contact labels, shape (B, T, num_contacts)

  • skeleton – Skeleton instance

  • constraint_lst – Optional list of constraints (or list of lists of constraints for batched inference)(FullBodyConstraintSet, etc.)

  • contact_threshold – Threshold for foot contact detection

  • root_margin – Margin for root position correction

Returns:

  • local_rot_mats: Corrected local rotation matrices (B, T, J, 3, 3)

  • root_positions: Corrected root positions (B, T, 3)

  • posed_joints: Corrected global joint positions (B, T, J, 3)

  • global_rot_mats: Corrected global rotation matrices (B, T, J, 3, 3)

Return type:

Dictionary with corrected motion data