(self, 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.
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."""

    quat = self.random.randn(4)
    physics.named.data.qpos['root'][3:7] = quat / np.linalg.norm(quat)
    for joint in _JOINTS:
      physics.named.data.qpos[joint] = self.random.uniform(-.2, .2)
    # Randomize target position.
    physics.named.model.geom_pos['target', 'x'] = self.random.uniform(-.4, .4)
    physics.named.model.geom_pos['target', 'y'] = self.random.uniform(-.4, .4)
    physics.named.model.geom_pos['target', 'z'] = self.random.uniform(.1, .3)
    super().initialize_episode(physics)
def initialize_episode ( self , physics ) : quat = self . random . randn ( 4 ) physics . named . data . qpos [ 'root' ] [ 3 : 7 ] = quat / np . linalg . norm ( quat ) for joint in _JOINTS : physics . named . data . qpos [ joint ] = self . random . uniform ( - .2 , .2 ) # Randomize target position. physics . named . model . geom_pos [ 'target' , 'x' ] = self . random . uniform ( - .4 , .4 ) physics . named . model . geom_pos [ 'target' , 'y' ] = self . random . uniform ( - .4 , .4 ) physics . named . model . geom_pos [ 'target' , 'z' ] = self . random . uniform ( .1 , .3 ) super ( ) . initialize_episode ( physics )