Skip to content

schola.sb3.env.VecEnv

Class Definition

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

Bases: VecEnv

Parameters

unreal_connection

Type: UnrealConnection
The connection to the Unreal Engine.

verbosity

Type: int
Default: 0
The verbosity level.

Attributes

unwrapped

Methods

__init__

__init__(unreal_connection, verbosity=0)

Parameters:

  • unreal_connection – The connection to the Unreal Engine
  • verbosity (int) – The verbosity level

close

close()

Clean up the environment’s resources.

Return type: None

env_is_wrapped

env_is_wrapped(wrapper_class, indices=None)

Check if environments are wrapped with a given wrapper.

Parameters:

  • wrapper_class – The wrapper class to check for
  • indices – Indices of envs whose method to call

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

Return type: bool

env_method

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

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

get_images

get_images()

Return RGB images from each environment when available.

getattr_depth_check

getattr_depth_check(name, already_found)

Check if an attribute reference is being hidden in a recursive call to __getattr__.

render

render(mode="human")

Gym environment rendering.

reset

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(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.

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

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

set_options

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

step(actions)

Step the environments with the given action.

step_async

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

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]]]