LeRobot documentation

LeIsaac × LeRobot EnvHub

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.6.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

LeIsaac × LeRobot EnvHub

LeRobot EnvHub artık LeIsaac ile simülasyonda taklit öğrenmeyi destekliyor. Günlük manipülasyon görevlerini başlatın, robotu teleoperasyonla kontrol edin, demoları toplayın, Hub'a gönderin ve LeRobot'ta politikaları eğitin — tümü tek bir döngüde.

LeIsaac, IsaacLab ve SO101 Leader/Follower kurulumuyla entegre olarak şunları sağlar:

  • 🕹️ Veri toplama için teleoperasyon öncelikli iş akışları
  • 📦 LeRobot eğitimi için hazır yerleşik veri dönüştürme
  • 🤖 Portakal toplama, küp kaldırma, masaları temizleme ve kumaş katlama gibi günlük beceriler
  • ☁️ LightWheel tarafından süregelen yükseltmeler: bulut simülasyonu, EnvHub desteği, Sim2Real araçları ve daha fazlası

Aşağıda, LeRobot EnvHub aracılığıyla sunulan ve şu anda desteklenen LeIsaac görevlerini bulabilirsiniz.

Kullanılabilir Ortamlar

Aşağıdaki tablo, LeIsaac x LeRobot Envhub'daki tüm kullanılabilir görevleri ve ortamları listeler. Ayrıca aşağıdaki komutu çalıştırarak en güncel ortam listesini de alabilirsiniz:

python scripts/environments/list_envs.py
GörevOrtam KimliğiGörev Açıklamasıİlgili Robot
LeIsaac-SO101-PickOrange-v0

LeIsaac-SO101-PickOrange-Direct-v0
Üç portakal seçin ve tabağa koyun, ardından kolu dinlenme durumuna sıfırlayın.Tek Kollu SO101 Takipçi
LeIsaac-SO101-LiftCube-v0

LeIsaac-SO101-LiftCube-Direct-v0
Kırmızı küpü yukarı kaldırın.Tek Kollu SO101 Takipçi
LeIsaac-SO101-CleanToyTable-v0

LeIsaac-SO101-CleanToyTable-BiArm-v0

LeIsaac-SO101-CleanToyTable-BiArm-Direct-v0
Kutuya iki adet harf e nesnesini yerleştirin ve kolu dinlenme durumuna sıfırlayın.Tek Kollu SO101 Takipçi

Çift Kollu SO101 Takipçi
LeIsaac-SO101-FoldCloth-BiArm-v0

LeIsaac-SO101-FoldCloth-BiArm-Direct-v0
Kumaşı katlayın ve kolu dinlenme durumuna sıfırlayın.

Not: Bu görevde yalnızca DirectEnv, check_success'ı destekler.
Bi-Arm SO101 Takipçi

LeIsaac'ı tek satır kodla doğrudan LeRobot'ta yükleyin

EnvHub: LeIsaac ortamlarını HuggingFace üzerinden paylaşın

EnvHub, yeniden üretilebilir ortam merkezimizdir; tek satırla paketlenmiş bir simülasyon başlatın, hemen deney yapın ve kendi görevlerinizi topluluk için yayınlayın.

LeIsaac, EnvHub desteği sunar; böylece görevleri yalnızca birkaç komutla kullanabilir veya paylaşabilirsiniz.

Nasıl başlanır, ortam Kurulumu

Kod ortamlarınızı kurmak için aşağıdaki komutları çalıştırın:

# Refer to Getting Started/Installation to install leisaac firstly
conda create -n leisaac_envhub python=3.11
conda activate leisaac_envhub

conda install -c "nvidia/label/cuda-12.8.1" cuda-toolkit
pip install -U torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
pip install 'leisaac[isaaclab] @ git+https://github.com/LightwheelAI/leisaac.git#subdirectory=source/leisaac' --extra-index-url https://pypi.nvidia.com

# Install lerobot
pip install lerobot==0.4.1

# Fix numpy version
pip install numpy==1.26.0

Kullanım Örneği

EnvHub, LeIsaac tarafından desteklenen tüm görevleri bir arayüzde sunar. Aşağıdaki örnekler so101_pick_orange görevini yükler ve rastgele eylem dağılımı ile etkileşimli teleoperasyonu gösterir.

Rastgele Eylem

Click to expand code example
# envhub_random_action.py

import torch
from lerobot.envs import make_env

# Load from the hub
envs_dict = make_env("LightwheelAI/leisaac_env:envs/so101_pick_orange.py", n_envs=1, trust_remote_code=True)

# Access the environment
suite_name = next(iter(envs_dict))
sync_vector_env = envs_dict[suite_name][0]
# retrieve the isaac environment from the sync vector env
env = sync_vector_env.envs[0].unwrapped

# Use it like any gym environment
obs, info = env.reset()

while True:
    action = torch.tensor(env.action_space.sample())
    obs, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        obs, info = env.reset()

env.close()
python envhub_random_action.py

Saf rastgele komutlar altında SO101 kolunun sallandığını görmelisiniz.

Teleoperasyon

LeRobot'un teleoperation yığını, simüle edilmiş kolu sürdürebilir.

SO101 Leader kontrolcüsünü bağlayın ve aşağıdaki kalibrasyon komutunu çalıştırın.

lerobot-calibrate \
    --teleop.type=so101_leader \
    --teleop.port=/dev/ttyACM0 \
    --teleop.id=leader

Ve ardından teleop betiğini başlatın.

Click to expand code example
# envhub_teleop_example.py

import logging
import time
import gymnasium as gym

from dataclasses import asdict, dataclass
from pprint import pformat

from lerobot.teleoperators import (  # noqa: F401
    Teleoperator,
    TeleoperatorConfig,
    make_teleoperator_from_config,
    so_leader,
    bi_so_leader,
)
from lerobot.utils.robot_utils import precise_sleep
from lerobot.utils.utils import init_logging
from lerobot.envs import make_env


@dataclass
class TeleoperateConfig:
    teleop: TeleoperatorConfig
    env_name: str = "so101_pick_orange"
    fps: int = 60


@dataclass
class EnvWrap:
    env: gym.Env


def make_env_from_leisaac(env_name: str = "so101_pick_orange"):
    envs_dict = make_env(
        f'LightwheelAI/leisaac_env:envs/{env_name}.py',
        n_envs=1,
        trust_remote_code=True
    )
    suite_name = next(iter(envs_dict))
    sync_vector_env = envs_dict[suite_name][0]
    env = sync_vector_env.envs[0].unwrapped

    return env


def teleop_loop(teleop: Teleoperator, env: gym.Env, fps: int):
    from leisaac.devices.action_process import preprocess_device_action
    from leisaac.assets.robots.lerobot import SO101_FOLLOWER_MOTOR_LIMITS
    from leisaac.utils.env_utils import dynamic_reset_gripper_effort_limit_sim

    env_wrap = EnvWrap(env=env)

    obs, info = env.reset()
    while True:
        loop_start = time.perf_counter()
        if env.cfg.dynamic_reset_gripper_effort_limit:
            dynamic_reset_gripper_effort_limit_sim(env, 'so101leader')

        raw_action = teleop.get_action()
        processed_action = preprocess_device_action(
            dict(
                so101_leader=True,
                joint_state={
                    k.removesuffix(".pos"): v for k, v in raw_action.items()},
                motor_limits=SO101_FOLLOWER_MOTOR_LIMITS),
            env_wrap
        )
        obs, reward, terminated, truncated, info = env.step(processed_action)
        if terminated or truncated:
            obs, info = env.reset()

        dt_s = time.perf_counter() - loop_start
        precise_sleep(max(1 / fps - dt_s, 0.0))
        loop_s = time.perf_counter() - loop_start
        print(f"\ntime: {loop_s * 1e3:.2f}ms ({1 / loop_s:.0f} Hz)")


