EverNorif commited on
Commit
b643de7
·
1 Parent(s): 19b8b93

add env.py

Browse files
Files changed (1) hide show
  1. env.py +24 -0
env.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+
4
+ def make_env(n_envs: int = 1, use_async_envs: bool = False):
5
+ """
6
+ Create vectorized environments for leisaac task.
7
+ Args:
8
+ n_envs: Number of parallel environments
9
+ use_async_envs: Whether to use AsyncVectorEnv or SyncVectorEnv
10
+ (not use now)
11
+ Returns:
12
+ ManagerBasedRLEnv or DirectRLEnv inherit from gym.Env implemented in IsaacLab
13
+ """
14
+
15
+ # use environment variable to set config path
16
+ config_path = os.environ.get('LW_ENVHUB_CONFIG_PATH')
17
+ if config_path is None:
18
+ raise ValueError(
19
+ "Please set LW_ENVHUB_CONFIG_PATH in the environment variables")
20
+ print("[WARNING] ignore n_envs and use_async_envs in parameter, we use the config path to create the environment")
21
+
22
+ from lw_benchhub.utils.envhub_utils import export_env
23
+
24
+ return export_env(config_path)