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

    Initializes the swimmer orientation to [-pi, pi) and the relative joint
    angle of each joint uniformly within its range.

    Args:
      physics: An instance of `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.

    Initializes the swimmer orientation to [-pi, pi) and the relative joint
    angle of each joint uniformly within its range.

    Args:
      physics: An instance of `Physics`.
    """
    # Random joint angles:
    randomizers.randomize_limited_and_rotational_joints(physics, self.random)
    # Random target position.
    close_target = self.random.rand() < .2  # Probability of a close target.
    target_box = .3 if close_target else 2
    xpos, ypos = self.random.uniform(-target_box, target_box, size=2)
    physics.named.model.geom_pos['target', 'x'] = xpos
    physics.named.model.geom_pos['target', 'y'] = ypos
    physics.named.model.light_pos['target_light', 'x'] = xpos
    physics.named.model.light_pos['target_light', 'y'] = ypos

    super().initialize_episode(physics)
def initialize_episode ( self , physics ) : # Random joint angles: randomizers . randomize_limited_and_rotational_joints ( physics , self . random ) # Random target position. close_target = self . random . rand ( ) < .2 # Probability of a close target. target_box = .3 if close_target else 2 xpos , ypos = self . random . uniform ( - target_box , target_box , size = 2 ) physics . named . model . geom_pos [ 'target' , 'x' ] = xpos physics . named . model . geom_pos [ 'target' , 'y' ] = ypos physics . named . model . light_pos [ 'target_light' , 'x' ] = xpos physics . named . model . light_pos [ 'target_light' , 'y' ] = ypos super ( ) . initialize_episode ( physics )