parameters: (
      robot: typing.Any,
      link_id: int,
  )
return_statement: return jacobian
docstring: Computes the Jacobian matrix for the given link.
  
    Args:
      robot: A robot instance.
      link_id: The link id as returned from loadURDF.
  
    Returns:
      The 3 x N transposed Jacobian matrix. where N is the total DoFs of the
      robot. For a quadruped, the first 6 columns of the matrix corresponds to
      the CoM translation and rotation. The columns corresponds to a leg can be
      extracted with indices [6 + leg_id * 3: 6 + leg_id * 3 + 3].
docstring_summary: Computes the Jacobian matrix for the given link.
docstring_tokens: Computes the Jacobian matrix for the given link .
function: def compute_jacobian(
      robot: typing.Any,
      link_id: int,
  ):
    """Computes the Jacobian matrix for the given link.
  
    Args:
      robot: A robot instance.
      link_id: The link id as returned from loadURDF.
  
    Returns:
      The 3 x N transposed Jacobian matrix. where N is the total DoFs of the
      robot. For a quadruped, the first 6 columns of the matrix corresponds to
      the CoM translation and rotation. The columns corresponds to a leg can be
      extracted with indices [6 + leg_id * 3: 6 + leg_id * 3 + 3].
    """
  
    all_joint_angles = [state[0] for state in robot.joint_states]
    zero_vec = [0] * len(all_joint_angles)
    jv, _ = robot.pybullet_client.calculateJacobian(robot.quadruped, link_id,
                                                    (0, 0, 0), all_joint_angles,
                                                    zero_vec, zero_vec)
    jacobian = np.array(jv)
    assert jacobian.shape[0] == 3
    return jacobian
function_tokens: def compute_jacobian ( robot : typing . Any , link_id : int , ) : all_joint_angles = [ state [ 0 ] for state in robot . joint_states ] zero_vec = [ 0 ] * len ( all_joint_angles ) jv , _ = robot . pybullet_client . calculateJacobian ( robot . quadruped , link_id , ( 0 , 0 , 0 ) , all_joint_angles , zero_vec , zero_vec ) jacobian = np . array ( jv ) assert jacobian . shape [ 0 ] == 3 return jacobian