LejuRobot Lab is a robotics simulation and reinforcement learning framework built on top of Isaac Lab. It provides tools for motion imitation, training RL agents, and replaying motion data for humanoid robots such as RobanS14 and KuavoS52.
- Multi-Robot Support: Supports multiple robot models (RobanS14, KuavoS52, etc.)
- Motion Imitation: Train RL agents to imitate reference motions from NPZ files
- Data Conversion: Convert motion data between CSV and NPZ formats
- Motion Replay: Visualize and replay motion sequences in Isaac Sim
- RL Training: Train policies using RSL-RL framework
- Flexible Configuration: Support for local motion files and WandB registry
This framework is built on the following core dependencies with specific versions:
- Python: >= 3.10
- Isaac Sim: 4.5.0
- Isaac Lab: 2.1
- RSL-RL: Included with Isaac Lab 2.1 (via
isaaclab_rlpackage) - PyTorch: Compatible with Isaac Lab 2.1 requirements
- CUDA: Required for GPU acceleration (compatible with Isaac Sim 4.5.0)
Note: The RSL-RL library is integrated into Isaac Lab 2.1 as part of the isaaclab_rl package.
-
Install Isaac Lab following the official documentation
-
Install the package:
cd source/leju_robot pip install -e .
-
Install dependencies:
pip install -r requirements.txt # If available -
Configure IDE Type Checking (Optional but Recommended):
For proper IDE support (autocomplete, type checking) with VS Code/Pyright, you need to configure
extraPathsinpyproject.toml:[tool.pyright] extraPaths = [ "/path/to/IsaacLab2.1/source/isaaclab", "/path/to/IsaacLab2.1/source/isaaclab_assets", "/path/to/IsaacLab2.1/source/isaaclab_mimic", "/path/to/IsaacLab2.1/source/isaaclab_rl", "/path/to/IsaacLab2.1/source/isaaclab_tasks", "/path/to/IsaacLab2.1/IsaacLabExtensionRoban/source/ext_kuavo", "/path/to/isaac-sim-4.5/exts/omni.isaac.ml_archive/pip_prebundle", ]
Why this is needed:
- These paths point to Isaac Lab source packages that are not installed as standard Python packages
- Pyright (VS Code's type checker) needs these paths to resolve imports and provide autocomplete
- Without this configuration, you may see import errors and missing type hints in your IDE
- Important: Update the paths to match your actual Isaac Lab installation directory
Note: This configuration only affects IDE type checking and does not impact runtime execution. The actual imports work at runtime because Isaac Lab packages are added to
PYTHONPATHduring execution.
LejuRobot_lab/
├── source/leju_robot/ # Main package
│ ├── leju_robot/ # Core robot modules
│ │ ├── assets/ # Robot asset definitions
│ │ ├── actuators/ # Actuator configurations
│ │ └── tasks/ # Task definitions
│ │ ├── tracking/ # Motion tracking tasks (dance, standup)
│ │ │ ├── agents/ # RL agent configs
│ │ │ ├── mdp/ # MDP components
│ │ │ └── config/ # Robot-specific configs
│ │ │ ├── robanS14/ # RobanS14 configs (dance, standup)
│ │ │ └── kuavoS52/ # KuavoS52 configs (dance)
│ │ └── locomotion/ # Locomotion velocity tasks
│ │ └── velocity/ # Velocity control tasks
│ │ ├── agents/ # RL agent configs
│ │ ├── mdp/ # MDP components
│ │ └── config/ # Robot-specific configs
│ │ ├── robanS14/ # RobanS14 velocity configs
│ │ └── kuavoS52/ # KuavoS52 velocity configs
│ └── leju_data/ # Robot data (URDF, meshes, etc.)
├── scripts/ # Utility & training scripts
│ ├── motion_tool/ # Motion data tools
│ │ ├── csv_to_npz&deploycsv.py # CSV → NPZ & deploy-CSV converter
│ │ ├── pkl_to_npz&deploycsv.py # PKL → NPZ & deploy-CSV converter
│ │ ├── replay_npz.py # Single NPZ replay
│ │ └── replay_npz_list.py # Multiple NPZ replay
│ └── reinforcement_learning/ # RL training & play scripts
│ └── rsl_rl/ # RSL-RL training scripts
│ ├── train.py # Train policies (all task types)
│ └── play.py # Play trained policies
└── docker/ # Docker configuration
Convert motion data from CSV format to NPZ format:
python scripts/motion_tool/csv_to_npz&deploycsv.py \
--input_file path/to/motion.csv \
--input_fps 30 \
--output_fps 50 \
--robot robanS14 \
--npz_output output/motion.npz \
--csv_output output/motion_deploy.csvParameters:
--input_file: Path to input CSV file (required)--input_fps: FPS of input motion (default: 30)--output_fps: FPS of output motion (default: 50)--frame_range START END: Optional frame range to extract--npz_output: Output NPZ file path--csv_output: Optional deploy CSV output path--robot: Robot model name (robanS14 or kuavoS52)
Replay a single NPZ motion file:
python scripts/motion_tool/replay_npz.py \
--motion_file path/to/motion.npz \
--robot robanS14Parameters:
--motion_file: Path to NPZ motion file--robot: Robot model name (default: robanS14)
Replay multiple NPZ files in sequence:
python scripts/motion_tool/replay_npz_list.py \
--motion_file path/to/motion1.npz \
--robot robanS14Or edit MOTION_FILES list in the script to specify multiple files.
Train a reinforcement learning agent for different task types:
Tracking Task (Motion Imitation):
python scripts/reinforcement_learning/rsl_rl/train.py \
--task Tracking-Dance-Flat-RobanS14 \
--motion_file path/to/motion.npz \
--num_envs 8192 \
--headless \
--max_iterations 25000Velocity Task (Locomotion):
python scripts/reinforcement_learning/rsl_rl/train.py \
--task Velocity-Flat-RobanS14 \
--num_envs 8192 \
--headless \
--max_iterations 25000Parameters:
--task: Task name (e.g.,Tracking-Dance-Flat-RobanS14,Velocity-Flat-RobanS14)--motion_file: Path to reference motion NPZ file (required for tracking tasks)--num_envs: Number of parallel environments--max_iterations: Maximum training iterations--headless: Run without GUI--resume: Resume training from checkpoint--load_run: Run ID to load checkpoint from--checkpoint: Checkpoint filename (e.g.,model_25000.pt)
Test a trained policy:
python scripts/reinforcement_learning/rsl_rl/play.py \
--task Tracking-Dance-Flat-RobanS14-Play \
--load_run 2026-02-05_15-18-56 \
--checkpoint model_52500.pt \
--num_envs 1Parameters:
--task: Task name with-Playsuffix--load_run: Run ID from training logs--checkpoint: Checkpoint filename--num_envs: Number of environments (typically 1 for visualization)
The project includes pre-configured VS Code debug configurations in .vscode/launch.json for easy one-click training and testing.
How to use:
-
Set Python Interpreter (Important!):
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) to open the command palette - Type "Python: Select Interpreter" and select it
- Choose the Python interpreter from your virtual environment (e.g.,
venv/bin/pythonorconda envs/your_env/bin/python) - Alternatively, click on the Python version in the bottom-right corner of VS Code and select the correct interpreter
- This step is required - VS Code must use the same Python environment where Isaac Lab and project dependencies are installed
- Press
-
Open VS Code in the project root directory
-
Go to Run and Debug:
- Press
F5or click the "Run and Debug" icon in the sidebar - Or use the menu:
Run > Start Debugging
- Press
-
Select a configuration from the dropdown at the top:
-
Motion Tools:
csv to npz: Convert CSV motion files to NPZ formatpkl to npz: Convert PKL motion files to NPZ formatreplay npz: Replay a single NPZ motion filereplay npz list: Replay multiple NPZ motion files
-
Training Configurations:
train robanS14 walk: Train RobanS14 velocity control tasktrain robanS14 dance: Train RobanS14 dance tracking tasktrain robanS14 standup: Train RobanS14 standup tracking tasktrain kuavoS52 walk: Train KuavoS52 velocity control tasktrain kuavoS52 dance: Train KuavoS52 dance tracking task
-
Play Configurations:
play robanS14 walk: Test trained RobanS14 velocity policyplay robanS14 dance: Test trained RobanS14 dance policyplay robanS14 standup: Test trained RobanS14 standup policyplay kuavoS52 walk: Test trained KuavoS52 velocity policyplay kuavoS52 dance: Test trained KuavoS52 dance policy
-
-
Customize parameters (optional):
- Edit
.vscode/launch.jsonto modify arguments - Uncomment/comment lines to enable/disable options
- Update
--load_runand--checkpointfor play configurations
- Edit
Tips:
- Set breakpoints in your code for debugging
- Use
--headlessflag for training without GUI (faster) - Adjust
--num_envsbased on your GPU memory - For play configurations, update
--load_runwith your training run ID
- RobanS14: 21-DOF humanoid robot
- KuavoS52: Humanoid robot
Tracking Tasks (Motion Imitation):
Tracking-Dance-Flat-RobanS14/Tracking-Dance-Flat-RobanS14-PlayTracking-Standup-Flat-RobanS14/Tracking-Standup-Flat-RobanS14-PlayTracking-Dance-Flat-KuavoS52/Tracking-Dance-Flat-KuavoS52-Play
Velocity Tasks (Locomotion):
Velocity-Flat-RobanS14/Velocity-Flat-RobanS14-PlayVelocity-Rough-RobanS14/Velocity-Rough-RobanS14-PlayVelocity-Flat-KuavoS52/Velocity-Flat-KuavoS52-PlayVelocity-Rough-KuavoS52/Velocity-Rough-KuavoS52-Play
NPZ files should contain the following arrays:
joint_pos: Joint positions (T, num_joints)joint_vel: Joint velocities (T, num_joints)body_pos_w: Body positions in world frame (T, num_bodies, 3)body_quat_w: Body quaternions in world frame (T, num_bodies, 4)body_lin_vel_w: Body linear velocities (T, num_bodies, 3)body_ang_vel_w: Body angular velocities (T, num_bodies, 3)fps: Frame rate (scalar)
Robot configurations are defined in:
source/leju_robot/leju_robot/tasks/{task_type}/config/{robot_name}/
Each robot has its own configuration including:
- Environment settings
- MDP components (observations, rewards, events, etc.)
- Agent configurations
- Task-specific parameters
Docker configuration is available in the docker/ directory for containerized deployment.
Apache 2.0
Contributions are welcome! Please follow the project's coding standards and submit pull requests.
LejuRobot Lab 是一个基于 Isaac Lab 构建的机器人仿真和强化学习框架。它为 RobanS14 和 KuavoS52 等类人机器人提供动作模仿、训练 RL 智能体以及回放动作数据的工具。
- 多机器人支持:支持多种机器人模型(RobanS14、KuavoS52 等)
- 动作模仿:训练 RL 智能体模仿来自 NPZ 文件的参考动作
- 数据转换:在 CSV 和 NPZ 格式之间转换动作数据
- 动作回放:在 Isaac Sim 中可视化和回放动作序列
- RL 训练:使用 RSL-RL 框架训练策略
- 灵活配置:支持本地动作文件和 WandB 注册表
本框架基于以下核心依赖的特定版本构建:
- Python: >= 3.10
- Isaac Sim: 4.5.0
- Isaac Lab: 2.1
- RSL-RL: 随 Isaac Lab 2.1 包含(通过
isaaclab_rl包) - PyTorch: 与 Isaac Lab 2.1 要求兼容
- CUDA: 需要用于 GPU 加速(与 Isaac Sim 4.5.0 兼容)
注意:RSL-RL 库已集成到 Isaac Lab 2.1 中,作为 isaaclab_rl 包的一部分。
-
安装 Isaac Lab,按照官方文档操作
-
安装包:
cd source/leju_robot pip install -e .
-
安装依赖:
pip install -r requirements.txt # 如果存在 -
配置 IDE 类型检查(可选但推荐):
为了在 VS Code/Pyright 中获得正确的 IDE 支持(自动补全、类型检查),您需要在
pyproject.toml中配置extraPaths:[tool.pyright] extraPaths = [ "/path/to/IsaacLab2.1/source/isaaclab", "/path/to/IsaacLab2.1/source/isaaclab_assets", "/path/to/IsaacLab2.1/source/isaaclab_mimic", "/path/to/IsaacLab2.1/source/isaaclab_rl", "/path/to/IsaacLab2.1/source/isaaclab_tasks", "/path/to/IsaacLab2.1/IsaacLabExtensionRoban/source/ext_kuavo", "/path/to/isaac-sim-4.5/exts/omni.isaac.ml_archive/pip_prebundle", ]
为什么需要这个配置:
- 这些路径指向 Isaac Lab 的源代码包,它们不是作为标准 Python 包安装的
- Pyright(VS Code 的类型检查器)需要这些路径来解析导入并提供自动补全
- 没有此配置,您可能会在 IDE 中看到导入错误和缺少类型提示
- 重要:请更新路径以匹配您实际的 Isaac Lab 安装目录
注意:此配置仅影响 IDE 类型检查,不会影响运行时执行。实际的导入在运行时可以正常工作,因为 Isaac Lab 包在执行时被添加到
PYTHONPATH中。
LejuRobot_lab/
├── source/leju_robot/ # 主包
│ ├── leju_robot/ # 核心机器人模块
│ │ ├── assets/ # 机器人资源定义
│ │ ├── actuators/ # 执行器配置
│ │ └── tasks/ # 任务定义
│ │ ├── tracking/ # 动作跟踪任务(dance, standup)
│ │ │ ├── agents/ # RL 智能体配置
│ │ │ ├── mdp/ # MDP 组件
│ │ │ └── config/ # 机器人特定配置
│ │ │ ├── robanS14/ # RobanS14 配置(dance, standup)
│ │ │ └── kuavoS52/ # KuavoS52 配置(dance)
│ │ └── locomotion/ # 运动速度任务
│ │ └── velocity/ # 速度控制任务
│ │ ├── agents/ # RL 智能体配置
│ │ ├── mdp/ # MDP 组件
│ │ └── config/ # 机器人特定配置
│ │ ├── robanS14/ # RobanS14 速度配置
│ │ └── kuavoS52/ # KuavoS52 速度配置
│ └── leju_data/ # 机器人数据(URDF、网格等)
├── scripts/ # 工具脚本 & 训练脚本
│ ├── motion_tool/ # 动作数据工具
│ │ ├── csv_to_npz&deploycsv.py # CSV 转 NPZ & deploy-CSV 转换器
│ │ ├── pkl_to_npz&deploycsv.py # PKL 转 NPZ & deploy-CSV 转换器
│ │ ├── replay_npz.py # 单个 NPZ 回放
│ │ └── replay_npz_list.py # 多个 NPZ 回放
│ └── reinforcement_learning/ # 强化学习训练 & 回放
│ └── rsl_rl/ # RSL-RL 训练脚本
│ ├── train.py # 训练策略(所有任务类型)
│ └── play.py # 运行训练好的策略
└── docker/ # Docker 配置
将动作数据从 CSV 格式转换为 NPZ 格式:
python scripts/motion_tool/csv_to_npz&deploycsv.py \
--input_file path/to/motion.csv \
--input_fps 30 \
--output_fps 50 \
--robot robanS14 \
--npz_output output/motion.npz \
--csv_output output/motion_deploy.csv参数说明:
--input_file: 输入 CSV 文件路径(必需)--input_fps: 输入动作的帧率(默认:30)--output_fps: 输出动作的帧率(默认:50)--frame_range START END: 可选,要提取的帧范围--npz_output: 输出 NPZ 文件路径--csv_output: 可选的部署 CSV 输出路径--robot: 机器人型号名称(robanS14 或 kuavoS52)
回放单个 NPZ 动作文件:
python scripts/motion_tool/replay_npz.py \
--motion_file path/to/motion.npz \
--robot robanS14参数说明:
--motion_file: NPZ 动作文件路径--robot: 机器人型号名称(默认:robanS14)
按顺序回放多个 NPZ 文件:
python scripts/motion_tool/replay_npz_list.py \
--motion_file path/to/motion1.npz \
--robot robanS14或在脚本中编辑 MOTION_FILES 列表以指定多个文件。
训练强化学习智能体,支持不同类型的任务:
跟踪任务(动作模仿):
python scripts/reinforcement_learning/rsl_rl/train.py \
--task Tracking-Dance-Flat-RobanS14 \
--motion_file path/to/motion.npz \
--num_envs 8192 \
--headless \
--max_iterations 25000速度任务(运动控制):
python scripts/reinforcement_learning/rsl_rl/train.py \
--task Velocity-Flat-RobanS14 \
--num_envs 8192 \
--headless \
--max_iterations 25000参数说明:
--task: 任务名称(如Tracking-Dance-Flat-RobanS14、Velocity-Flat-RobanS14)--motion_file: 参考动作 NPZ 文件路径(跟踪任务必需)--num_envs: 并行环境数量--max_iterations: 最大训练迭代次数--headless: 无 GUI 运行--resume: 从检查点恢复训练--load_run: 要加载的检查点的运行 ID--checkpoint: 检查点文件名(如model_25000.pt)
测试训练好的策略:
python scripts/reinforcement_learning/rsl_rl/play.py \
--task Tracking-Dance-Flat-RobanS14-Play \
--load_run 2026-02-05_15-18-56 \
--checkpoint model_52500.pt \
--num_envs 1参数说明:
--task: 任务名称,需带-Play后缀--load_run: 训练日志中的运行 ID--checkpoint: 检查点文件名--num_envs: 环境数量(通常为 1 用于可视化)
项目在 .vscode/launch.json 中包含了预配置的 VS Code 调试配置,可以一键启动训练和测试任务。
使用方法:
-
设置 Python 解释器(重要!):
- 按
Ctrl+Shift+P(Mac 上为Cmd+Shift+P)打开命令面板 - 输入 "Python: Select Interpreter" 并选择
- 选择虚拟环境中的 Python 解释器(例如
venv/bin/python或conda envs/your_env/bin/python) - 或者点击 VS Code 右下角的 Python 版本,选择正确的解释器
- 此步骤是必需的 - VS Code 必须使用安装了 Isaac Lab 和项目依赖的相同 Python 环境
- 按
-
在 VS Code 中打开项目:
- 在项目根目录打开 VS Code
-
进入运行和调试:
- 按
F5或点击侧边栏的"运行和调试"图标 - 或使用菜单:
运行 > 启动调试
- 按
-
从顶部下拉菜单中选择配置:
-
动作工具:
csv to npz: 将 CSV 动作文件转换为 NPZ 格式pkl to npz: 将 PKL 动作文件转换为 NPZ 格式replay npz: 回放单个 NPZ 动作文件replay npz list: 回放多个 NPZ 动作文件
-
训练配置:
train robanS14 walk: 训练 RobanS14 速度控制任务train robanS14 dance: 训练 RobanS14 舞蹈跟踪任务train robanS14 standup: 训练 RobanS14 站立跟踪任务train kuavoS52 walk: 训练 KuavoS52 速度控制任务train kuavoS52 dance: 训练 KuavoS52 舞蹈跟踪任务
-
运行配置:
play robanS14 walk: 测试训练好的 RobanS14 速度策略play robanS14 dance: 测试训练好的 RobanS14 舞蹈策略play robanS14 standup: 测试训练好的 RobanS14 站立策略play kuavoS52 walk: 测试训练好的 KuavoS52 速度策略play kuavoS52 dance: 测试训练好的 KuavoS52 舞蹈策略
-
-
自定义参数(可选):
- 编辑
.vscode/launch.json以修改参数 - 取消注释/注释行以启用/禁用选项
- 更新运行配置中的
--load_run和--checkpoint
- 编辑
提示:
- 在代码中设置断点进行调试
- 训练时使用
--headless标志以无 GUI 模式运行(更快) - 根据 GPU 内存调整
--num_envs - 对于运行配置,使用您的训练运行 ID 更新
--load_run
- RobanS14:21 自由度类人机器人
- KuavoS52:类人机器人
跟踪任务(动作模仿):
Tracking-Dance-Flat-RobanS14/Tracking-Dance-Flat-RobanS14-PlayTracking-Standup-Flat-RobanS14/Tracking-Standup-Flat-RobanS14-PlayTracking-Dance-Flat-KuavoS52/Tracking-Dance-Flat-KuavoS52-Play
速度任务(运动控制):
Velocity-Flat-RobanS14/Velocity-Flat-RobanS14-PlayVelocity-Rough-RobanS14/Velocity-Rough-RobanS14-PlayVelocity-Flat-KuavoS52/Velocity-Flat-KuavoS52-PlayVelocity-Rough-KuavoS52/Velocity-Rough-KuavoS52-Play
NPZ 文件应包含以下数组:
joint_pos: 关节位置 (T, num_joints)joint_vel: 关节速度 (T, num_joints)body_pos_w: 世界坐标系中的身体位置 (T, num_bodies, 3)body_quat_w: 世界坐标系中的身体四元数 (T, num_bodies, 4)body_lin_vel_w: 身体线速度 (T, num_bodies, 3)body_ang_vel_w: 身体角速度 (T, num_bodies, 3)fps: 帧率(标量)
机器人配置定义在:
source/leju_robot/leju_robot/tasks/{task_type}/config/{robot_name}/
每个机器人都有自己的配置,包括:
- 环境设置
- MDP 组件(观测、奖励、事件等)
- 智能体配置
- 任务特定参数
docker/ 目录中提供了 Docker 配置,用于容器化部署。
Apache 2.0
欢迎贡献!请遵循项目的编码标准并提交 Pull Request。