1 下载相关文件
进入github中下载相关的文件
https://github.com/leggedrobotics/legged_gym
2 加载自己绘制的URTL文件
这个链接用来下载宇树的Go2模型机器人
https://github.com/unitreerobotics/unitree_rl_gym/tree/main
下载好了urdf文件,将其中resources/robots/go2文件复制到legged_gym/resources/robots/目录下
这样就把机器人模型文件加载好了
在下面这个文件修改:
from legged_gym import LEGGED_GYM_ROOT_DIR, LEGGED_GYM_ENVS_DIR
from legged_gym.envs.a1.a1_config import A1RoughCfg, A1RoughCfgPPO
from .base.legged_robot import LeggedRobot
from .anymal_c.anymal import Anymal
from .anymal_c.mixed_terrains.anymal_c_rough_config import AnymalCRoughCfg, AnymalCRoughCfgPPO
from .anymal_c.flat.anymal_c_flat_config import AnymalCFlatCfg, AnymalCFlatCfgPPO
from .anymal_b.anymal_b_config import AnymalBRoughCfg, AnymalBRoughCfgPPO
from .cassie.cassie import Cassie
from .cassie.cassie_config import CassieRoughCfg, CassieRoughCfgPPO
from .a1.a1_config import A1RoughCfg, A1RoughCfgPPO
from .go2.go2_config import GO2RoughCfg, GO2RoughCfgPPO # 添加的
import os
from legged_gym.utils.task_registry import task_registry
task_registry.register( "anymal_c_rough", Anymal, AnymalCRoughCfg(), AnymalCRoughCfgPPO() )
task_registry.register( "anymal_c_flat", Anymal, AnymalCFlatCfg(), AnymalCFlatCfgPPO() )
task_registry.register( "anymal_b", Anymal, AnymalBRoughCfg(), AnymalBRoughCfgPPO() )
task_registry.register( "a1", LeggedRobot, A1RoughCfg(), A1RoughCfgPPO() )
task_registry.register( "cassie", Cassie, CassieRoughCfg(), CassieRoughCfgPPO() )
task_registry.register( "go2", LeggedRobot, GO2RoughCfg(), GO2RoughCfgPPO() ) # 添加的
这样就可以运行代码训练机器人了