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

    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.

    Args:
      physics: An instance of `Physics`.

    """
    # Find a collision-free random initial position of the ball.
    penetrating = True
    while penetrating:
      # Assign a random ball position.
      physics.named.data.qpos['ball_x'] = self.random.uniform(-.2, .2)
      physics.named.data.qpos['ball_z'] = self.random.uniform(.2, .5)
      # Check for collisions.
      physics.after_reset()
      penetrating = physics.data.ncon > 0
    super().initialize_episode(physics)
def initialize_episode ( self , physics ) : # Find a collision-free random initial position of the ball. penetrating = True while penetrating : # Assign a random ball position. physics . named . data . qpos [ 'ball_x' ] = self . random . uniform ( - .2 , .2 ) physics . named . data . qpos [ 'ball_z' ] = self . random . uniform ( .2 , .5 ) # Check for collisions. physics . after_reset ( ) penetrating = physics . data . ncon > 0 super ( ) . initialize_episode ( physics )