Add bi_so101_clean_toytable_2objects EnvHub env
Browse files
envs/bi_so101_clean_toytable_2objects.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
from huggingface_hub import snapshot_download
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def make_env(n_envs: int = 1, use_async_envs: bool = False):
|
| 8 |
+
"""
|
| 9 |
+
Create vectorized environments for leisaac task.
|
| 10 |
+
|
| 11 |
+
Bi-arm direct: pick torus and cuboid into the box (2 objects).
|
| 12 |
+
|
| 13 |
+
Args:
|
| 14 |
+
n_envs: Number of parallel environments
|
| 15 |
+
use_async_envs: Whether to use AsyncVectorEnv or SyncVectorEnv
|
| 16 |
+
(not use now)
|
| 17 |
+
|
| 18 |
+
Returns:
|
| 19 |
+
ManagerBasedRLEnv or DirectRLEnv inherit from gym.Env implemented in IsaacLab
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
# download assets from huggingface first
|
| 23 |
+
snapshot_download(repo_id="LightwheelAI/leisaac_env", revision=None, cache_dir=None)
|
| 24 |
+
|
| 25 |
+
# set environment variable for leisaac asset
|
| 26 |
+
assets_root = Path(__file__).parent.parent / "assets"
|
| 27 |
+
os.environ["LEISAAC_ASSETS_ROOT"] = str(assets_root)
|
| 28 |
+
|
| 29 |
+
from isaaclab.app import AppLauncher
|
| 30 |
+
|
| 31 |
+
_ = AppLauncher({"enable_cameras": True})
|
| 32 |
+
|
| 33 |
+
from leisaac.utils.envhub_utils import export_env
|
| 34 |
+
|
| 35 |
+
return export_env(
|
| 36 |
+
"LeIsaac-SO101-CleanToyTable-2Objects-BiArm-Direct-v0",
|
| 37 |
+
device="cuda:0",
|
| 38 |
+
num_envs=n_envs,
|
| 39 |
+
)
|