(self, actions)
return motor_angle
Convert the actions that use leg model to the real motor actions.

    Args:
      actions: The theta, phi of the leg model.

    Returns:
      The eight desired motor angles that can be used in ApplyActions().
Convert the actions that use leg model to the real motor actions.
Convert the actions that use leg model to the real motor actions .
def ConvertFromLegModel(self, actions):
    """Convert the actions that use leg model to the real motor actions.

    Args:
      actions: The theta, phi of the leg model.

    Returns:
      The eight desired motor angles that can be used in ApplyActions().
    """
    motor_angle = copy.deepcopy(actions)
    scale_for_singularity = 1
    offset_for_singularity = 1.5
    half_num_motors = self.num_motors // 2
    quater_pi = math.pi / 4
    for i in range(self.num_motors):
      action_idx = i // 2
      forward_backward_component = (
          -scale_for_singularity * quater_pi *
          (actions[action_idx + half_num_motors] + offset_for_singularity))
      extension_component = (-1)**i * quater_pi * actions[action_idx]
      if i >= half_num_motors:
        extension_component = -extension_component
      motor_angle[i] = (math.pi + forward_backward_component +
                        extension_component)
    return motor_angle
def ConvertFromLegModel ( self , actions ) : motor_angle = copy . deepcopy ( actions ) scale_for_singularity = 1 offset_for_singularity = 1.5 half_num_motors = self . num_motors // 2 quater_pi = math . pi / 4 for i in range ( self . num_motors ) : action_idx = i // 2 forward_backward_component = ( - scale_for_singularity * quater_pi * ( actions [ action_idx + half_num_motors ] + offset_for_singularity ) ) extension_component = ( - 1 ) ** i * quater_pi * actions [ action_idx ] if i >= half_num_motors : extension_component = - extension_component motor_angle [ i ] = ( math . pi + forward_backward_component + extension_component ) return motor_angle