tianheng.wu commited on
Commit
93562b2
·
1 Parent(s): 0939b95

update env,py

Browse files
Files changed (1) hide show
  1. env.py +7 -7
env.py CHANGED
@@ -57,23 +57,23 @@ except ImportError:
57
  IsaacLabArenaStateKeyError = _errors.IsaacLabArenaStateKeyError
58
 
59
 
60
- def make_env(n_envs: int = 1, use_async_envs: bool = False, **kwargs: Any):
61
  """
62
  Create vectorized environments for leisaac task.
63
  Args:
64
  n_envs: Number of parallel environments
65
  use_async_envs: Whether to use AsyncVectorEnv or SyncVectorEnv
66
  (not use now)
67
- **kwargs: Additional arguments to pass to the environment
68
- - config_path: Path to the environment configuration file
69
  Returns:
70
  ManagerBasedRLEnv or DirectRLEnv inherit from gym.Env implemented in IsaacLab
71
  """
72
 
73
- # use environment variable to set config path
74
- if "config_path" not in kwargs:
75
- raise ValueError("Please set config_path in the arguments")
76
- config_path = kwargs['config_path']
 
77
  logging.warning(
78
  "Ignore n_envs and use_async_envs in parameter, we use the config path to create the environment")
79
 
 
57
  IsaacLabArenaStateKeyError = _errors.IsaacLabArenaStateKeyError
58
 
59
 
60
+ def make_env(n_envs: int = 1, use_async_envs: bool = False, cfg: Any = None):
61
  """
62
  Create vectorized environments for leisaac task.
63
  Args:
64
  n_envs: Number of parallel environments
65
  use_async_envs: Whether to use AsyncVectorEnv or SyncVectorEnv
66
  (not use now)
67
+ cfg: Environment configuration object (EnvConfig)
 
68
  Returns:
69
  ManagerBasedRLEnv or DirectRLEnv inherit from gym.Env implemented in IsaacLab
70
  """
71
 
72
+ # Get config_path from cfg.config_path (set via --env.kwargs)
73
+ if cfg is None or not hasattr(cfg, 'config_path'):
74
+ raise ValueError(
75
+ "Please set config_path via --env.kwargs='{\"config_path\": \"...\"}'")
76
+ config_path = cfg.config_path
77
  logging.warning(
78
  "Ignore n_envs and use_async_envs in parameter, we use the config path to create the environment")
79