(physics, orientation, x_pos=0.0, y_pos=0.0)
Find a height with no contacts given a body orientation.

  Args:
    physics: An instance of `Physics`.
    orientation: A quaternion.
    x_pos: A float. Position along global x-axis.
    y_pos: A float. Position along global y-axis.
  Raises:
    RuntimeError: If a non-contacting configuration has not been found after
    10,000 attempts.
Find a height with no contacts given a body orientation.
Find a height with no contacts given a body orientation .
def _find_non_contacting_height(physics, orientation, x_pos=0.0, y_pos=0.0):
  """Find a height with no contacts given a body orientation.

  Args:
    physics: An instance of `Physics`.
    orientation: A quaternion.
    x_pos: A float. Position along global x-axis.
    y_pos: A float. Position along global y-axis.
  Raises:
    RuntimeError: If a non-contacting configuration has not been found after
    10,000 attempts.
  """
  z_pos = 0.0  # Start embedded in the floor.
  num_contacts = 1
  num_attempts = 0
  # Move up in 1cm increments until no contacts.
  while num_contacts > 0:
    try:
      with physics.reset_context():
        physics.named.data.qpos['root'][:3] = x_pos, y_pos, z_pos
        physics.named.data.qpos['root'][3:] = orientation
    except control.PhysicsError:
      # We may encounter a PhysicsError here due to filling the contact
      # buffer, in which case we simply increment the height and continue.
      pass
    num_contacts = physics.data.ncon
    z_pos += 0.01
    num_attempts += 1
    if num_attempts > 10000:
      raise RuntimeError('Failed to find a non-contacting configuration.')
def _find_non_contacting_height ( physics , orientation , x_pos = 0.0 , y_pos = 0.0 ) : z_pos = 0.0 # Start embedded in the floor. num_contacts = 1 num_attempts = 0 # Move up in 1cm increments until no contacts. while num_contacts > 0 : try : with physics . reset_context ( ) : physics . named . data . qpos [ 'root' ] [ : 3 ] = x_pos , y_pos , z_pos physics . named . data . qpos [ 'root' ] [ 3 : ] = orientation except control . PhysicsError : # We may encounter a PhysicsError here due to filling the contact # buffer, in which case we simply increment the height and continue. pass num_contacts = physics . data . ncon z_pos += 0.01 num_attempts += 1 if num_attempts > 10000 : raise RuntimeError ( 'Failed to find a non-contacting configuration.' )