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 ahora admite aprendizaje por imitación en simulación con LeIsaac. Configura tareas de manipulación cotidianas, teleopera el robot, recopila demostraciones, súbelas al Hub y entrena políticas en LeRobot, todo en un solo ciclo.

LeIsaac se integra con IsaacLab y la configuración Leader/Follower de SO101 para ofrecer:

  • 🕹️ Flujos de trabajo centrados en la teleoperación para la recopilación de datos
  • 📦 Conversión de datos integrada lista para el entrenamiento con LeRobot
  • 🤖 Habilidades cotidianas como recoger naranjas, levantar cubos, limpiar mesas y doblar tela
  • ☁️ Mejoras en curso de LightWheel: simulación en la nube, soporte para EnvHub, herramientas Sim2Real y más

A continuación encontrará las tareas de LeIsaac actualmente admitidas, expuestas a través de LeRobot EnvHub.

Entornos disponibles

La siguiente tabla enumera todas las tareas y entornos disponibles en LeIsaac x LeRobot Envhub. También puede obtener la lista más reciente de entornos ejecutando el siguiente comando:

python scripts/environments/list_envs.py
TareaID del entornoDescripción de la tareaRobot relacionado
LeIsaac-SO101-PickOrange-v0

LeIsaac-SO101-PickOrange-Direct-v0
Elige tres naranjas y colócalas en el plato, luego restablece el brazo al estado de reposo.Seguidor de un solo brazo SO101
LeIsaac-SO101-LiftCube-v0

LeIsaac-SO101-LiftCube-Direct-v0
Levanta el cubo rojo.Seguidor de un solo brazo SO101
LeIsaac-SO101-CleanToyTable-v0

LeIsaac-SO101-CleanToyTable-BiArm-v0

LeIsaac-SO101-CleanToyTable-BiArm-Direct-v0
Elige dos objetos con la letra e para la caja y restablece el brazo al estado de reposo.Seguidor de un solo brazo SO101

Seguidor de doble brazo SO101
LeIsaac-SO101-FoldCloth-BiArm-v0

LeIsaac-SO101-FoldCloth-BiArm-Direct-v0
Dobla la tela y restablece el brazo al estado de reposo.

Nota: Solo DirectEnv admite check_success en esta tarea.
Bi-Arm SO101 Follower

Carga LeIsaac directamente en LeRobot con una sola línea de código

EnvHub: Comparte entornos de LeIsaac a través de HuggingFace

EnvHub es nuestro centro de entornos reproducibles: inicia una simulación empaquetada con una sola línea, experimenta de inmediato y publica tus propias tareas para la comunidad.

LeIsaac ofrece soporte para EnvHub para que puedas consumir o compartir tareas con solo unos pocos comandos.

Cómo empezar, configuración del entorno

Ejecuta los siguientes comandos para configurar tus entornos 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

Ejemplo de uso

EnvHub expone cada tarea compatible con LeIsaac en una interfaz uniforme. Los ejemplos siguientes cargan so101_pick_orange y demuestran un despliegue con acciones aleatorias y una teleoperación interactiva.

Acción aleatoria

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

Deberías ver el brazo SO101 oscilando bajo comandos puramente aleatorios.

Teleoperación

El stack de teleoperación de LeRobot puede controlar el brazo simulado.

Conecte el controlador líder SO101 y ejecute el comando de calibración a continuación.

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

Y luego, ejecuta el script de teleop.

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

Ejecutar el script permite operar el brazo simulado mediante el dispositivo físico Leader.

☁️ Simulación en la nube (No requiere GPU)

¿No tienes una GPU local o los controladores adecuados? ¡No hay problema! Puedes ejecutar LeIsaac por completo en la nube sin ninguna configuración. LeIsaac funciona desde el principio en NVIDIA Brev, lo que te proporciona un entorno completamente configurado directamente en tu navegador.

👉 Comienza aquí: https://lightwheelai.github.io/leisaac/docs/cloud_simulation/nvidia_brev

Una vez que tu instancia esté desplegada, simplemente abre el enlace para puerto 80 (HTTP) para iniciar Visual Studio Code Server (contraseña predeterminada: password). Desde allí, puedes ejecutar simulaciones, editar código y visualizar entornos de IsaacLab, todo desde tu navegador web.

Sin GPU, sin controladores, sin instalación local. Solo haz clic y ejecuta.

Notas adicionales

Mantenemos la cobertura de EnvHub alineada con la tarea de LeIsaac. Actualmente soportado:

  • so101_pick_orange
  • so101_lift_cube
  • so101_clean_toytable
  • bi_so101_fold_cloth

Cambie de tareas apuntando a un script diferente al llamar a make_env, por ejemplo:

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)

Nota: al trabajar con bi_so101_fold_cloth, llama a initialize() inmediatamente después de obtener el env antes de realizar cualquier otra operació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