(self, physics)
Sets the state of the environment at the start of each episode.

       If _randomize_gains is True, the relationship between the controls and
       the joints is randomized, so that each control actuates a random linear
       combination of joints.

    Args:
      physics: An instance of `mujoco.Physics`.
Sets the state of the environment at the start of each episode.
Sets the state of the environment at the start of each episode .
def initialize_episode(self, physics):
    """Sets the state of the environment at the start of each episode.

       If _randomize_gains is True, the relationship between the controls and
       the joints is randomized, so that each control actuates a random linear
       combination of joints.

    Args:
      physics: An instance of `mujoco.Physics`.
    """
    randomizers.randomize_limited_and_rotational_joints(physics, self.random)
    if self._randomize_gains:
      dir1 = self.random.randn(2)
      dir1 /= np.linalg.norm(dir1)
      # Find another actuation direction that is not 'too parallel' to dir1.
      parallel = True
      while parallel:
        dir2 = self.random.randn(2)
        dir2 /= np.linalg.norm(dir2)
        parallel = abs(np.dot(dir1, dir2)) > 0.9
      physics.model.wrap_prm[[0, 1]] = dir1
      physics.model.wrap_prm[[2, 3]] = dir2
    super().initialize_episode(physics)
def initialize_episode ( self , physics ) : randomizers . randomize_limited_and_rotational_joints ( physics , self . random ) if self . _randomize_gains : dir1 = self . random . randn ( 2 ) dir1 /= np . linalg . norm ( dir1 ) # Find another actuation direction that is not 'too parallel' to dir1. parallel = True while parallel : dir2 = self . random . randn ( 2 ) dir2 /= np . linalg . norm ( dir2 ) parallel = abs ( np . dot ( dir1 , dir2 ) ) > 0.9 physics . model . wrap_prm [ [ 0 , 1 ] ] = dir1 physics . model . wrap_prm [ [ 2 , 3 ] ] = dir2 super ( ) . initialize_episode ( physics )