(leg_pose)
return motor_angles
Converts the leg pose to the motor angles.

  Args:
    leg_pose: A numpy array. Contains the leg pose for all four legs: [swing_0,
      swing_1, swing_2, swing_3, extension_0, extension_1, extension_2,
      extension_3]

  Returns:
    A numpy array. All eight motor angles.
Converts the leg pose to the motor angles.
Converts the leg pose to the motor angles .
def leg_pose_to_motor_angles(leg_pose):
  """Converts the leg pose to the motor angles.

  Args:
    leg_pose: A numpy array. Contains the leg pose for all four legs: [swing_0,
      swing_1, swing_2, swing_3, extension_0, extension_1, extension_2,
      extension_3]

  Returns:
    A numpy array. All eight motor angles.
  """
  leg_pose = np.array(leg_pose)

  # swings multiplied with the sign array.
  signed_swings = np.multiply(np.array(MOTOR_SIGNS), leg_pose[0:NUM_LEGS])
  extensions = leg_pose[NUM_LEGS:]

  motor_angles = np.zeros(NUM_MOTORS)
  motor_angles[1::2] = signed_swings + extensions
  motor_angles[::2] = extensions - signed_swings
  return motor_angles
def leg_pose_to_motor_angles ( leg_pose ) : leg_pose = np . array ( leg_pose ) # swings multiplied with the sign array. signed_swings = np . multiply ( np . array ( MOTOR_SIGNS ) , leg_pose [ 0 : NUM_LEGS ] ) extensions = leg_pose [ NUM_LEGS : ] motor_angles = np . zeros ( NUM_MOTORS ) motor_angles [ 1 : : 2 ] = signed_swings + extensions motor_angles [ : : 2 ] = extensions - signed_swings return motor_angles