(self, action)
Updates the environment using the action and returns a `TimeStep`.
Updates the environment using the action and returns a `TimeStep`.
Updates the environment using the action and returns a TimeStep .
def step(self, action):
    """Updates the environment using the action and returns a `TimeStep`."""

    if self._reset_next_step:
      return self.reset()

    self._task.before_step(action, self._physics)
    for _ in range(self._n_sub_steps):
      self._physics.step()
    self._task.after_step(self._physics)

    reward = self._task.get_reward(self._physics)
    observation = self._task.get_observation(self._physics)
    if self._flat_observation:
      observation = flatten_observation(observation)

    self._step_count += 1
    if self._step_count >= self._step_limit:
      discount = 1.0
    else:
      discount = self._task.get_termination(self._physics)

    episode_over = discount is not None

    if episode_over:
      self._reset_next_step = True
      return dm_env.TimeStep(
          dm_env.StepType.LAST, reward, discount, observation)
    else:
      return dm_env.TimeStep(dm_env.StepType.MID, reward, 1.0, observation)
def step ( self , action ) : if self . _reset_next_step : return self . reset ( ) self . _task . before_step ( action , self . _physics ) for _ in range ( self . _n_sub_steps ) : self . _physics . step ( ) self . _task . after_step ( self . _physics ) reward = self . _task . get_reward ( self . _physics ) observation = self . _task . get_observation ( self . _physics ) if self . _flat_observation : observation = flatten_observation ( observation ) self . _step_count += 1 if self . _step_count >= self . _step_limit : discount = 1.0 else : discount = self . _task . get_termination ( self . _physics ) episode_over = discount is not None if episode_over : self . _reset_next_step = True return dm_env . TimeStep ( dm_env . StepType . LAST , reward , discount , observation ) else : return dm_env . TimeStep ( dm_env . StepType . MID , reward , 1.0 , observation )