LeRobot documentation
LeIsaac × LeRobot EnvHub
LeIsaac × LeRobot EnvHub
LeRobot EnvHub hiện hỗ trợ học bắt chước trong mô phỏng với LeIsaac. Khởi chạy các tác vụ thao tác hàng ngày, điều khiển robot từ xa, thu thập các bản demo, đẩy chúng lên Hub và huấn luyện chính sách trong LeRobot — tất cả trong một vòng lặp.
LeIsaac tích hợp với IsaacLab và cấu hình Leader/Follower SO101 để cung cấp:
- 🕹️ Quy trình ưu tiên điều khiển từ xa cho việc thu thập dữ liệu
- 📦 Chuyển đổi dữ liệu tích hợp sẵn sẵn sàng cho huấn luyện LeRobot
- 🤖 Kỹ năng hàng ngày như hái cam, nâng khối lập phương, lau bàn và gấp vải
- ☁️ Các nâng cấp đang diễn ra từ LightWheel: mô phỏng trên cloud, hỗ trợ EnvHub, công cụ Sim2Real và nhiều hơn nữa
Dưới đây là các tác vụ LeIsaac hiện được hỗ trợ, được cung cấp thông qua LeRobot EnvHub.
Các Môi trường Có sẵn
Bảng dưới đây liệt kê tất cả các tác vụ và môi trường có sẵn trong LeIsaac x LeRobot Envhub. Bạn cũng có thể lấy danh sách môi trường mới nhất bằng cách chạy lệnh sau:
python scripts/environments/list_envs.py
| Nhiệm vụ | ID môi trường | Mô tả tác vụ | Robot liên quan |
|---|---|---|---|
| LeIsaac-SO101-PickOrange-v0 LeIsaac-SO101-PickOrange-Direct-v0 | Chọn ba quả cam và đặt chúng vào đĩa, sau đó đặt lại cánh tay về trạng thái nghỉ. | Follower SO101 một cánh tay | |
| LeIsaac-SO101-LiftCube-v0 LeIsaac-SO101-LiftCube-Direct-v0 | Nâng khối lập phương màu đỏ lên. | Follower SO101 một cánh tay | |
| LeIsaac-SO101-CleanToyTable-v0 LeIsaac-SO101-CleanToyTable-BiArm-v0 LeIsaac-SO101-CleanToyTable-BiArm-Direct-v0 | Chọn hai vật có chữ e vào hộp, và đặt lại cánh tay về trạng thái nghỉ. | Follower SO101 một cánh tay Follower SO101 hai cánh tay | |
| LeIsaac-SO101-FoldCloth-BiArm-v0 LeIsaac-SO101-FoldCloth-BiArm-Direct-v0 | Gấp khăn và đặt lại cánh tay về trạng thái nghỉ. Lưu ý: Chỉ có DirectEnv hỗ trợ check_success trong tác vụ này. | Bi-Arm SO101 Follower |
Tải LeIsaac trực tiếp trong LeRobot chỉ với một dòng mã
EnvHub: Chia sẻ các môi trường LeIsaac thông qua HuggingFace
EnvHub là trung tâm môi trường tái lập của chúng tôi, cho phép khởi động một mô phỏng đóng gói chỉ với một dòng lệnh, thử nghiệm ngay lập tức và công bố các tác vụ của riêng bạn cho cộng đồng.
LeIsaac hỗ trợ EnvHub để bạn có thể sử dụng hoặc chia sẻ các tác vụ chỉ với vài lệnh.
Cách bắt đầu, thiết lập môi trường
Chạy các lệnh sau để thiết lập môi trường mã của bạ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.0Ví dụ sử dụng
EnvHub cung cấp mọi tác vụ được LeIsaac hỗ trợ trong một giao diện thống nhất. Các ví dụ bên dưới tải so101_pick_orange và minh họa một lượt rollout với hành động ngẫu nhiên cùng một phiên điều khiển từ xa tương tác.
Hành động ngẫu nhiên
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
Bạn sẽ thấy cánh tay SO101 vung vẩy dưới các lệnh hoàn toàn ngẫu nhiên.
Điều khiển từ xa
Stack teleoperation của LeRobot có thể điều khiển cánh tay mô phỏng.
Kết nối bộ điều khiển SO101 Leader, chạy lệnh hiệu chuẩn bên dưới.
lerobot-calibrate \
--teleop.type=so101_leader \
--teleop.port=/dev/ttyACM0 \
--teleop.id=leaderSau đó, chạy script 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
Chạy script cho phép bạn điều khiển cánh tay mô phỏng bằng thiết bị Leader vật lý.
☁️ Mô phỏng trên đám mây (Không cần GPU)
Không có GPU cục bộ hoặc trình điều khiển phù hợp? Không sao cả! Bạn có thể chạy LeIsaac hoàn toàn trên đám mây mà không cần thiết lập gì. LeIsaac hoạt động ngay lập tức trên NVIDIA Brev, cung cấp cho bạn một môi trường được cấu hình đầy đủ ngay trong trình duyệt.
👉 Bắt đầu tại đây: https://lightwheelai.github.io/leisaac/docs/cloud_simulation/nvidia_brev
Sau khi instance của bạn được triển khai, chỉ cần mở liên kết cho cổng 80 (HTTP) để khởi động Visual Studio Code Server (mật khẩu mặc định: password). Từ đó, bạn có thể chạy mô phỏng, chỉnh sửa mã và trực quan hóa các môi trường IsaacLab — tất cả đều từ trình duyệt web của bạn.
Không cần GPU, không cần trình điều khiển, không cần cài đặt cục bộ. Chỉ cần nhấp chuột và chạy.
Ghi chú bổ sung
Chúng tôi đảm bảo phạm vi bao phủ của EnvHub luôn đồng bộ với tác vụ LeIsaac. Hiện được hỗ trợ:
so101_pick_orangeso101_lift_cubeso101_clean_toytablebi_so101_fold_cloth
Chuyển đổi tác vụ bằng cách nhắm đến một script khác khi gọi make_env, ví dụ:
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)Lưu ý: khi làm việc với bi_so101_fold_cloth, hãy gọi initialize() ngay sau khi lấy env trước khi thực hiện bất kỳ thao tác nào khác:
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...