original_docstring:  create constraint on ankle position and orientation 
docstring: create constraint on ankle position and orientation
docstring_tokens: create constraint on ankle position and orientation
code: def create_ankle_constraint(skeleton, frames, ankle_joint_name, heel_joint_name, toe_joint, frame_idx, end_frame, ground_height):
      """ create constraint on ankle position and orientation """
      c = get_average_joint_position(skeleton, frames, heel_joint_name, frame_idx, end_frame)
      c[1] = ground_height
      a = get_average_joint_position(skeleton, frames, ankle_joint_name, frame_idx, end_frame)
      h = get_average_joint_position(skeleton, frames, heel_joint_name, frame_idx, end_frame)
      target_heel_offset = a - h
      ca = c + target_heel_offset
      avg_direction = None
      if len(skeleton.nodes[ankle_joint_name].children) > 0:
          avg_direction = get_average_direction_from_target(skeleton, frames, ca, toe_joint,
                                                      frame_idx, end_frame)
          toe_length = np.linalg.norm(skeleton.nodes[toe_joint].offset)
          ct = ca + avg_direction * toe_length
          ct[1] = ground_height
          avg_direction = normalize(ct - ca)
      return MotionGroundingConstraint(frame_idx, ankle_joint_name, ca, avg_direction)
code_tokens: def create_ankle_constraint ( skeleton , frames , ankle_joint_name , heel_joint_name , toe_joint , frame_idx , end_frame , ground_height ) : c = get_average_joint_position ( skeleton , frames , heel_joint_name , frame_idx , end_frame ) c [ 1 ] = ground_height a = get_average_joint_position ( skeleton , frames , ankle_joint_name , frame_idx , end_frame ) h = get_average_joint_position ( skeleton , frames , heel_joint_name , frame_idx , end_frame ) target_heel_offset = a - h ca = c + target_heel_offset avg_direction = None if len ( skeleton . nodes [ ankle_joint_name ] . children ) > 0 : avg_direction = get_average_direction_from_target ( skeleton , frames , ca , toe_joint , frame_idx , end_frame ) toe_length = np . linalg . norm ( skeleton . nodes [ toe_joint ] . offset ) ct = ca + avg_direction * toe_length ct [ 1 ] = ground_height avg_direction = normalize ( ct - ca ) return MotionGroundingConstraint ( frame_idx , ankle_joint_name , ca , avg_direction )
short_docstring: create constraint on ankle position and orientation
short_docstring_tokens: create constraint on ankle position and orientation
comment: """ create constraint on ankle position and orientation """