[535f03]: / examples / sim_L2M2019_randomrun.py

Download this file

34 lines (29 with data), 974 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from osim.env import L2M2019Env
import numpy as np
#=== this is the official setting for Learn to Move 2019 ===#
model = '3D'
#round_n = 1 # Round 1
round_n = 2 # Round 2
if round_n == 1:
difficulty = 2 # 2: Round 1; 3: Round 2
seed = None
project = True
obs_as_dict = True
elif round_n == 2:
difficulty = 3 # 2: Round 1; 3: Round 2
seed = None
project = True
obs_as_dict = True
else:
difficulty = 1 # 0: constant forward velocities; 1: consecutive sinks forward for walking
seed = None
project = True
obs_as_dict = True
#=== this is the official setting for Learn to Move 2019 ===#
env = L2M2019Env(seed=seed, difficulty=difficulty)
env.change_model(model=model, difficulty=difficulty, seed=seed)
obs_dict = env.reset(project=project, seed=seed, obs_as_dict=obs_as_dict)
while True:
obs_dict, reward, done, info=env.step(env.action_space.sample(), project=project, obs_as_dict=obs_as_dict)
if done:
break