(self, leg_id,
                                              foot_local_position)
return joint_position_idxs, joint_angles.tolist()
Use IK to compute the motor angles, given the foot link's local position.

    Args:
      leg_id: The leg index.
      foot_local_position: The foot link's position in the base frame.

    Returns:
      A tuple. The position indices and the angles for all joints along the
      leg. The position indices is consistent with the joint orders as returned
      by GetMotorAngles API.
Use IK to compute the motor angles, given the foot link's local position.
Use IK to compute the motor angles given the foot link s local position .
def ComputeMotorAnglesFromFootLocalPosition(self, leg_id,
                                              foot_local_position):
    """Use IK to compute the motor angles, given the foot link's local position.

    Args:
      leg_id: The leg index.
      foot_local_position: The foot link's position in the base frame.

    Returns:
      A tuple. The position indices and the angles for all joints along the
      leg. The position indices is consistent with the joint orders as returned
      by GetMotorAngles API.
    """
    assert len(self._foot_link_ids) == self.num_legs
    # toe_id = self._foot_link_ids[leg_id]

    motors_per_leg = self.num_motors // self.num_legs
    joint_position_idxs = list(
        range(leg_id * motors_per_leg,
              leg_id * motors_per_leg + motors_per_leg))

    joint_angles = foot_position_in_hip_frame_to_joint_angle(
        foot_local_position - HIP_OFFSETS[leg_id],
        l_hip_sign=(-1)**(leg_id + 1))

    # Joint offset is necessary for Laikago.
    joint_angles = np.multiply(
        np.asarray(joint_angles) -
        np.asarray(self._motor_offset)[joint_position_idxs],
        self._motor_direction[joint_position_idxs])

    # Return the joing index (the same as when calling GetMotorAngles) as well
    # as the angles.
    return joint_position_idxs, joint_angles.tolist()
def ComputeMotorAnglesFromFootLocalPosition ( self , leg_id , foot_local_position ) : assert len ( self . _foot_link_ids ) == self . num_legs # toe_id = self._foot_link_ids[leg_id] motors_per_leg = self . num_motors // self . num_legs joint_position_idxs = list ( range ( leg_id * motors_per_leg , leg_id * motors_per_leg + motors_per_leg ) ) joint_angles = foot_position_in_hip_frame_to_joint_angle ( foot_local_position - HIP_OFFSETS [ leg_id ] , l_hip_sign = ( - 1 ) ** ( leg_id + 1 ) ) # Joint offset is necessary for Laikago. joint_angles = np . multiply ( np . asarray ( joint_angles ) - np . asarray ( self . _motor_offset ) [ joint_position_idxs ] , self . _motor_direction [ joint_position_idxs ] ) # Return the joing index (the same as when calling GetMotorAngles) as well # as the angles. return joint_position_idxs , joint_angles . tolist ( )