popgym.wrappers.previous_action =============================== .. py:module:: popgym.wrappers.previous_action Attributes ---------- .. autoapisummary:: popgym.wrappers.previous_action.PREV_ACTION Classes ------- .. autoapisummary:: popgym.wrappers.previous_action.PreviousAction Module Contents --------------- .. py:data:: PREV_ACTION :value: 'prev_action' .. py:class:: PreviousAction(env: popgym.core.env.POPGymEnv, null_action: Optional[gymnasium.core.ActType] = None) Bases: :py:obj:`popgym.core.wrapper.POPGymWrapper` Wrapper that adds the last action to the observation. Args: env: The environment null_action: Optional null action that is returned when resetting the environment. If not provided, the null action will be 0 (int or vector) if it is in the action space, or the lowest action possible. Returns: A gym environment .. py:attribute:: observation_space Return the :attr:`Env` :attr:`observation_space` unless overwritten then the wrapper :attr:`observation_space` is used. .. py:attribute:: null_action :value: None .. py:method:: add_act_space_to_obs_space(observation_space: gymnasium.spaces.Space, action_space: gymnasium.spaces.Space) -> gymnasium.spaces.Space :staticmethod: Returns a modified observation space to account for the last action. Args: observation_space: Original observation space action_space: Action space Returns: The new observation space .. py:method:: add_act_to_obs(observation_space: gymnasium.spaces.Space, obs: gymnasium.core.ObsType, action: gymnasium.core.ActType) -> gymnasium.core.ObsType :staticmethod: Static method that adds the action to the observation. Args: observation_space: Original observation space of the environment. obs: The observation. action: The action. Returns: Modified observation. .. py:method:: get_null_action(action_space: gymnasium.spaces.Space) -> gymnasium.core.ActType :staticmethod: Static method that generates a null action based on the action space. Args: action_space: The action space. Returns: The null action. .. py:method:: step(action: gymnasium.core.ActType) -> Tuple[gymnasium.core.ObsType, float, bool, bool, dict] Uses the :meth:`step` of the :attr:`env` that can be overwritten to change the returned data. .. py:method:: reset(**kwargs) Uses the :meth:`reset` of the :attr:`env` that can be overwritten to change the returned data.