Skip to content

教程raw.githubusercontent.com6 天前

云深处 Lite3:RL-Lite3 强化学习训练与仿真到真机部署教程 ​

> 本文依据以下官方文档整理:raw.githubusercontent.com/DeepRoboticsLab/Lite3_rl_training/。命令与版本以文档当前版本为准。

前置条件 ​

  • Ubuntu OS
  • Python 3.6/3.7/3.8 环境,文档推荐 3.8
  • 安装带 cuda 的 pytorch;RTX40 series 与 older versions 使用不同命令
  • Isaac Gym version >=preview 3,并放入项目根目录
  • 如果使用 cuda:0,需要电脑有 GPU

1. 步骤 1:准备 Python 与 PyTorch ​

先在 Ubuntu OS 上创建 python 3.6/3.7/3.8 环境,文档推荐 3.8。随后按显卡类型安装 pytorch with cuda;RTX40 series 使用第一组命令,older versions 使用第二组命令。\nbash\n# pytorch\n# if your GPU is RTX40 series, use the command below\npip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117\n# if your GPU is older versions\npip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html\n

2. 步骤 2:放置并安装 Isaac Gym ​

下载 Isaac Gym,版本要求为 version >=preview 3,并将其放入项目根目录。然后按照 Isaac Gym folder 中 README.txt 的记录,使用浏览器打开 docs/install.html,在当前 Python environment 中完成 isaac gym 安装。

3. 步骤 3:安装 Python 依赖 ​

在当前 Python environment 中安装文档列出的 python dependencies。这里包含 transformations、matplotlib、gym、tensorboard,以及指定版本的 numpy。\nbash\npip3 install transformations matplotlib gym tensorboard numpy==1.23.5\n

4. 步骤 4:安装 legged_gym 与 rsl_rl ​

RL-Lite3 仓库由 rsl_rl 与 legged_gym 组成:rsl_rl 包装 RL methods,legged_gym 提供 gym-style environments。按文档使用 pip editable 方式安装。\nbash\ncd legged_gym\npip install -e .\n\ncd rsl_rl\npip install -e .\n

5. 步骤 5:在仿真中训练策略 ​

回到项目根目录后启动训练脚本。文档命令使用 cuda:0 作为 rl_device 与 sim_device,并开启 headless,用于在 simulation 中训练 policy。\nbash\ncd ${PROJECT_DIR}\npython3 legged_gym/legged_gym/scripts/train.py --rl_device cuda:0 --sim_device cuda:0 --headless\n

6. 步骤 6:在仿真中运行控制器 ​

训练后可用 play.py 在 simulation 中运行 controller。需要通过 --load_run 与 --checkpoint 指定 network model 的路径与模型名。\nbash\ncd ${PROJECT_DIR}\npython3 legged_gym/legged_gym/scripts/play.py --rl_device cuda:0 --sim_device cuda:0 --load_run ${model_dir} --checkpoint ${model_name}\n

7. 步骤 7:迁移到真实机器人运行 ​

真机运行部分,文档要求将 policy file 复制到项目 rl_deploy,然后即可在 real world 中运行 reinforcement learning controller。对应项目为 Lite3_rl_deploy。

验证是否跑通 ​

确认 train.py 能在 simulation 中启动训练;随后运行 play.py,并按文档为 --load_run 和 --checkpoint 指定 network model。若需要真机运行,确认 policy file 已复制到 rl_deploy,并在 real world 中运行 reinforcement learning controller。

文档里点名的注意事项 ​

  • This code repository is no longer maintained! Please use the new rl_training repo.
  • Isaac Gym 需要 version >=preview 3,并放入项目根目录。
  • 如果电脑没有 GPU,需要将命令中的 cuda:0 替换为 cpu。
  • 运行仿真控制器时,需要通过 --load_run 和 --checkpoint 指定 network model 的路径。
  • Python 版本可用 3.6/3.7/3.8,文档推荐 3.8。

来源

本页事实对应的公开页面,以原文为准。

  1. raw.githubusercontent.com/DeepRoboticsLab/Lite3_rl_training/main/README.md访问 2026-10-22