schola.sb3.env.VecEnv
类定义
class schola.sb3.env.VecEnv(unreal_connection, verbosity=0)基类: VecEnv
参数
unreal_connection
类型: UnrealConnection
到 Unreal Engine 的连接。
verbosity
Type: int
默认: 0
详细程度级别。
属性
unwrapped
方法
__init__
__init__(unreal_connection, verbosity=0)参数
- unreal_connection – 到 Unreal Engine 的连接
- verbosity (
int) – 详细程度级别
close
close()清理环境的资源。
返回类型: None
env_is_wrapped
env_is_wrapped(wrapper_class, indices=None)检查环境是否已用给定包装器包装。
参数
- wrapper_class – 要检查的包装器类
- indices – 要调用其方法的环境索引
返回值: 如果环境已包装,则为 True,否则为 False,针对每个查询的环境。
返回类型: bool
env_method
env_method(*method_args, indices=None, **method_kwargs)调用向量化环境的实例方法。
参数
- method_name – 要调用的环境方法的名称
- indices – 要调用其方法的环境索引
- method_args – 要在调用中提供的任何位置参数
- method_kwargs – 要在调用中提供的任何关键字参数
返回值: 环境方法调用返回的项目列表
get_attr
get_attr(attr_name, indices=None)从向量化环境返回属性。
参数
- attr_name – 要返回其值的属性的名称
- indices – 要从中获取属性的环境索引
返回值: 在所有环境中 'attr_name' 的值列表
get_images
get_images()在可能的情况下,从每个环境中返回 RGB 图像。
getattr_depth_check
getattr_depth_check(name, already_found)检查属性引用是否在 __getattr__ 的递归调用中被隐藏。
render
render(mode="human")Gym 环境渲染。
reset
reset()重置所有环境并返回观察数组,或观察数组的元组。
如果 step_async 仍在进行工作,则该工作将被取消,并且在再次调用 step_async() 之前不应调用 step_wait()。
返回值: 观察
返回类型: Dict[str, ndarray]
seed
seed(seed=None)根据给定的种子为所有环境设置随机种子。每个单独的环境仍会获得自己的种子,通过增加给定种子来实现。
自 gym 0.26 起,这些种子将在下次重置时才传递给环境。
参数
- seed (
int | None) – 随机种子。可能为 None 以实现完全随机播种
返回值: 返回一个包含每个单独环境种子的列表。请注意,如果环境在播种时未返回任何内容,则列表中的所有元素都可能为 None。
返回类型: None
set_attr
set_attr(attr_name, value, indices=None)在向量化环境中设置属性。
参数
- attr_name – 要分配新值的属性名称
- value – 要分配给 attr_name 的值
- indices – 要分配值的环境索引
set_options
set_options(options=None)设置环境的选项。
参数
- options (
Optional[Dict[str, str]], 可选) – 要设置的选项,默认为 None
返回类型: None
step
step(actions)使用给定的动作来步进环境。
step_async
step_async(actions)告知所有环境使用给定的动作开始步进。调用 step_wait() 以获取步进结果。
如果您有待处理的 step_async 运行,则不应调用此方法。
参数
- actions (
List[ndarray] | List[Dict[str, ndarray]])
返回类型: None
step_wait
step_wait()等待 step_async() 完成的步进。
返回值: 观察、奖励、完成、信息
返回类型: Tuple[Dict[str, ndarray], ndarray, ndarray, List[Dict[str, str]]]