leisaac_env / envs /so101_clean_toytable_2objects.py
tinkhireeva's picture
Update envs/so101_clean_toytable_2objects.py
ce06d54 verified
Raw
History Blame Contribute Delete
1.3 kB
import os
from pathlib import Path
from huggingface_hub import snapshot_download
def make_env(n_envs: int = 1, use_async_envs: bool = False):
"""
Create vectorized environments for leisaac task.
Bi-arm direct: pick torus and cuboid into the box (2 objects).
Args:
n_envs: Number of parallel environments
use_async_envs: Whether to use AsyncVectorEnv or SyncVectorEnv
(not use now)
Returns:
ManagerBasedRLEnv or DirectRLEnv inherit from gym.Env implemented in IsaacLab
"""
# Scene/robot assets live on the upstream Hub repo; materialize them next to this script so
# thin forks (e.g. kd-forge/leisaac_env with only envs/*.py) still resolve LEISAAC_ASSETS_ROOT.
repo_root = Path(__file__).resolve().parent.parent
assets_root = repo_root / "assets"
snapshot_download(
repo_id="kd-forge/leisaac_env",
local_dir=str(repo_root),
allow_patterns=["assets/**"],
)
os.environ["LEISAAC_ASSETS_ROOT"] = str(assets_root)
from isaaclab.app import AppLauncher
_ = AppLauncher({"enable_cameras": True})
from leisaac.utils.envhub_utils import export_env
return export_env(
"LeIsaac-SO101-CleanToyTable-2Objects-v0",
device="cuda:0",
num_envs=n_envs,
)