2021-02-15 09:03:19 +01:00
|
|
|
from alr_envs.classic_control.utils import make_viapointreacher_env
|
2021-04-07 18:18:51 +02:00
|
|
|
from alr_envs.classic_control.utils import make_holereacher_env, make_holereacher_fix_goal_env, make_holereacher_env_pmp
|
2021-02-15 09:03:19 +01:00
|
|
|
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
|
2021-04-07 18:18:51 +02:00
|
|
|
dim = 15
|
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)
|
|
|
|
|
2021-04-07 18:18:51 +02:00
|
|
|
test_env = make_holereacher_env_pmp(0)()
|
|
|
|
|
|
|
|
# params = 1 * np.random.randn(dim)
|
|
|
|
params = np.array([[ -0.13106822, -0.66268577, -1.37025136, -1.34813613,
|
|
|
|
-0.34040336, -1.41684643, 2.81882318, -1.93383471,
|
|
|
|
-5.84213385, -3.8623558 , -1.31946267, 3.19346678,
|
|
|
|
-9.6581148 , -8.27402906, -0.42374776, -2.06852054,
|
|
|
|
7.21224904, -6.81061422, -9.54973119, -6.18636867,
|
|
|
|
-6.82998929, 13.00398992, -18.28106949, -6.06678165,
|
|
|
|
2.79744735]])
|
2021-02-19 16:17:55 +01:00
|
|
|
|
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)
|