Skip to content

Repository files navigation

HighTorque Mini Pi Plus AMP

Isaac Sim Isaac Lab Python MuJoCo License

AMP locomotion training and simulation tools for HighTorque's Mini Pi Plus humanoid robot. The project uses Isaac Lab for GPU-accelerated reinforcement learning, Adversarial Motion Priors (AMP) for motion imitation, symmetry augmentation for data efficiency, and MuJoCo for simulation-to-simulation validation.

This repository is intended for research and simulation. Validate every policy in a controlled environment before connecting it to physical hardware.

What is included

  • Mini Pi Plus robot descriptions for Isaac Lab (URDF/USD) and MuJoCo (MJCF).
  • AMP expert and visualization motion data under legged_lab/envs/pi_plus/.
  • AMP + PPO training with mirrored trajectory augmentation (pi_plus_amp_sym_flat).
  • Policy playback, AMP animation, TensorBoard logging, and MuJoCo sim2sim tools.
  • Three example checkpoints in Exported_policy/.
  • An optional compressed Mini Pi Plus asset archive at legged_lab/assets/hightorque/pi_plus.
  • A vendored, modified rsl_rl implementation with AMP support.

The repository also retains the earlier TienKung and Hi task implementations in legged_lab/envs/tienkung/ and legged_lab/envs/hi/. They are useful for comparison but are not required for Mini Pi Plus experiments.

Quick preview

The following recordings show the Mini Pi Plus policy running in Isaac Lab and MuJoCo:

Isaac Lab playback MuJoCo sim2sim

Requirements

  • Linux x86_64 with an NVIDIA GPU and a driver compatible with Isaac Sim 4.5.0.
  • Python 3.10.
  • Isaac Sim 4.5.0 and Isaac Lab 2.1.0, installed using the official Isaac Lab guide.
  • MuJoCo 3.3.2 for sim2sim validation.
  • CUDA/PyTorch versions supplied by the Isaac Lab installation.

environment.yml is a small helper environment for the Python-side dependencies. Isaac Sim and Isaac Lab must still be installed separately according to NVIDIA's instructions.

Installation

Use the Python environment created by Isaac Lab, then install this repository and the local RSL-RL fork from the repository root:

git clone <repository-url> mini-pi-plus-amp
cd mini-pi-plus-amp

python -m pip install -e .
python -m pip install -e rsl_rl

For a clean non-Isaac environment, the helper file can be used as a starting point:

conda env create -f environment.yml
conda activate mini_pi_plus_amp

Mini Pi Plus workflow

All commands below are run from the repository root.

Train

pi_plus_amp_sym_flat is the primary Mini Pi Plus task. The default configuration uses 4,096 parallel environments and 50,000 iterations; override either value from the command line when needed.

python legged_lab/scripts/train.py \
  --task=pi_plus_amp_sym_flat \
  --headless \
  --logger=tensorboard \
  --num_envs=4096

Training runs are written to logs/pi_plus_amp_sym_flat/<timestamp>/. Logs and checkpoints are intentionally ignored by Git; keep only selected checkpoints or publish them as release assets.

Play a checkpoint in Isaac Lab

Replace <run-directory> with a directory name under logs/pi_plus_amp_sym_flat/:

python legged_lab/scripts/play.py \
  --task=pi_plus_amp_sym_flat \
  --load_run=<run-directory> \
  --checkpoint=model_40000.pt \
  --num_envs=1

The play script exports a TorchScript policy to <run-directory>/exported/policy.pt for downstream use.

The --load_run argument also accepts a direct checkpoint path, including a checkpoint stored at the experiment root:

python legged_lab/scripts/play.py \
  --task=pi_plus_amp_sym_flat \
  --load_run=logs/pi_plus_amp_sym_flat/model_27000.pt \
  --num_envs=1

Checkpoints produced before the AMP observation layout was expanded to 52 dimensions can still be used for playback. They are not compatible with resuming AMP training; start a new training run to create a checkpoint with the current discriminator layout.

Validate in MuJoCo (sim2sim)

The Mini Pi Plus MuJoCo runner accepts either an exported TorchScript policy or a training checkpoint. The repository checkpoints are usable directly through the checkpoint loader:

python legged_lab/scripts/sim2sim_pi_plus.py \
  --policy=Exported_policy/model_40000.pt \
  --model=legged_lab/assets/hightorque/pi_plus/pi_plus.xml \
  --duration=30

The MuJoCo viewer requires a graphical session. For a policy exported by play.py, pass the generated path instead:

