fancy_gym/dmp_env_wrapper_example.py

33 lines
1.1 KiB
Python
Raw Normal View History

2021-02-15 09:03:19 +01:00
from alr_envs.classic_control.utils import make_viapointreacher_env
from alr_envs.utils.dmp_async_vec_env import DmpAsyncVectorEnv
2021-01-11 16:08:42 +01:00
import numpy as np
if __name__ == "__main__":
2021-02-17 17:48:05 +01:00
n_samples = 1
2021-02-15 09:03:19 +01:00
n_cpus = 4
dim = 25
2021-01-11 16:08:42 +01:00
2021-02-17 17:48:05 +01:00
# env = DmpAsyncVectorEnv([make_viapointreacher_env(i) for i in range(n_cpus)],
# n_samples=n_samples)
test_env = make_viapointreacher_env(0)()
2021-02-11 12:32:32 +01:00
2021-02-19 16:17:55 +01:00
# params = np.random.randn(n_samples, dim)
params = np.array([ 217.54494933, -1.85169983, 24.08414447, 42.23816868,
23.32071702, 7.60780651, -31.74777741, 265.50634253,
463.43822562, 245.93948374, -272.64003621, -45.24999553,
503.21185823, 809.17742517, 393.12387021, -196.54196471,
6.79327307, 374.82429078, 552.4119579 , 197.3963343 ,
243.87357056, -39.56041541, -616.93957463, -710.0772516 ,
-414.21769789])
2021-02-15 09:03:19 +01:00
# params = np.hstack([50 * np.random.randn(n_samples, 25), np.tile(np.array([np.pi/2, -np.pi/4, -np.pi/4, -np.pi/4, -np.pi/4]), [n_samples, 1])])
2021-01-11 16:08:42 +01:00
2021-02-19 16:17:55 +01:00
rew, info = test_env.rollout(params, render=True)
print(rew)
2021-01-11 16:08:42 +01:00
2021-02-17 17:48:05 +01:00
# out = env(params)
# print(out)