fancy_gym/dmp_env_wrapper_example.py

24 lines
689 B
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-15 09:03:19 +01:00
params = np.random.randn(n_samples, dim)
# 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-17 17:48:05 +01:00
test_env.rollout(params, render=True)
2021-01-11 16:08:42 +01:00
2021-02-17 17:48:05 +01:00
# out = env(params)
# print(out)