NVIDIA公司推出的GPU運行環境下的機器人仿真環境(NVIDIA Isaac Gym)的安裝——強化學習的仿真訓練環境


Isaac gym的安裝要求:

NVIDIA公司推出的GPU運行環境下的機器人仿真環境(NVIDIA Isaac Gym)的安裝要求——強化學習的仿真訓練環境

 

 

 

=====================================================

 

 

 

下載安裝文件:     IsaacGym_Preview_2_Package.tar.gz

 

 

 

 

 

 

解壓:

tar -zxvf IsaacGym_Preview_2_Package.tar.gz

 

 

 

 

===================================================

 

 

 

使用  conda   安裝軟件包:(Ubuntu18.04系統下,要求已經安裝配置anaconda)

解壓安裝文件后進入安裝文件夾:(本文中解壓文件位置為 ~ )

cd isaacgym/python/

 

執行命令:

sh ../create_conda_env_rlgpu.sh

 

 

 

 

這里需要注意,雖然顯示的是激活環境失敗,但是這是依賴環境其實已經安裝好了。

我們可以看下上步操作中具體的環境配置文件內容:cat ~/isaacgym/python/rlgpu_conda_env.yml

 

 可以看到,其實安裝  IsaacGym 的主要依賴環境為:

python=3.7

pytorch=1.8.1

cudatookit=11.1

其實主要的依賴環境就是上面這三個,在滿足  NVIDIA公司推出的GPU運行環境下的機器人仿真環境(NVIDIA Isaac Gym)的安裝要求——強化學習的仿真訓練環境

的前提下,只要安裝上面這三個依賴就可以安裝  IsaacGym 了。

 

 

手動激活安裝好的環境:   conda activate rlgpu

 

在該環境下手動安裝     IsaacGym   。

 

pip install -e .

 

 

 

 

此時則完成了全部的安裝。

 

 

注意這時直接運行例子是會報錯的:

 

 

原因就是無法識別出Python庫,因為 IsaacGym 我們這里采用的是默認安裝,所以安裝文件和原文件相同,所以在運行IsaacGym時會出現一些問題,這時我們只需要設置好動態鏈接庫地址即可,方法:

查找當前環境下動態鏈接庫libpython3.7m.so.1.0的位置:

 

 

設置動態鏈接庫地址:

export LD_LIBRARY_PATH=/home/devil/anaconda3/envs/rlgpu/lib/:$LD_LIBRARY_PATH

 

 

 

=============================================

 

 

 

特殊說明:

默認的 IsaacGym 安裝路徑為在原文件中安裝,也就是說下載的原文件解壓后進行安裝,安裝路徑還是在原文件路徑中,並沒有把安裝文件拷貝到默認的Python環境中,這也就意味着 IsaacGym 安裝成功后原文件也不能刪除或者移動,因為原文件和安裝文件為同一個。我們可以認為 IsaacGym 的安裝其實就是將原文件的路徑加到了Python的默認庫所識別的路徑中。

 

安裝后的原文件夾下內容:

 可以看到,原文件和安裝文件為同一個。

 

 

 

===========================================

 

我們可以看下安裝后的文件結構:

 

 文件夾:

examples  :  是對環境進行操作的例子。

isaacgym  和   isaacgym.egg-info 是安裝文件。

rlgpu 文件夾下面是使用pytorch下的PPO算法運行isaacgym的代碼。

 

 

rlgpu文件夾可以看做是NVIDIA公司為仿真環境 isaacgym 寫的pytorch版的PPO等常用機器人的reinforcement leanring算法代碼,文件夾詳情:

 

 

 

 

下面就給出幾個使用rlgpu文件下的reinforcement learning代碼訓練isaacgym環境的例子:

 

下面的例子使用的文件:/home/devil/isaacgym/python/rlgpu/train.py

rlgpu下面的train.py

 

使用help解釋來查看NVIDIA給出的reinforcement leanring算法命令參數:

python train.py -h

usage: train.py [-h] [--sim_device SIM_DEVICE] [--pipeline PIPELINE]
                [--graphics_device_id GRAPHICS_DEVICE_ID] [--flex | --physx]
                [--num_threads NUM_THREADS] [--subscenes SUBSCENES]
                [--slices SLICES] [--test] [--play] [--resume RESUME]
                [--checkpoint CHECKPOINT] [--headless] [--horovod]
                [--task TASK] [--task_type TASK_TYPE] [--rl_device RL_DEVICE]
                [--logdir LOGDIR] [--experiment EXPERIMENT] [--metadata]
                [--cfg_train CFG_TRAIN] [--cfg_env CFG_ENV]
                [--num_envs NUM_ENVS] [--episode_length EPISODE_LENGTH]
                [--seed SEED] [--max_iterations MAX_ITERATIONS]
                [--steps_num STEPS_NUM] [--minibatch_size MINIBATCH_SIZE]
                [--randomize] [--torch_deterministic]

RL Policy

optional arguments:
  -h, --help            show this help message and exit
  --sim_device SIM_DEVICE
                        Physics Device in PyTorch-like syntax
  --pipeline PIPELINE   Tensor API pipeline (cpu/gpu)
  --graphics_device_id GRAPHICS_DEVICE_ID
                        Graphics Device ID
  --flex                Use FleX for physics
  --physx               Use PhysX for physics
  --num_threads NUM_THREADS
                        Number of cores used by PhysX
  --subscenes SUBSCENES
                        Number of PhysX subscenes to simulate in parallel
  --slices SLICES       Number of client threads that process env slices
  --test                Run trained policy, no training
  --play                Run trained policy, the same as test, can be used only
                        by rl_games RL library
  --resume RESUME       Resume training or start testing from a checkpoint
  --checkpoint CHECKPOINT
                        Path to the saved weights, only for rl_games RL
                        library
  --headless            Force display off at all times
  --horovod             Use horovod for multi-gpu training, have effect only
                        with rl_games RL library
  --task TASK           Can be BallBalance, Cartpole, CartpoleYUp, Ant,
                        Humanoid, Anymal, FrankaCabinet, Quadcopter,
                        ShadowHand, Ingenuity
  --task_type TASK_TYPE
                        Choose Python or C++
  --rl_device RL_DEVICE
                        Choose CPU or GPU device for inferencing policy
                        network
  --logdir LOGDIR
  --experiment EXPERIMENT
                        Experiment name. If used with --metadata flag an
                        additional information about physics engine, sim
                        device, pipeline and domain randomization will be
                        added to the name
  --metadata            Requires --experiment flag, adds physics engine, sim
                        device, pipeline info and if domain randomization is
                        used to the experiment name provided by user
  --cfg_train CFG_TRAIN
  --cfg_env CFG_ENV
  --num_envs NUM_ENVS   Number of environments to create - override config
                        file
  --episode_length EPISODE_LENGTH
                        Episode length, by default is read from yaml config
  --seed SEED           Random seed
  --max_iterations MAX_ITERATIONS
                        Set a maximum number of training iterations
  --steps_num STEPS_NUM
                        Set number of simulation steps per 1 PPO iteration.
                        Supported only by rl_games. If not -1 overrides the
                        config settings.
  --minibatch_size MINIBATCH_SIZE
                        Set batch size for PPO optimization step. Supported
                        only by rl_games. If not -1 overrides the config
                        settings.
  --randomize           Apply physics domain randomization
  --torch_deterministic
                        Apply additional PyTorch settings for more
                        deterministic behaviour

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM