unitree_rl_gym/legged_gym/scripts/train.py

22 lines
664 B
Python
Raw Normal View History

2023-10-11 15:38:49 +08:00
import os
2024-07-18 15:57:29 +08:00
unitree_rl_gym_path = os.path.abspath(__file__ + "../../../../")
import numpy as np
2023-10-11 15:38:49 +08:00
from datetime import datetime
import sys
2024-07-18 15:57:29 +08:00
sys.path.append(unitree_rl_gym_path)
2023-10-11 15:38:49 +08:00
import isaacgym
from legged_gym.envs import *
from legged_gym.utils import get_args, task_registry
import torch
def train(args):
env, env_cfg = task_registry.make_env(name=args.task, args=args)
ppo_runner, train_cfg = task_registry.make_alg_runner(env=env, name=args.task, args=args)
ppo_runner.learn(num_learning_iterations=train_cfg.runner.max_iterations, init_at_random_ep_len=True)
if __name__ == '__main__':
args = get_args()
args.headless = False
train(args)