使用Isaac Sim pip安装#

Isaac Lab 需要 Isaac Sim 。本教程首先从 pip 安装 Isaac Sim ,然后从源代码安装 Isaac Lab 。

安装 Isaac Sim#

从 Isaac Sim 4.0 发布开始,可以使用 pip 安装 Isaac Sim。这种方法使安装Isaac Sim变得更加容易,而不需要下载Isaac Sim二进制文件。如果遇到任何问题,请将其报告给 Isaac Sim 论坛

注意

使用 pip 安装 Isaac Sim 需要 GLIBC 2.34+ 版本兼容性。要检查系统上的 GLIBC 版本,请使用命令 ldd --version

这可能会在某些Linux发行版上引起兼容性问题。例如,Ubuntu 20.04 LTS 默认使用 GLIBC 2.31。如果遇到兼容性问题,建议采用 Isaac Sim 二进制安装 的安装方法。

注意

在使用 CUDA 12 的 Windows 上,需要 GPU 驱动版本 552.86。

此外,在 Windows 上,可能需要 enable long path 支持,以避免由于操作系统限制导致的安装错误。

备注

如果使用 Conda,我们建议使用 Miniconda

  • 为了使用 Isaac Sim 的 pip 安装方法,建议首先创建一个虚拟环境。确保虚拟环境的 python 版本是 Python 3.10

    conda create -n env_isaaclab python=3.10
    conda activate env_isaaclab
    
    # create a virtual environment named env_isaaclab with python3.10
    python3.10 -m venv env_isaaclab
    # activate the virtual environment
    source env_isaaclab/bin/activate
    
    # create a virtual environment named env_isaaclab with python3.10
    python3.10 -m venv env_isaaclab
    # activate the virtual environment
    env_isaaclab\Scripts\activate
    
  • 接下来,根据系统上可用的CUDA版本安装支持CUDA的PyTorch 2.5.1版本。对于Linux系统,这一步骤是可选的,但对于Windows系统来说,必须确保安装了与CUDA兼容的PyTorch版本。

    pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cu118
    
    pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cu121
    
  • 在安装 Isaac Sim 之前,请确保安装了最新的 pip 版本。要更新 pip,运行

    pip install --upgrade pip
    
    python -m pip install --upgrade pip
    
  • 然后,安装 Isaac Sim 软件包。

    pip install isaacsim[all,extscache]==4.5.0 --extra-index-url https://pypi.nvidia.com
    

验证 Isaac Sim 安装#

  • 确保你的虚拟环境已激活(如果适用)

  • 检查模拟器是否按预期运行:

    # note: you can pass the argument "--help" to see all arguments possible.
    isaacsim
    
  • 可以使用特定的经验文件运行,运行:

    # experience files can be absolute path, or relative path searched in isaacsim/apps or omni/apps
    isaacsim isaacsim.exp.full.kit
    

注意

首次运行 Isaac Sim 时,将从注册表中提取所有相关扩展。这个过程可能需要多达 10 分钟,在每个体验文件的首次运行时是必需的。扩展被提取后,使用相同的体验文件进行连续运行时将使用缓存的扩展。

注意

首次运行将提示用户接受NVIDIA软件许可协议。要接受 EULA,请在下面的消息提示时回复 Yes :

By installing or using Isaac Sim, I agree to the terms of NVIDIA SOFTWARE LICENSE AGREEMENT (EULA)
in https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-software-license-agreement

Do you accept the EULA? (Yes/No): Yes

如果模拟器在按上述说明进行操作时无法运行或崩溃,则意味着某些配置不正确。要进行调试和故障排除,请查看 Isaac Sim 文档论坛

安装 Isaac Lab#

克隆 Isaac Lab#

备注

我们建议制作一个 fork Isaac Lab 仓库来贡献项目,但这不是使用框架的必要条件。如果您制作了一个 fork,请在以下说明中用您的用户名替换 isaac-sim

将 Isaac Lab 仓库克隆到您的工作空间:

git clone git@github.com:isaac-sim/IsaacLab.git
git clone https://github.com/isaac-sim/IsaacLab.git

备注

我们提供一个辅助可执行文件 isaaclab.sh ,提供管理扩展的实用工具:

