LeRobot documentation

LeIsaac × LeRobot EnvHub

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 agora suporta aprendizado por imitação em simulação com LeIsaac. Crie tarefas de manipulação do dia a dia, teleopere o robô, colete demonstrações, envie-as para o Hub e treine políticas no LeRobot — tudo em um único fluxo.

LeIsaac integra-se ao IsaacLab e à configuração Leader/Follower do SO101 para fornecer:

  • 🕹️ Fluxos de trabalho com foco em teleoperação para coleta de dados
  • 📦 Conversão de dados integrada pronta para treinamento com LeRobot
  • 🤖 Habilidades do dia a dia como colher laranjas, levantar cubos, limpar mesas e dobrar tecido
  • ☁️ Atualizações em andamento da LightWheel: simulação em nuvem, suporte a EnvHub, ferramentas Sim2Real e muito mais

Abaixo, você encontrará as tarefas LeIsaac atualmente suportadas, expostas por meio do LeRobot EnvHub.

Ambientes Disponíveis

A tabela a seguir lista todas as tarefas e ambientes disponíveis no LeIsaac x LeRobot EnvHub. Você também pode obter a lista mais recente de ambientes executando o seguinte comando:

python scripts/environments/list_envs.py
TarefaID do ambienteDescrição da TarefaRobô relacionado
LeIsaac-SO101-PickOrange-v0

LeIsaac-SO101-PickOrange-Direct-v0
Escolha três laranjas e coloque-as no prato, em seguida, redefina o braço para o estado de repouso.Seguidor SO101 de Braço Único
LeIsaac-SO101-LiftCube-v0

LeIsaac-SO101-LiftCube-Direct-v0
Levante o cubo vermelho.Seguidor SO101 de Braço Único
LeIsaac-SO101-CleanToyTable-v0

LeIsaac-SO101-CleanToyTable-BiArm-v0

LeIsaac-SO101-CleanToyTable-BiArm-Direct-v0
Escolha dois objetos com a letra e para a caixa e redefina o braço para o estado de repouso.Seguidor SO101 de Braço Único

Seguidor SO101 de Dois Braços
LeIsaac-SO101-FoldCloth-BiArm-v0

LeIsaac-SO101-FoldCloth-BiArm-Direct-v0
Dobre o pano e redefina o braço para o estado de repouso.

Observação: Apenas o DirectEnv suporta check_success nesta tarefa.
Bi-Arm SO101 Follower

Carregue o LeIsaac diretamente no LeRobot com uma linha de código

EnvHub: Compartilhe ambientes LeIsaac através do HuggingFace

EnvHub é nosso hub de ambientes reproduzíveis: inicie uma simulação empacotada com uma única linha, experimente imediatamente e publique suas próprias tarefas para a comunidade.

LeIsaac oferece suporte ao EnvHub para que você possa consumir ou compartilhar tarefas com apenas alguns comandos.

Como começar, configuração do ambiente

Execute os seguintes comandos para configurar seus ambientes de código:

# 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

Exemplo de uso

O EnvHub expõe todas as tarefas suportadas pelo LeIsaac em uma interface uniforme. Os exemplos abaixo carregam so101_pick_orange e demonstram um rollout de ações aleatórias e uma teleoperação interativa.

Ação Aleatória

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

Você deve ver o braço SO101 se movendo sob comandos puramente aleatórios.

Teleoperação

A pilha de teleoperação do LeRobot pode controlar o braço simulado.

Conecte o controlador SO101 Leader e execute o comando de calibração abaixo.

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

E então, execute o script de teleoperação.

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

Executar o script permite operar o braço simulado usando o dispositivo físico Leader.

☁️ Simulação em nuvem (sem necessidade de GPU)

Não tem uma GPU local ou os drivers certos? Sem problemas! Você pode executar o LeIsaac inteiramente na nuvem, sem nenhuma configuração. O LeIsaac funciona imediatamente no NVIDIA Brev, oferecendo um ambiente totalmente configurado diretamente no seu navegador.

👉 Comece aqui: https://lightwheelai.github.io/leisaac/docs/cloud_simulation/nvidia_brev

Depois que sua instância for implantada, basta abrir o link para a porta 80 (HTTP) para iniciar o Visual Studio Code Server (senha padrão: password). A partir daí, você pode executar simulações, editar código e visualizar ambientes do IsaacLab — tudo pelo seu navegador web.

Na GPU, sem drivers, sem instalação local. Basta clicar e executar.

Observações adicionais

Mantemos a cobertura do EnvHub alinhada com a tarefa LeIsaac. Atualmente suportado:

  • so101_pick_orange
  • so101_lift_cube
  • so101_clean_toytable
  • bi_so101_fold_cloth

Alterne as tarefas direcionando um script diferente ao chamar make_env, por exemplo:

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)

Observação: ao trabalhar com bi_so101_fold_cloth, chame initialize() imediatamente após recuperar o env antes de executar qualquer outra operação:

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