class_docstr: A simple 2D point environment.
  
  Args:
      goal (np.ndarray): A 2D array representing the goal position
      arena_size (float): The size of arena where the point is constrained
          within (-arena_size, arena_size) in each dimension
      done_bonus (float): A numerical bonus added to the reward
          once the point as reached the goal
      never_done (bool): Never send a `done` signal, even if the
          agent achieves the goal
      max_episode_length (int): The maximum steps allowed for an episode.
class_docstr_tok: ["A","simple","2D","point","environment",".","Args",":","goal","(","np.ndarray",")",":","A","2D","array","representing","the","goal","position","arena_size","(","float",")",":","The","size","of","arena","where","the","point","is","constrained","within","(","-arena_size",",","arena_size",")","in","each","dimension","done_bonus","(","float",")",":","A","numerical","bonus","added","to","the","reward","once","the","point","as","reached","the","goal","never_done","(","bool",")",":","Never","send","a","`","done","`","signal",",","even","if","the","agent","achieves","the","goal","max_episode_length","(","int",")",":","The","maximum","steps","allowed","for","an","episode","."]
docstr: Step the environment.
  
  Args:
      action (np.ndarray): An action provided by the agent.
  
  Returns:
      EnvStep: The environment step resulting from the action.
  
  Raises:
      RuntimeError: if `step()` is called after the environment
      has been
          constructed and `reset()` has not been called.
docstr_tok: ["Step","the","environment",".","Args",":","action","(","np.ndarray",")",":","An","action","provided","by","the","agent",".","Returns",":","EnvStep",":","The","environment","step","resulting","from","the","action",".","Raises",":","RuntimeError",":","if","`","step","(",")","`","is","called","after","the","environment","has","been","constructed","and","`","reset","(",")","`","has","not","been","called","."]
code: def step(self, action):
      """Step the environment.
  
      Args:
          action (np.ndarray): An action provided by the agent.
  
      Returns:
          EnvStep: The environment step resulting from the action.
  
      Raises:
          RuntimeError: if `step()` is called after the environment
          has been
              constructed and `reset()` has not been called.
  
      """
      if self._step_cnt is None:
          raise RuntimeError("reset() must be called before step()!")
  
      # enforce action space
      a = (
          action.copy()
      )  # NOTE: we MUST copy the action before modifying it
      a = np.clip(a, self.action_space.low, self.action_space.high)
  
      self._point = np.clip(
          self._point + a, -self._arena_size, self._arena_size
      )
      if self._visualize:
          print(self.render("ascii"))
  
      dist = np.linalg.norm(self._point - self._goal)
      succ = dist < np.linalg.norm(self.action_space.low)
  
      # dense reward
      reward = -dist
      # done bonus
      if succ:
          reward += self._done_bonus
      # Type conversion
      if not isinstance(reward, float):
          reward = float(reward)
  
      # sometimes we don't want to terminate
      done = succ and not self._never_done
  
      obs = np.concatenate([self._point, (dist,)])
  
      self._step_cnt += 1
  
      step_type = StepType.get_step_type(
          step_cnt=self._step_cnt,
          max_episode_length=self._max_episode_length,
          done=done,
      )
  
      if step_type in (StepType.TERMINAL, StepType.TIMEOUT):
          self._step_cnt = None
  
      return EnvStep(
          env_spec=self.spec,
          action=action,
          reward=reward,
          observation=obs,
          env_info={"task": self._task, "success": succ},
          step_type=step_type,
      )
  
file_path: garage/src/garage/envs/point_env.py
imports: import math
  import akro
  import numpy
  from garage import Environment, EnvSpec, EnvStep, StepType
label_desc: Use image node_id 7 for calling the PointEnv obj's underlying member method code with example usage: obj.step(action) and returns: EnvStep