(self, env)
Randomize various physical properties of the environment.

    It randomizes the physical parameters according to the input configuration.

    Args:
      env: A minitaur gym environment.
Randomize various physical properties of the environment.
Randomize various physical properties of the environment .
def randomize_env(self, env):
    """Randomize various physical properties of the environment.

    It randomizes the physical parameters according to the input configuration.

    Args:
      env: A minitaur gym environment.
    """

    if not self.suspend_randomization:
      # Use a specific seed for controllable randomization.
      if self._randomization_seed is not None:
        self._np_random.seed(self._randomization_seed)

      self._randomization_function_dict = self._build_randomization_function_dict(
          env)

      self._rejection_param_range = {}
      for param_name, random_range in sorted(
          self._randomization_param_dict.items()):
        self._randomization_function_dict[param_name](
            lower_bound=random_range[0], upper_bound=random_range[1])
        if len(random_range) == 4:
          self._rejection_param_range[param_name] = [
              random_range[2], random_range[3]
          ]
      if self._rejection_param_range:
        while self._check_all_randomization_parameter_in_rejection_range():
          for param_name, random_range in sorted(
              self._randomization_param_dict.items()):
            self._randomization_function_dict[param_name](
                lower_bound=random_range[0], upper_bound=random_range[1])
    elif self._randomization_param_value_dict:
      # Re-apply the randomization because hard_reset might change previously
      # randomized parameters.
      self.set_env_from_randomization_parameters(
          env, self._randomization_param_value_dict)
def randomize_env ( self , env ) : if not self . suspend_randomization : # Use a specific seed for controllable randomization. if self . _randomization_seed is not None : self . _np_random . seed ( self . _randomization_seed ) self . _randomization_function_dict = self . _build_randomization_function_dict ( env ) self . _rejection_param_range = { } for param_name , random_range in sorted ( self . _randomization_param_dict . items ( ) ) : self . _randomization_function_dict [ param_name ] ( lower_bound = random_range [ 0 ] , upper_bound = random_range [ 1 ] ) if len ( random_range ) == 4 : self . _rejection_param_range [ param_name ] = [ random_range [ 2 ] , random_range [ 3 ] ] if self . _rejection_param_range : while self . _check_all_randomization_parameter_in_rejection_range ( ) : for param_name , random_range in sorted ( self . _randomization_param_dict . items ( ) ) : self . _randomization_function_dict [ param_name ] ( lower_bound = random_range [ 0 ] , upper_bound = random_range [ 1 ] ) elif self . _randomization_param_value_dict : # Re-apply the randomization because hard_reset might change previously # randomized parameters. self . set_env_from_randomization_parameters ( env , self . _randomization_param_value_dict )