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

  Args:
    physics: An instance of `Physics`.
    walker: the focal walker.
    orientation: A quaternion.
    x_pos: A float. Position along global x-axis.
    y_pos: A float. Position along global y-axis.
    maxiter: maximum number of iterations to try
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, walker, orientation,
                                x_pos=0.0, y_pos=0.0, maxiter=1000):
  """Find a height with no contacts given a body orientation.

  Args:
    physics: An instance of `Physics`.
    walker: the focal walker.
    orientation: A quaternion.
    x_pos: A float. Position along global x-axis.
    y_pos: A float. Position along global y-axis.
    maxiter: maximum number of iterations to try
  """
  z_pos = 0.0  # Start embedded in the floor.
  num_contacts = 1
  count = 1
  # Move up in 1cm increments until no contacts.
  while num_contacts > 0:
    try:
      with physics.reset_context():
        freejoint = mjcf.get_frame_freejoint(walker.mjcf_model)
        physics.bind(freejoint).qpos[:3] = x_pos, y_pos, z_pos
        physics.bind(freejoint).qpos[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
    count += 1
    if count > maxiter:
      raise ValueError(
          'maxiter reached: possibly contacts in null pose of body.'
      )
def _find_non_contacting_height ( physics , walker , orientation , x_pos = 0.0 , y_pos = 0.0 , maxiter = 1000 ) : z_pos = 0.0 # Start embedded in the floor. num_contacts = 1 count = 1 # Move up in 1cm increments until no contacts. while num_contacts > 0 : try : with physics . reset_context ( ) : freejoint = mjcf . get_frame_freejoint ( walker . mjcf_model ) physics . bind ( freejoint ) . qpos [ : 3 ] = x_pos , y_pos , z_pos physics . bind ( freejoint ) . qpos [ 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 count += 1 if count > maxiter : raise ValueError ( 'maxiter reached: possibly contacts in null pose of body.' )