(
  self,
    robot,
    link_position,
    link_id,
    joint_ids,
    position_in_world_frame,
    base_translation = (0, 0, 0),
    base_rotation = (0, 0, 0, 1))
return joint_angles
Uses Inverse Kinematics to calculate joint angles.

    Args:
      robot: A robot instance.
      link_position: The (x, y, z) of the link in the body or the world frame,
        depending on whether the argument position_in_world_frame is true.
      link_id: The link id as returned from loadURDF.
      joint_ids: The positional index of the joints. This can be different from
        the joint unique ids.
      position_in_world_frame: Whether the input link_position is specified
        in the world frame or the robot's base frame.
      base_translation: Additional base translation.
      base_rotation: Additional base rotation.

    Returns:
      A list of joint angles.
Uses Inverse Kinematics to calculate joint angles.
Uses Inverse Kinematics to calculate joint angles .
def joint_angles_from_link_position(
  self,
    robot,
    link_position,
    link_id,
    joint_ids,
    position_in_world_frame,
    base_translation = (0, 0, 0),
    base_rotation = (0, 0, 0, 1)):
    """Uses Inverse Kinematics to calculate joint angles.

    Args:
      robot: A robot instance.
      link_position: The (x, y, z) of the link in the body or the world frame,
        depending on whether the argument position_in_world_frame is true.
      link_id: The link id as returned from loadURDF.
      joint_ids: The positional index of the joints. This can be different from
        the joint unique ids.
      position_in_world_frame: Whether the input link_position is specified
        in the world frame or the robot's base frame.
      base_translation: Additional base translation.
      base_rotation: Additional base rotation.

    Returns:
      A list of joint angles.
    """
    if not position_in_world_frame:
      # Projects to local frame.
      base_position, base_orientation = self.pybullet_client.getBasePositionAndOrientation(self.quadruped)#robot.GetBasePosition(), robot.GetBaseOrientation()
      base_position, base_orientation = robot.pybullet_client.multiplyTransforms(
          base_position, base_orientation, base_translation, base_rotation)

      # Projects to world space.
      world_link_pos, _ = robot.pybullet_client.multiplyTransforms(
          base_position, base_orientation, link_position, _IDENTITY_ORIENTATION)
    else:
      world_link_pos = link_position

    ik_solver = 0
    all_joint_angles = robot.pybullet_client.calculateInverseKinematics(
        robot.quadruped, link_id, world_link_pos, solver=ik_solver)

    # Extract the relevant joint angles.
    joint_angles = [all_joint_angles[i] for i in joint_ids]
    return joint_angles
def joint_angles_from_link_position ( self , robot , link_position , link_id , joint_ids , position_in_world_frame , base_translation = ( 0 , 0 , 0 ) , base_rotation = ( 0 , 0 , 0 , 1 ) ) : if not position_in_world_frame : # Projects to local frame. base_position , base_orientation = self . pybullet_client . getBasePositionAndOrientation ( self . quadruped ) #robot.GetBasePosition(), robot.GetBaseOrientation() base_position , base_orientation = robot . pybullet_client . multiplyTransforms ( base_position , base_orientation , base_translation , base_rotation ) # Projects to world space. world_link_pos , _ = robot . pybullet_client . multiplyTransforms ( base_position , base_orientation , link_position , _IDENTITY_ORIENTATION ) else : world_link_pos = link_position ik_solver = 0 all_joint_angles = robot . pybullet_client . calculateInverseKinematics ( robot . quadruped , link_id , world_link_pos , solver = ik_solver ) # Extract the relevant joint angles. joint_angles = [ all_joint_angles [ i ] for i in joint_ids ] return joint_angles