一、介绍
Isaac Sim是NVIDIA Omniverse平台的一款机器人仿真工具包,它具备构建虚拟机器人世界和进行实验的关键功能。该工具包为研究人员和从业者提供了所需的工具和工作流程,以创建健壮、物理精确的模拟和合成数据集。Isaac Sim通过ROS/ROS2支持导航和操控应用,可以模拟来自RGB-D、激光雷达和IMU等传感器的数据,这些数据可用于多种计算机视觉技术,如领域随机化、真值标签、分割和边界框等。
此外,Isaac Sim还整合了最新的PhysX和RTX引擎进行物理仿真和图像仿真,并引入了Pixar公司开发的usd(Universal Scene Description)描述格式,以支持机器人和复杂场景的描述。在特定版本,如2022.2版本中,Isaac Sim针对仓库物流、制造业机械手、车队路线等场景进行了优化,添加了新的功能如仓库建造工具、传送带工具以及人员模拟器等,以更好地满足各种实际应用需求。
强化学习Gym是一个用于进行强化学习实验的开源库,为强化学习算法的实验验证和测试提供了一个简单方便的实验平台。
Gym库包含多种环境,如算法环境、简单文本环境、经典控制环境、Atari游戏环境、MuJoCo环境和机械控制环境等,涵盖了算法研究和开发、机器人控制、生物力学、图形和动画等多个领域。它内置了多种仿真游戏,如出租车游戏、悬崖游戏等,这些游戏所用的网格、规则、奖励各不相同,非常适合为强化学习做测试。
在Gym中,每一个环境都有一个对应的函数接口,比如“reset”、“step”等,这些接口使得与环境进行交互更为便捷。此外,Gym还提供页面渲染功能,可以可视化地查看效果。
总的来说,Gym是一个强大的工具,可以帮助研究人员和从业者更好地进行强化学习实验和
研究。如需更多关于Gym的信息,可以查阅其官方文档或相关教程。
那如何在Isaac sim里面安装 gym来开展强化学习仿真训练呢?
一个方案是使用 Isaac Gym Preview 4 环境构建 + IsaacGymEnvs
Isaac Gym - Preview Release | NVIDIA Developerhttps://developer.nvidia.com/isaac-gym
但是很遗憾目前Isaac Gym Preview 4只支持 Ubuntu 系统,然而我并不想在WLS中运行,或者虚拟机里面,或者还要装个双系统。那怎么办呢?
突然发现一个NVIDIA-Omniverse 下面有一个 OmniIsaacGymEnvs,Omniverse Isaac Gym Reinforcement Learning Environments for Isaac Sim,这个似乎是直接用于 Isaac sim的 Omniverse Isaac Gym,安装要求没提系统,是可以在最新的 Isaac Sim里运行。
This repository contains Reinforcement Learning examples that can be run with the latest release of Isaac Sim. RL examples are trained using PPO from rl_games library and examples are built on top of Isaac Sim's
omni.isaac.core
andomni.isaac.gym
frameworks.
OmniIsaacGymEnvshttps://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs
二、安装
找到 isaac sim的python脚本文件所在目录,如笔者的在:
D:\omniverse\pkg\isaac_sim-2023.1.1\python.bat
用该脚本执行安装命令:
D:\omniverse\pkg\isaac_sim-2023.1.1\python.bat -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -e .
注意 usd-core 版本
nvidia-srl-usd 0.13.0 requires usd-core<24.00,>=21.11, which is not installed.
usd-core 安装:
D:\omniverse\pkg\isaac_sim-2023.1.1\python.bat -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple usd-core==23.11
三、运行demo
Note: All commands should be executed from
OmniIsaacGymEnvs/omniisaacgymenvs
cd omniisaacgymenvs
D:\omniverse\pkg\isaac_sim-2023.1.1\python.bat scripts/rlgames_train.py task=Cartpole
四、问题
遇到问题可以查看日志,日志目录运行时会给出
运行时出现错误,查看日志,是下载不了 相关 usd 资源
2024-03-26 02:13:31 [199,655ms] [Info] [omni.isaac.core.physics_context.physics_context] Defining a new Physics Scene at path `/physicsScene`
2024-03-26 02:13:31 [199,869ms] [Info] [omni.isaac.core.utils.nucleus] Check /persistent/isaac/asset_root/default setting
2024-03-26 02:13:31 [199,869ms] [Info] [omni.isaac.core.utils.nucleus] Checking path: http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/Isaac
2024-03-26 02:13:31 [199,875ms] [Info] [omni.client.plugin] Main: provider_http: Successfully created S3 provider for https://omniverse-content-production.s3-us-west-2.amazonaws.com
2024-03-26 02:13:33 [202,496ms] [Info] [omni.client.plugin] Tick: provider_http: Using CloudFront http://dcb18d6mfegct.cloudfront.net/, List = No
2024-03-26 02:13:34 [202,804ms] [Info] [omni.isaac.core.utils.nucleus] Success: http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/Isaac
2024-03-26 02:13:34 [202,804ms] [Info] [omni.isaac.core.utils.nucleus] Checking path: http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/NVIDIA
2024-03-26 02:13:34 [202,804ms] [Info] [omni.isaac.core.utils.nucleus] Success: http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/NVIDIA
2024-03-26 02:13:34 [202,804ms] [Info] [omni.isaac.core.utils.nucleus] Assets root found at http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1
2024-03-26 02:13:34 [202,805ms] [Info] [omni.isaac.core.utils.stage] Loading Asset from path http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:13:36 [205,050ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (56): Failure when receiving data from the peer for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:13:58 [227,372ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (56): Failure when receiving data from the peer for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:14:41 [270,181ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (56): Failure when receiving data from the peer for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:15:33 [322,194ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (56): Failure when receiving data from the peer for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:16:34 [383,297ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (28): Timeout was reached for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:17:36 [445,397ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (28): Timeout was reached for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:18:41 [509,519ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (28): Timeout was reached for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:19:48 [576,621ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (28): Timeout was reached for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:20:39 [628,442ms] [Info] [omni.client.plugin] HTTP Client: http: libcurl error (56): Failure when receiving data from the peer for http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd
2024-03-26 02:20:39 [628,442ms] [Info] [omni.client.plugin] Tick: provider_http: Read failed! Error: Connection. URI='http://dcb18d6mfegct.cloudfront.net/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd': Unable to connect to server! Likely indicates a client side networking error or problem with Omniverse Cache!
2024-03-26 02:20:39 [628,446ms] [Warning] [omni.usd] Warning: in _ReportErrors at line 2890 of W:\ac88d7d902b57417\USD\pxr\usd\usd\stage.cpp -- In </World/envs/env_0/Cartpole>: Could not open asset @http://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/Isaac/Robots/Cartpole/cartpole.usd@ for reference introduced by @anon:000001DB8E79D720:World1.usd@</World/envs/env_0/Cartpole>. (recomposing stage on stage @anon:000001DB8E79D720:World1.usd@ <000001DB933CE610>)
猜测是 urllib的问题
HTTP Client: http: libcurl error
一个简单办法,是把资源下载下来使用,看代码:
打开 cartpole.py,替换掉里面的 _usd_path 为下载好的本地 usd 文件,再次运行就成功了,看512个agent在同时训练
后来发现一个更简单的办法,那就是换个网络就好了,服了,明明之前那个网络 也是能访问这个网站的呀.....
omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/2023.1.1/Isaac