python legged_lab/scripts/sim2sim_pi_plus.py \
  --policy=logs/pi_plus_amp_sym_flat/<run-directory>/exported/policy.pt \
  --duration=30

Keep the backslash as the final character on each continued shell line. A one-line form avoids copy/paste issues:

python legged_lab/scripts/sim2sim_pi_plus.py --policy=logs/pi_plus_amp_sym_flat/model_40000.pt --duration=30

Visualize AMP reference motions

python legged_lab/scripts/play_amp_animation.py \
  --task=pi_plus_amp_sym_flat \
  --num_envs=1

TensorBoard

tensorboard --logdir=logs/pi_plus_amp_sym_flat

Repository layout

legged_lab/
  assets/hightorque/pi_plus/       Mini Pi Plus URDF, MJCF, USD, and meshes
  envs/pi_plus/                    Mini Pi Plus environment, rewards, and motion data
  scripts/                         train, play, animation, and sim2sim entry points
  mdp/                             Reusable observations, rewards, and terminations
  sensors/                         Camera and LiDAR integrations
rsl_rl/                            Local RSL-RL fork with AMP extensions
Exported_policy/                   Example Mini Pi Plus checkpoints
docs/                              Media and Chinese reproduction notes

Development

Install the repository's formatting hooks and run them before opening a pull request:

python -m pip install pre-commit
pre-commit install
pre-commit run --all-files

The Isaac Lab application is required for runtime tests. A dependency-free syntax check for the Python sources is:

python -m compileall -q legged_lab rsl_rl/rsl_rl

License and third-party notices

This repository is distributed under the BSD-3-Clause license; see LICENSE. It contains code derived from RSL-RL, Isaac Lab, Legged Lab, and TienKung-Lab, with their attribution notices retained in source files and license documents. Robot meshes, motion-capture data, photographs, and other media can have rights or terms separate from the source code. Confirm that you have permission to redistribute those assets before publishing a mirror or release package.

Acknowledgements

中文翻译

HighTorque Mini Pi Plus AMP

用于 HighTorque Mini Pi Plus 人形机器人的 AMP(对抗性运动先验)运动训练与仿真工具。项目使用 Isaac Lab 进行 GPU 加速强化学习,使用对抗性运动先验(AMP)进行动作模仿,使用对称性增强提高数据效率,并使用 MuJoCo 进行仿真到仿真(sim2sim)验证。

本仓库用于研究和仿真。在将任何策略连接到实体硬件之前,请先在受控环境中逐一验证。

包含内容

  • Isaac Lab(URDF/USD)和 MuJoCo(MJCF)格式的 Mini Pi Plus 机器人描述文件。
  • 位于 legged_lab/envs/pi_plus/ 下的 AMP 专家动作数据和可视化动作数据。
  • 带镜像轨迹增强的 AMP + PPO 训练任务(pi_plus_amp_sym_flat)。
  • 策略回放、AMP 动画、TensorBoard 日志记录以及 MuJoCo sim2sim 工具。
  • Exported_policy/ 中的三个示例检查点。
  • legged_lab/assets/hightorque/pi_plus 下可选的压缩版 Mini Pi Plus 资源归档。
  • 内置并修改过的、支持 AMP 的 rsl_rl 实现。

仓库还保留了 legged_lab/envs/tienkung/legged_lab/envs/hi/ 下较早的 TienKung 与 Hi 任务实现。它们可用于对比,但不是 Mini Pi Plus 实验所必需的。

快速预览

以下录屏展示了 Mini Pi Plus 策略在 Isaac Lab 和 MuJoCo 中的运行效果:

Isaac Lab 回放 MuJoCo sim2sim

环境要求

  • Linux x86_64、NVIDIA GPU,以及与 Isaac Sim 4.5.0 兼容的驱动程序。
  • Python 3.10。
  • Isaac Sim 4.5.0 和 Isaac Lab 2.1.0,按照 Isaac Lab 官方指南 安装。
  • 用于 sim2sim 验证的 MuJoCo 3.3.2。
  • Isaac Lab 安装所提供的 CUDA/PyTorch 版本。

environment.yml 是一个用于 Python 端依赖的辅助环境文件。Isaac Sim 和 Isaac Lab 仍必须按照 NVIDIA 的说明单独安装。

安装

使用 Isaac Lab 创建的 Python 环境,然后在仓库根目录安装本仓库和本地 RSL-RL 分支:

git clone <repository-url> mini-pi-plus-amp
cd mini-pi-plus-amp

python -m pip install -e .
python -m pip install -e rsl_rl