./isaaclab.sh --help

usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab.

optional arguments:
   -h, --help           Display the help content.
   -i, --install [LIB]  Install the extensions inside Isaac Lab and learning frameworks (rl_games, rsl_rl, sb3, skrl) as extra dependencies. Default is 'all'.
   -f, --format         Run pre-commit to format the code and check lints.
   -p, --python         Run the python executable provided by Isaac Sim or virtual environment (if active).
   -s, --sim            Run the simulator executable (isaac-sim.sh) provided by Isaac Sim.
   -t, --test           Run all python unittest tests.
   -o, --docker         Run the docker container helper script (docker/container.sh).
   -v, --vscode         Generate the VSCode settings file from template.
   -d, --docs           Build the documentation from source using sphinx.
   -c, --conda [NAME]   Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
isaaclab.bat --help

usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage Isaac Lab.

optional arguments:
   -h, --help           Display the help content.
   -i, --install [LIB]  Install the extensions inside Isaac Lab and learning frameworks (rl_games, rsl_rl, sb3, skrl) as extra dependencies. Default is 'all'.
   -f, --format         Run pre-commit to format the code and check lints.
   -p, --python         Run the python executable provided by Isaac Sim or virtual environment (if active).
   -s, --sim            Run the simulator executable (isaac-sim.bat) provided by Isaac Sim.
   -t, --test           Run all python unittest tests.
   -v, --vscode         Generate the VSCode settings file from template.
   -d, --docs           Build the documentation from source using sphinx.
   -c, --conda [NAME]   Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.

安装#

  • 使用 apt 安装依赖项(在 Ubuntu 上):

    sudo apt install cmake build-essential
    
  • 运行安装命令,遍历 source 目录中的所有扩展,并使用 pip(带有 --editable 标志)进行安装:

./isaaclab.sh --install # or "./isaaclab.sh -i"
isaaclab.bat --install :: or "isaaclab.bat -i"

备注

默认情况下,这将安装所有学习框架。如果您只想安装特定框架,请将框架的名称作为参数传递。例如,要仅安装 rl_games 框架,您可以运行

./isaaclab.sh --install rl_games  # or "./isaaclab.sh -i rl_games"
isaaclab.bat --install rl_games :: or "isaaclab.bat -i rl_games"

有效选项为 rl_gamesrsl_rlsb3skrlrobomimicnone

验证 Isaac Lab 安装#

要验证安装是否成功,请从存储库的顶部运行以下命令:

# Option 1: Using the isaaclab.sh executable
# note: this works for both the bundled python and the virtual environment
./isaaclab.sh -p scripts/tutorials/00_sim/create_empty.py

# Option 2: Using python in your virtual environment
python scripts/tutorials/00_sim/create_empty.py
:: Option 1: Using the isaaclab.bat executable
:: note: this works for both the bundled python and the virtual environment
isaaclab.bat -p scripts\tutorials\00_sim\create_empty.py

:: Option 2: Using python in your virtual environment
python scripts\tutorials\00_sim\create_empty.py

上述命令应启动模拟器,并显示一个带黑色视口的窗口,如下所示。你可以通过在终端上按下 Ctrl+C 来退出脚本。在 Windows 机器上,请从命令提示符终止该进程,方法是按下 Ctrl+BreakCtrl+fn+B

带有黑色窗口的模拟器

如果你看到这个,那么安装成功了! 🎉

训练一个机器人!#

现在你可以通过强化学习使用 Isaac Lab 来训练机器人了!使用预定义的工作流程和我们的 Batteries-included 机器人任务是使用 Isaac Lab 的最快方式。执行以下命令,快速训练一只蚂蚁走路!我们建议添加 --headless 以加速训练。

./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Ant-v0 --headless
isaaclab.bat -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Ant-v0 --headless

… 或者一只机器狗!

./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Velocity-Rough-Anymal-C-v0 --headless
isaaclab.bat -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Velocity-Rough-Anymal-C-v0 --headless

Isaac Lab 提供了您需要的工具,以创建适合您项目需求的 任务工作流 。请查看我们的 “如何”指南 指南,如 添加自己的学习库包装环境 了解详细信息。

Idle hands...