Skip to content

schola.sb3.env.VecEnv

class schola.sb3.env.VecEnv(unreal_connection, verbosity=0) : Bases: VecEnv

Methods

__init__(unreal_connection[, verbosity])
close()Clean up the environment’s resources.
env_is_wrapped(wrapper_class[, indices])Check if environments are wrapped with a given wrapper.
env_method(*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)Check if an attribute reference is being hidden in a recursive call to __getattr__
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.
set_options([options])Set the options for the environment.
step(actions)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().

Attributes

unwrapped

Parameters: : verbosity (int)

__init__(unreal_connection, verbosity=0) : Parameters: : verbosity (int)

close() : Clean up the environment’s resources.

Return type: : None

env_is_wrapped(wrapper_class, indices=None) : Check if environments are wrapped with a given wrapper.

Parameters: : - method_name – The name of the environment method to invoke.

  • indices – Indices of envs whose method to call
  • method_args – Any positional arguments to provide in the call
  • method_kwargs – Any keyword arguments to provide in the call

Returns: : True if the env is wrapped, False otherwise, for each env queried.

Return type: : bool

env_method(*method_args, indices=None, **method_kwargs) : Call instance methods of vectorized environments.

Parameters: : - method_name – The name of the environment method to invoke.

  • indices – Indices of envs whose method to call
  • method_args – Any positional arguments to provide in the call
  • method_kwargs – Any keyword arguments to provide in the call

Returns: : List of items returned by the environment’s method call

get_attr(attr_name, indices=None) : Return attribute from vectorized environment.

Parameters: : - attr_name – The name of the attribute whose value to return

  • indices – Indices of envs to get attribute from

Returns: : List of values of ‘attr_name’ in all environments

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: : Dict[str, ndarray]

seed(seed=None) : Sets the random seeds for all environments, based on a given seed. Each individual environment will still get its own seed, by incrementing the given seed. WARNING: since gym 0.26, those seeds will only be passed to the environment at the next reset.

Parameters: : seed (int | None) – The random seed. May be None for completely random seeding.

Returns: : Returns a list containing the seeds for each individual env. Note that all list elements may be None, if the env does not return anything when being seeded.

Return type: : None

set_attr(attr_name, value, indices=None) : Set attribute inside vectorized environments.

Parameters: : - attr_name – The name of attribute to assign new value

  • value – Value to assign to attr_name
  • indices – Indices of envs to assign value

Returns:

set_options(options=None) : Set the options for the environment.

Parameters: : options (Optional*[Dict[str,str]],* optional) – The options to set, by default None.

Return type: : None

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 (List[ndarray] | List[Dict[str, ndarray*]**]*)

Return type: : None

step_wait() : Wait for the step taken with step_async().

Returns: : observation, reward, done, information

Return type: : Tuple[Dict[str, ndarray], ndarray, ndarray, List[Dict[str, str]]]