# NVIDIA IsaacLab Arena & LeRobot

LeRobot EnvHub hiện hỗ trợ **mô phỏng tăng tốc bằng GPU** với IsaacLab Arena để đánh giá chính sách ở quy mô lớn. Huấn luyện và đánh giá các chính sách học bắt chước với mô phỏng độ trung thực cao — tất cả đều được tích hợp vào hệ sinh thái LeRobot.

<img
  src="https://huggingface.co/nvidia/isaaclab-arena-envs/resolve/main/assets/Gr1OpenMicrowaveEnvironment.png"
  alt="IsaacLab Arena - GR1 Microwave Environment"
  style={{ maxWidth: "100%", borderRadius: "8px", marginBottom: "1rem" }}
/>

[IsaacLab Arena](https://github.com/isaac-sim/IsaacLab-Arena) tích hợp với NVIDIA IsaacLab để cung cấp:

- 🤖 **Thân hình humanoid**: GR1, G1, Galileo với các cấu hình khác nhau
- 🎯 **Nhiệm vụ thao tác & thao tác di chuyển**: Mở cửa, nhặt và đặt, nhấn nút, và nhiều hơn nữa
- ⚡ **Rollout tăng tốc bằng GPU**: Thực thi môi trường song song trên GPU NVIDIA
- 🖼️ **RTX Rendering**: Đánh giá các chính sách dựa trên thị giác với kết quả render, phản xạ và khúc xạ chân thực
- 📦 **Các bộ dữ liệu tương thích với LeRobot**: Sẵn sàng để huấn luyện với GR00T N1x, PI0, SmolVLA, ACT và các chính sách Diffusion
- 🔄 **Tích hợp EnvHub**: Nạp môi trường từ HuggingFace EnvHub chỉ với một dòng

## Cài đặt

### Yêu cầu tiên quyết

Yêu cầu phần cứng được chia sẻ với Isaac Sim và được mô tả chi tiết trong [Yêu cầu của Isaac Sim](https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/requirements.html).

- GPU NVIDIA hỗ trợ CUDA
- Trình điều khiển NVIDIA tương thích với IsaacSim 5.1.0
- Linux (Ubuntu 22.04 / 24.04)

### Cài đặt

```bash
# 1. Create conda environment
conda create -y -n lerobot-arena python=3.11
conda activate lerobot-arena
conda install -y -c conda-forge ffmpeg=7.1.1

# 2. Install Isaac Sim 5.1.0
pip install "isaacsim[all,extscache]==5.1.0" --extra-index-url https://pypi.nvidia.com

# Accept NVIDIA EULA (required)
export ACCEPT_EULA=Y
export PRIVACY_CONSENT=Y

# 3. Install IsaacLab 2.3.0
git clone https://github.com/isaac-sim/IsaacLab.git
cd IsaacLab
git checkout v2.3.0
./isaaclab.sh -i
cd ..

# 4. Install IsaacLab Arena
git clone https://github.com/isaac-sim/IsaacLab-Arena.git
cd IsaacLab-Arena
git checkout release/0.1.1
pip install -e .
cd ..

# 5. Install LeRobot (evaluation extra for env/policy evaluation)
git clone https://github.com/huggingface/lerobot.git
cd lerobot
pip install -e ".[evaluation]"

# 6. Install additional dependencies
pip install onnxruntime==1.23.2 lightwheel-sdk==1.0.1 vuer[all]==0.0.70 qpsolvers==4.8.1
pip install numpy==1.26.0 # Isaac Sim 5.1 depends on numpy==1.26.0, this will be fixed in next release
```

## Đánh giá các Chính sách

### Chính sách được huấn luyện trước

Các chính sách đã được huấn luyện sau đây có sẵn:

| Chính sách                      | Kiến trúc | Nhiệm vụ          | Liên kết                                                                     |
| :-------------------------- | :----------- | :------------ | :----------------------------------------------------------------------- |
| pi05-arena-gr1-microwave    | PI0.5        | GR1 Microwave | [HuggingFace](https://huggingface.co/nvidia/pi05-arena-gr1-microwave)    |
| smolvla-arena-gr1-microwave | SmolVLA      | GR1 Microwave | [HuggingFace](https://huggingface.co/nvidia/smolvla-arena-gr1-microwave) |

### Đánh giá SmolVLA

```bash
pip install -e ".[smolvla]"
pip install numpy==1.26.0 # revert numpy to version 1.26
```

```bash
lerobot-eval \
    --policy.path=nvidia/smolvla-arena-gr1-microwave \
    --env.type=isaaclab_arena \
    --env.hub_path=nvidia/isaaclab-arena-envs \
    --rename_map='{"observation.images.robot_pov_cam_rgb": "observation.images.robot_pov_cam"}' \
    --policy.device=cuda \
    --env.environment=gr1_microwave \
    --env.embodiment=gr1_pink \
    --env.object=mustard_bottle \
    --env.headless=false \
    --env.enable_cameras=true \
    --env.video=true \
    --env.video_length=10 \
    --env.video_interval=15 \
    --env.state_keys=robot_joint_pos \
    --env.camera_keys=robot_pov_cam_rgb \
    --trust_remote_code=True \
    --eval.batch_size=1
```

### Đánh giá PI0.5

```bash
pip install -e ".[pi]"
pip install numpy==1.26.0 # revert numpy to version 1.26
```

PI0.5 yêu cầu tắt torch compile để đánh giá:

```bash
TORCH_COMPILE_DISABLE=1 TORCHINDUCTOR_DISABLE=1 lerobot-eval \
    --policy.path=nvidia/pi05-arena-gr1-microwave \
    --env.type=isaaclab_arena \
    --env.hub_path=nvidia/isaaclab-arena-envs \
    --rename_map='{"observation.images.robot_pov_cam_rgb": "observation.images.robot_pov_cam"}' \
    --policy.device=cuda \
    --env.environment=gr1_microwave \
    --env.embodiment=gr1_pink \
    --env.object=mustard_bottle \
    --env.headless=false \
    --env.enable_cameras=true \
    --env.video=true \
    --env.video_length=15 \
    --env.video_interval=15 \
    --env.state_keys=robot_joint_pos \
    --env.camera_keys=robot_pov_cam_rgb \
    --trust_remote_code=True \
    --eval.batch_size=1
```

  Để thay đổi số lượng môi trường song song, hãy sử dụng cờ ```--eval.batch_size```.

### Những gì bạn có thể mong đợi

Trong quá trình đánh giá, bạn sẽ thấy một thanh tiến trình hiển thị tỷ lệ thành công hiện tại:

```
Stepping through eval batches:   8%|██████▍    | 4/50 [00:45<08:06, 10.58s/it, running_success_rate=25.0%]
```

### Ghi hình

Để bật ghi video trong quá trình đánh giá, hãy thêm các cờ sau vào lệnh của bạn:

```bash
--env.video=true \
--env.video_length=15 \
--env.video_interval=15
```

Để biết thêm chi tiết về ghi hình video, hãy xem [Tài liệu ghi hình IsaacLab](https://isaac-sim.github.io/IsaacLab/main/source/how-to/record_video.html).

Khi chạy ở chế độ không giao diện với `--env.headless=true`, bạn cũng phải bật camera một cách rõ ràng cho các môi trường có hỗ trợ camera:

```bash
--env.headless=true --env.enable_cameras=true
```

### Thư mục đầu ra

Các video đánh giá được lưu vào thư mục đầu ra với cấu trúc sau:

```
outputs/eval/<date>/<timestamp>_<env>_<policy>/videos/<task>_<env_id>/eval_episode_<n>.mp4
```

Ví dụ:

```
outputs/eval/2026-01-02/14-38-01_isaaclab_arena_smolvla/videos/gr1_microwave_0/eval_episode_0.mp4
```

## Chính sách huấn luyện

Để tìm hiểu thêm về việc huấn luyện chính sách với LeRobot, vui lòng tham khảo tài liệu huấn luyện:

- [SmolVLA](./smolvla)
- [Pi0.5](./pi05)
- [GR00T N1.7](./groot)

Các bộ dữ liệu mẫu của IsaacLab Arena có sẵn trên HuggingFace Hub để thử nghiệm:

| Bộ dữ liệu                                                                                                   | Mô tả                | Frames |
| :-------------------------------------------------------------------------------------------------------- | :------------------------- | :----- |
| [Arena-GR1-Manipulation-Task](https://huggingface.co/datasets/nvidia/Arena-GR1-Manipulation-Task-v3)      | GR1 điều khiển bằng vi sóng | ~4K    |
| [Arena-G1-Loco-Manipulation-Task](https://huggingface.co/datasets/nvidia/Arena-G1-Loco-Manipulation-Task) | G1 loco-manipulation       | ~4K    |

## Cấu hình môi trường

### Tùy chọn Cấu hình Đầy đủ

```python
from lerobot.envs.configs import IsaaclabArenaEnvConfig

config = IsaaclabArenaEnvConfig(
    # Environment selection
    environment="gr1_microwave",      # Task environment
    embodiment="gr1_pink",            # Robot embodiment
    object="power_drill",             # Object to manipulate

    # Simulation settings
    episode_length=300,               # Max steps per episode
    headless=True,                    # Run without GUI
    device="cuda:0",                  # GPU device
    seed=42,                          # Random seed

    # Observation configuration
    state_keys="robot_joint_pos",     # State observation keys (comma-separated)
    camera_keys="robot_pov_cam_rgb",  # Camera observation keys (comma-separated)
    state_dim=54,                     # Expected state dimension
    action_dim=36,                    # Expected action dimension
    camera_height=512,                # Camera image height
    camera_width=512,                 # Camera image width
    enable_cameras=True,              # Enable camera observations

    # Video recording
    video=False,                      # Enable video recording
    video_length=100,                 # Frames per video
    video_interval=200,               # Steps between recordings

    # Advanced
    mimic=False,                      # Enable mimic mode
    teleop_device=None,               # Teleoperation device
    disable_fabric=False,             # Disable fabric optimization
    enable_pinocchio=True,            # Enable Pinocchio for IK
)
```

### Sử dụng trực tiếp Environment Hub cho các trường hợp sử dụng nâng cao

Tạo một tệp có tên là `test_env_load_arena.py` hoặc [tải xuống từ EnvHub](https://huggingface.co/nvidia/isaaclab-arena-envs/blob/main/tests/test_env_load_arena.py):

```python
import logging
from dataclasses import asdict
from pprint import pformat
import torch
import tqdm
from lerobot.configs import parser
from lerobot.configs.eval import EvalPipelineConfig

@parser.wrap()
def main(cfg: EvalPipelineConfig):
    """Run random action rollout for IsaacLab Arena environment."""
    logging.info(pformat(asdict(cfg)))

    from lerobot.envs import make_env

    env_dict = make_env(
        cfg.env,
        n_envs=cfg.env.num_envs,
        trust_remote_code=True,
    )
    env = next(iter(env_dict.values()))[0]
    env.reset()
    for _ in tqdm.tqdm(range(cfg.env.episode_length)):
        with torch.inference_mode():
            actions = env.action_space.sample()
            obs, rewards, terminated, truncated, info = env.step(actions)
            if terminated.any() or truncated.any():
                obs, info = env.reset()
    env.close()

if __name__ == "__main__":
    main()
```

Chạy với:

```bash
python test_env_load_arena.py \
    --env.environment=g1_locomanip_pnp \
    --env.embodiment=gr1_pink \
    --env.object=cracker_box \
    --env.num_envs=4 \
    --env.enable_cameras=true \
    --env.seed=1000 \
    --env.video=true \
    --env.video_length=10 \
    --env.video_interval=15 \
    --env.headless=false \
    --env.hub_path=nvidia/isaaclab-arena-envs \
    --env.type=isaaclab_arena
```

## Tạo Môi Trường Mới

Trước tiên, hãy tạo một môi trường IsaacLab Arena mới bằng cách làm theo [Tài liệu IsaacLab Arena](https://isaac-sim.github.io/IsaacLab-Arena/release/0.1.1/index.html).

Clone kho EnvHub của chúng tôi:

```bash
git clone https://huggingface.co/nvidia/isaaclab-arena-envs
```

Sửa đổi tệp `example_envs.yaml` dựa trên môi trường mới của bạn. [Tải lên](./envhub#step-3-upload-to-the-hub) kho đã sửa đổi của bạn lên HuggingFace EnvHub.

  Mã môi trường IsaacLab Arena của bạn phải khả dụng cục bộ trong quá trình đánh giá. Người dùng có thể clone kho môi trường của bạn riêng biệt, hoặc bạn có thể đóng gói mã và tài nguyên môi trường trực tiếp trong kho EnvHub của mình.

Sau đó, khi đánh giá, hãy sử dụng môi trường mới của bạn:

```bash
lerobot-eval \
    --env.hub_path=<your-env-hub-path>/isaaclab-arena-envs \
    --env.environment=<your new environment> \
    ...other flags...
```

Chúng tôi rất mong nhận được những đóng góp của bạn!

## Xử lý sự cố

### Hết bộ nhớ CUDA

Giảm `batch_size` hoặc sử dụng GPU có nhiều VRAM hơn:

```bash
--eval.batch_size=1
```

### Chưa chấp nhận EULA

Đặt các biến môi trường trước khi chạy:

```bash
export ACCEPT_EULA=Y
export PRIVACY_CONSENT=Y
```

### Quay video không hoạt động

Bật camera khi chạy không giao diện:

```bash
--env.video=true --env.enable_cameras=true --env.headless=true
```

### Kích thước đầu ra của chính sách không khớp

Đảm bảo `action_dim` khớp với chính sách của bạn:

```bash
--env.action_dim=36
```

### Lỗi libGLU.so.1 trong quá trình khởi tạo Isaac Sim

Đảm bảo bạn đã cài đặt các phụ thuộc sau, điều này thường xảy ra trên các máy không có giao diện đồ họa (headless).

```bash
sudo apt update && sudo apt install -y libglu1-mesa libxt6
```

## Xem thêm

- [Tài liệu EnvHub](./envhub) - Sử dụng EnvHub chung
- [GitHub IsaacLab Arena](https://github.com/isaac-sim/IsaacLab-Arena)
- [Tài liệu IsaacLab](https://isaac-sim.github.io/IsaacLab/)

## Lightwheel LW-BenchHub

[Lightwheel](https://www.lightwheel.ai) đang đưa `Lightwheel-Libero-Tasks` và `Lightwheel-RoboCasa-Tasks` với 268 tác vụ vào hệ sinh thái LeRobot. LW-BenchHub thu thập và tạo ra các bộ dữ liệu quy mô lớn thông qua teleoperation, tuân thủ quy định của LeRobot, cho phép các quy trình huấn luyện và đánh giá ngay lập tức. Với giao diện thống nhất do EnvHub cung cấp, các nhà phát triển có thể nhanh chóng xây dựng các đường ống thử nghiệm đầu-cuối.

### Cài đặt

Giả sử bạn đã thực hiện các bước [Cài đặt](#installation), bạn có thể cài đặt LW-BenchHub bằng cách:

```bash
conda install pinocchio -c conda-forge -y
pip install numpy==1.26.0 # revert numpy to version 1.26

sudo apt-get install git-lfs && git lfs install

git clone https://github.com/LightwheelAI/lw_benchhub
cd lw_benchhub
git lfs pull # Ensure LFS files (e.g., .usd assets) are downloaded

pip install -e .
```

Để có hướng dẫn chi tiết hơn, vui lòng tham khảo [Tài liệu LW-BenchHub](https://docs.lightwheel.net/lw_benchhub/usage/Installation).

### Bộ dữ liệu Lightwheel Tasks

Bộ dữ liệu LW-BenchHub có sẵn trên HuggingFace Hub:

| Bộ dữ liệu                                                                                                       | Mô tả             | Nhiệm vụ | Frames |
| :------------------------------------------------------------------------------------------------------------ | :---------------------- | :---- | :----- |
| [Lightwheel-Tasks-X7S](https://huggingface.co/datasets/LightwheelAI/Lightwheel-Tasks-X7S)                     | X7S LIBERO và RoboCasa | 117   | ~10.3M |
| [Lightwheel-Tasks-Double-Piper](https://huggingface.co/datasets/LightwheelAI/Lightwheel-Tasks-Double-Piper)   | Double-Piper LIBERO     | 130   | ~6.0M  |
| [Lightwheel-Tasks-G1-Controller](https://huggingface.co/datasets/LightwheelAI/Lightwheel-Tasks-G1-Controller) | G1-Controller LIBERO    | 62    | ~2.7M  |
| [Lightwheel-Tasks-G1-WBC](https://huggingface.co/datasets/LightwheelAI/Lightwheel-Tasks-G1-WBC)               | G1-WBC RoboCasa         | 32    | ~1.5M  |

Để huấn luyện các chính sách, hãy tham khảo phần [Training Policies](#training-policies).

### Đánh giá các Chính sách

#### Chính sách được huấn luyện trước

Các chính sách đã được huấn luyện sau đây có sẵn:

| Chính sách                   | Kiến trúc | Nhiệm vụ                           | Bố cục     | Robot           | Liên kết                                                                                  |
| :----------------------- | :----------- | :----------------------------- | :--------- | :-------------- | :------------------------------------------------------------------------------------ |
| smolvla-double-piper-pnp | SmolVLA      | L90K1PutTheBlackBowlOnThePlate | libero-1-1 | DoublePiper-Abs | [HuggingFace](https://huggingface.co/LightwheelAI/smolvla-double-piper-pnp/tree/main) |

#### Đánh giá SmolVLA

```bash
lerobot-eval \
  --policy.path=LightwheelAI/smolvla-double-piper-pnp \
  --env.type=isaaclab_arena \
  --rename_map='{"observation.images.left_hand_camera_rgb": "observation.images.left_hand", "observation.images.right_hand_camera_rgb": "observation.images.right_hand", "observation.images.first_person_camera_rgb": "observation.images.first_person"}' \
  --env.hub_path=LightwheelAI/lw_benchhub_env \
  --env.kwargs='{"config_path": "configs/envhub/example.yml"}' \
  --trust_remote_code=true \
  --env.state_keys=joint_pos \
  --env.action_dim=12 \
  --env.camera_keys=left_hand_camera_rgb,right_hand_camera_rgb,first_person_camera_rgb \
  --policy.device=cuda \
  --eval.batch_size=10 \
  --eval.n_episodes=100
```

### Cấu hình môi trường

Việc đánh giá có thể được khởi chạy nhanh chóng bằng cách chỉnh sửa các cài đặt `robot`, `task` và `layout` trong tệp cấu hình.

#### Tùy chọn Cấu hình Đầy đủ

```yml
# =========================
# Basic Settings
# =========================
disable_fabric: false
device: cuda:0
sensitivity: 1.0
step_hz: 50
enable_cameras: true
execute_mode: eval
episode_length_s: 20.0 # Episode length in seconds, increase if episodes timeout during eval

# =========================
# Robot Settings
# =========================
robot: DoublePiper-Abs # Robot type, DoublePiper-Abs, X7S-Abs, G1-Controller or G1-Controller-DecoupledWBC
robot_scale: 1.0

# =========================
# Task & Scene Settings
# =========================
task: L90K1PutTheBlackBowlOnThePlate # Task name
scene_backend: robocasa
task_backend: robocasa
debug_assets: null
layout: libero-1-1 # Layout and style ID
sources:
  - objaverse
  - lightwheel
  - aigen_objs
object_projects: []
usd_simplify: false
seed: 42

# =========================
# Object Placement Retry Settings
# =========================
max_scene_retry: 4
max_object_placement_retry: 3

resample_objects_placement_on_reset: true
resample_robot_placement_on_reset: true

# =========================
# Replay Configuration Settings
# =========================
replay_cfgs:
  add_camera_to_observation: true
  render_resolution: [640, 480]
```

### Xem thêm

- [LW-BenchHub GitHub](https://github.com/LightwheelAI/LW-BenchHub)
- [Tài liệu LW-BenchHub](https://docs.lightwheel.net/lw_benchhub/)