def teleoperate(cfg: TeleoperateConfig):
    init_logging()
    logging.info(pformat(asdict(cfg)))

    teleop = make_teleoperator_from_config(cfg.teleop)
    env = make_env_from_leisaac(cfg.env_name)

    teleop.connect()
    if hasattr(env, 'initialize'):
        env.initialize()
    try:
        teleop_loop(teleop=teleop, env=env, fps=cfg.fps)
    except KeyboardInterrupt:
        pass
    finally:
        teleop.disconnect()
        env.close()


def main():
    teleoperate(TeleoperateConfig(
        teleop=so_leader.SO101LeaderConfig(
            port="/dev/ttyACM0",
            id='leader',
            use_degrees=False,
        ),
        env_name="so101_pick_orange",
        fps=60,
    ))


if __name__ == "__main__":
    main()
python envhub_teleop_example.py

Betik çalıştırıldığında, fiziksel Leader cihazı kullanılarak simüle kolun kontrol edilmesi sağlanır.

☁️ Bulut Simülasyonu (GPU Gerektirmez)

Yerel bir GPU'nuz veya doğru sürücüleriniz yok mu? Sorun değil! LeIsaac'i sıfır kurulumla tamamen bulutta çalıştırabilirsiniz. LeIsaac, NVIDIA Brev üzerinde kutudan çıktığı gibi çalışır ve tarayıcınızda doğrudan tam olarak yapılandırılmış bir ortam sunar.

👉 Buradan başlayın: https://lightwheelai.github.io/leisaac/docs/cloud_simulation/nvidia_brev

Örnek (instance) dağıtıldıktan sonra, Visual Studio Code Server'i başlatmak için 80 numaralı portun (HTTP) bağlantısını açmanız yeterlidir (varsayılan şifre: password). Buradan simülasyonlar çalıştırabilir, kod düzenleyebilir ve IsaacLab ortamlarını görselleştirebilirsiniz — tüm bunları web tarayıcınızdan yapabilirsiniz.

GPU yok, sürücüler yok, yerel kurulum yok. Sadece tıklayın ve çalıştırın.

Ek Notlar

EnvHub kapsamını LeIsaac göreviyle uyumlu tutuyoruz. Şu anda desteklenenler:

  • so101_pick_orange
  • so101_lift_cube
  • so101_clean_toytable
  • bi_so101_fold_cloth

make_env çağrısı sırasında farklı bir betiği hedefleyerek görevleri değiştirin, örneğin:

envs_dict_pick_orange = make_env("LightwheelAI/leisaac_env:envs/so101_pick_orange.py", n_envs=1, trust_remote_code=True)
envs_dict_lift_cube = make_env("LightwheelAI/leisaac_env:envs/so101_lift_cube.py", n_envs=1, trust_remote_code=True)
envs_dict_clean_toytable = make_env("LightwheelAI/leisaac_env:envs/so101_clean_toytable.py", n_envs=1, trust_remote_code=True)
envs_dict_fold_cloth = make_env("LightwheelAI/leisaac_env:envs/bi_so101_fold_cloth.py", n_envs=1, trust_remote_code=True)

Not: bi_so101_fold_cloth ile çalışırken, diğer tüm işlemleri gerçekleştirmeden önce env'i aldığınızda hemen initialize() çağrısını yapın:

Click to expand code example
import torch
from lerobot.envs import make_env

# Load from the hub
envs_dict = make_env("LightwheelAI/leisaac_env:envs/bi_so101_fold_cloth.py", n_envs=1, trust_remote_code=True)

# Access the environment
suite_name = next(iter(envs_dict))
sync_vector_env = envs_dict[suite_name][0]
# retrieve the isaac environment from the sync vector env
env = sync_vector_env.envs[0].unwrapped

# NOTE: initialize() first
env.initialize()

# other operation with env...
Update on GitHub