如果使用干净的非 Isaac 环境,可以将辅助文件作为起点:

conda env create -f environment.yml
conda activate mini_pi_plus_amp

Mini Pi Plus 工作流程

以下所有命令均在仓库根目录执行。

训练

pi_plus_amp_sym_flat 是 Mini Pi Plus 的主要任务。默认配置使用 4,096 个并行环境和 50,000 次迭代;如有需要,可从命令行覆盖任一数值。

python legged_lab/scripts/train.py \
  --task=pi_plus_amp_sym_flat \
  --headless \
  --logger=tensorboard \
  --num_envs=4096

训练结果写入 logs/pi_plus_amp_sym_flat/<timestamp>/。日志和检查点会被 Git 有意忽略;请仅保留选定的检查点,或将其作为发布资源上传。

在 Isaac Lab 中回放检查点

<run-directory> 替换为 logs/pi_plus_amp_sym_flat/ 下的目录名称:

python legged_lab/scripts/play.py \
  --task=pi_plus_amp_sym_flat \
  --load_run=<run-directory> \
  --checkpoint=model_40000.pt \
  --num_envs=1

回放脚本会将 TorchScript 策略导出到 <run-directory>/exported/policy.pt,供后续使用。

--load_run 参数也接受直接的检查点路径,包括存储在实验根目录中的检查点:

python legged_lab/scripts/play.py \
  --task=pi_plus_amp_sym_flat \
  --load_run=logs/pi_plus_amp_sym_flat/model_27000.pt \
  --num_envs=1

在 AMP 观测布局扩展到 52 维之前生成的检查点仍可用于回放,但不兼容 AMP 训练的继续执行;请启动新的训练运行,以生成使用当前判别器布局的检查点。

在 MuJoCo 中验证(sim2sim)

Mini Pi Plus 的 MuJoCo 运行器既接受导出的 TorchScript 策略,也接受训练检查点。仓库中的检查点可以直接通过检查点加载器使用:

python legged_lab/scripts/sim2sim_pi_plus.py \
  --policy=Exported_policy/model_40000.pt \
  --model=legged_lab/assets/hightorque/pi_plus/pi_plus.xml \
  --duration=30

MuJoCo 查看器需要图形会话。如果使用 play.py 导出的策略,请改为传入生成的路径:

python legged_lab/scripts/sim2sim_pi_plus.py \
  --policy=logs/pi_plus_amp_sym_flat/<run-directory>/exported/policy.pt \
  --duration=30

在连续的 shell 命令行中,请确保每一行末尾的最后一个字符是反斜杠。使用单行形式可以避免复制粘贴问题:

python legged_lab/scripts/sim2sim_pi_plus.py --policy=logs/pi_plus_amp_sym_flat/model_40000.pt --duration=30

可视化 AMP 参考动作

python legged_lab/scripts/play_amp_animation.py \
  --task=pi_plus_amp_sym_flat \
  --num_envs=1

TensorBoard

tensorboard --logdir=logs/pi_plus_amp_sym_flat

仓库目录结构

legged_lab/
  assets/hightorque/pi_plus/       Mini Pi Plus 的 URDF、MJCF、USD 和网格文件
  envs/pi_plus/                    Mini Pi Plus 环境、奖励函数和动作数据
  scripts/                         训练、回放、动画和 sim2sim 入口脚本
  mdp/                             可复用的观测、奖励和终止条件
  sensors/                         摄像头和 LiDAR 集成
rsl_rl/                            带 AMP 扩展的本地 RSL-RL 分支
Exported_policy/                   Mini Pi Plus 示例检查点
docs/                              媒体文件和中文复现说明

开发

安装仓库的格式化钩子,并在提交拉取请求前运行:

python -m pip install pre-commit
pre-commit install
pre-commit run --all-files

运行时测试需要 Isaac Lab 应用。对于 Python 源码,可以执行不依赖外部环境的语法检查:

python -m compileall -q legged_lab rsl_rl/rsl_rl

许可证和第三方声明

本仓库以 BSD-3-Clause 许可证发布,详见 LICENSE。其中包含源自 RSL-RL、Isaac Lab、Legged Lab 和 TienKung-Lab 的代码,源文件和许可证文档中保留了相应的署名声明。机器人网格、动作捕捉数据、照片及其他媒体可能具有独立于源代码的权利或使用条款。在发布镜像或发行包之前,请确认你有权重新分发这些资源。

致谢

About

The reinforcement learning walking training framework of Mini-Pi-Plus

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages