unilab.base.registry¶
Functions
|
Apply a (possibly nested) dict of overrides to |
|
Check if an environment configuration is registered. |
|
Import env registry bootstrap modules. |
|
Decorator to register an environment class with a name and simulation backend. |
|
Decorator to register an environment configuration class with a name. |
|
Find the explicit default simulation backend for an environment. |
List all registered environments with their available backends. |
|
|
Create an environment instance by name. |
|
Register an environment class with a name and simulation backend. |
|
Register an environment configuration class with a name. |
Classes
EnvMeta(env_cfg_cls: Type[unilab.base.base.EnvCfg], env_cls_dict: Dict[str, Type[unilab.base.base.ABEnv]] = <factory>) |
- class unilab.base.registry.EnvMeta[source]¶
Bases:
objectEnvMeta(env_cfg_cls: Type[unilab.base.base.EnvCfg], env_cls_dict: Dict[str, Type[unilab.base.base.ABEnv]] = <factory>)
- available_sim_backend()[source]¶
Return the explicit default simulation backend for this environment.
- unilab.base.registry.register_env_config(name, env_cfg_cls)[source]¶
Register an environment configuration class with a name.
- unilab.base.registry.envcfg(name)[source]¶
Decorator to register an environment configuration class with a name.
- Usage:
@register_env_config_decorator(“my-env”) @dataclass class MyEnvCfg(EnvCfg):
…
- unilab.base.registry.register_env(name, env_cls, sim_backend)[source]¶
Register an environment class with a name and simulation backend.
- unilab.base.registry.env(name, sim_backend)[source]¶
Decorator to register an environment class with a name and simulation backend.
- Usage:
@register_env_decorator(“my-env”, “np”) class MyEnv(ABEnv):
…
- unilab.base.registry.find_available_sim_backend(env_name)[source]¶
Find the explicit default simulation backend for an environment.
- unilab.base.registry.apply_cfg_overrides(target_obj, overrides)[source]¶
Apply a (possibly nested) dict of overrides to
target_objin place.- Behavior:
For each
key, valueinoverrides,target_obj.keymust exist (otherwiseValueError).If
valueis a dict andtarget_obj.keyis already a dataclass instance, recurse into it (deep merge — preserves fields not present invalue). This is what lets Hydra-style partial overrides likeenv.scene.terrain.generator.num_rows=4keepsub_terrainsand other defaults intact.If
valueis a dict andtarget_obj.keyis currentlyNone, instantiate the field’s annotated dataclass type from the dict (full-construction path).Otherwise
setattrthe value directly (scalar / list / non-dataclass).
- unilab.base.registry.make(name, sim_backend=None, env_cfg_override=None, num_envs=1)[source]¶
Create an environment instance by name.
- Parameters:
- Return type:
- Returns:
Environment instance