From f730cb92bafbb31827e353bd14455bc147466a56 Mon Sep 17 00:00:00 2001 From: Maximilian Huettenrauch Date: Fri, 26 Mar 2021 14:30:58 +0100 Subject: [PATCH] updates --- dmp_env_wrapper_example.py | 14 ++++++++------ dmp_pd_control_example.py | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/dmp_env_wrapper_example.py b/dmp_env_wrapper_example.py index 9e817cd..ed86423 100644 --- a/dmp_env_wrapper_example.py +++ b/dmp_env_wrapper_example.py @@ -16,12 +16,14 @@ if __name__ == "__main__": test_env = make_holereacher_env(0)() # params = np.random.randn(n_samples, dim) - params = np.array([[ 1.386102 , -3.29980525, 4.70402733, 1.3966668 , 0.73774902, - 3.14676681, -4.98644416, 6.20303193, 1.30502127, -0.09330522, - 7.62656797, -5.76893033, 3.4706711 , -0.6944142 , -3.33442788, - 12.31421548, -0.72760271, -6.9090723 , 7.02903814, -8.7236836 , - 1.4805914 , 0.53185824, -5.46626893, 0.69692163, 13.58472666, - 0.77199316, 2.02906724, -3.0203244 , -1.00533159, -0.57417351]]) + params = np.array([ 0.57622273, 0.98294602, 1.48964131, 0.65430972, + -0.26028221, 4.84693322, 1.77366128, 0.51080511, + -2.38201107, -0.84990048, 1.02289828, 1.20675551, + 0.38075566, -1.84282938, -3.48690172, 2.17434711, + -1.79285349, -1.7533641 , 0.62802966, 1.18928357, + 0.2818753 , -3.27708291, -0.91761804, -0.38350967, + 2.25849139, 21.57786524, -14.38494647, -11.5380005 , + -11.09529721, -0.39453533]) # 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])]) diff --git a/dmp_pd_control_example.py b/dmp_pd_control_example.py index 5abf8fa..44cd668 100644 --- a/dmp_pd_control_example.py +++ b/dmp_pd_control_example.py @@ -8,20 +8,20 @@ if __name__ == "__main__": dim = 15 n_cpus = 4 - n_samples = 10 - - vec_env = DmpAsyncVectorEnv([make_simple_env(i) for i in range(n_cpus)], - n_samples=n_samples) - - params = np.tile(1 * np.random.randn(n_samples, dim), (10, 1)) - - rewards, infos = vec_env(params) - print(rewards) + # n_samples = 10 # - # non_vec_env = make_simple_env(0, 0)() + # vec_env = DmpAsyncVectorEnv([make_simple_env(i) for i in range(n_cpus)], + # n_samples=n_samples) # - # params = 10 * np.random.randn(dim) + # params = np.tile(1 * np.random.randn(n_samples, dim), (10, 1)) + # + # rewards, infos = vec_env(params) + # print(rewards) + # + non_vec_env = make_simple_env(0, 0)() - # out2 = non_vec_env.rollout(params, render=True) + params = 0.1 * np.random.randn(dim) - # print(out2) + out2 = non_vec_env.rollout(params, render=True) + + print(out2)