schola.sb3.utils.RenderImagesWrapper
class schola.sb3.utils.RenderImagesWrapper(venv)
: Bases: VecEnvWrapper
Renders image observations to an interactive matplotlib window. It assumes that the observations are square RGB images, and attempts to reshape any box observation to 3xLxL.
Parameters: : venv (VecEnv) – The vectorized environment being wrapped.
Methods
__init__ (venv) | |
close () | Clean up the environment’s resources. |
convert_to_plt_format (obs) | Convert to a format supported by matplotlib. |
env_is_wrapped (wrapper_class[, indices]) | Check if environments are wrapped with a given wrapper. |
env_method (method_name, *method_args[, indices]) | Call instance methods of vectorized environments. |
get_attr (attr_name[, indices]) | Return attribute from vectorized environment. |
get_images () | Return RGB images from each environment when available |
getattr_depth_check (name, already_found) | See base class. |
getattr_recursive (name) | Recursively check wrappers to find attribute. |
render ([mode]) | Gym environment rendering |
reset () | Reset all the environments and return an array of observations, or a tuple of observation arrays. |
seed ([seed]) | Sets the random seeds for all environments, based on a given seed. |
set_attr (attr_name, value[, indices]) | Set attribute inside vectorized environments. |
step (action) | Step the environments with the given action |
step_async (actions) | Tell all the environments to start taking a step with the given actions. |
step_wait () | Wait for the step taken with step_async(). |
update_images (obs) | Updates the images in the plt window with the given observations. |
Attributes
unwrapped |
__init__(venv) : Parameters: : venv (VecEnv)
close() : Clean up the environment’s resources.
convert_to_plt_format(obs) : Convert to a format supported by matplotlib. (e.g. (W,H), (W,H,3), and (W,H,4)). No Chanels or Chanels last, from Chanels first.
Parameters: : obs (np.ndarray) – The observation to convert.
Returns: : The converted observation.
Return type: : np.ndarray
reset() : Reset all the environments and return an array of observations, or a tuple of observation arrays.
If step_async is still doing work, that work will be cancelled and step_wait() should not be called until step_async() is invoked again.
Returns: : observation
Return type: : ndarray | Dict[str, ndarray] | Tuple[ndarray, …]
step(action) : Step the environments with the given action
Parameters: : - actions – the action
- action (ndarray)
Returns: : observation, reward, done, information
Return type: : Tuple[ndarray | Dict[str, ndarray] | Tuple[ndarray, …], ndarray, ndarray, List[Dict]]
step_async(actions) : Tell all the environments to start taking a step with the given actions. Call step_wait() to get the results of the step.
You should not call this if a step_async run is already pending.
Parameters: : actions (ndarray)
Return type: : None
step_wait() : Wait for the step taken with step_async().
Returns: : observation, reward, done, information
Return type: : Tuple[ndarray | Dict[str, ndarray] | Tuple[ndarray, …], ndarray, ndarray, List[Dict]]
update_images(obs) : Updates the images in the plt window with the given observations.
Parameters: : obs (Dict*[str,np.ndarray]*) – Maps the names of the observations to the observation data.
Returns: : The original observation.
Return type: : Dict[str,np.ndarray]