From ed75d565e2a580f2c90ba57bf860422896043bbe Mon Sep 17 00:00:00 2001 From: ottofabian Date: Thu, 24 Jun 2021 11:39:59 +0200 Subject: [PATCH] fixed hole width for HoleReacher-v1 --- alr_envs/__init__.py | 4 +--- alr_envs/mujoco/reacher/alr_reacher.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/alr_envs/__init__.py b/alr_envs/__init__.py index 986265c..8a2f9e5 100644 --- a/alr_envs/__init__.py +++ b/alr_envs/__init__.py @@ -2,8 +2,6 @@ from gym.envs.registration import register from alr_envs.stochastic_search.functions.f_rosenbrock import Rosenbrock -# from alr_envs.utils.mps.dmp_wrapper import DmpWrapper - # Mujoco register( @@ -191,7 +189,7 @@ register( "random_start": False, "allow_self_collision": False, "allow_wall_collision": False, - "hole_width": None, + "hole_width": 0.25, "hole_depth": 1, "hole_x": None, "collision_penalty": 100, diff --git a/alr_envs/mujoco/reacher/alr_reacher.py b/alr_envs/mujoco/reacher/alr_reacher.py index e27e069..6ca66d1 100644 --- a/alr_envs/mujoco/reacher/alr_reacher.py +++ b/alr_envs/mujoco/reacher/alr_reacher.py @@ -86,3 +86,21 @@ class ALRReacherEnv(MujocoEnv, utils.EzPickle): # self.get_body_com("target"), # only return target to make problem harder [self._steps], ]) + +if __name__ == '__main__': + nl = 5 + render_mode = "human" # "human" or "partial" or "final" + env = ALRReacherEnv(n_links=nl) + obs = env.reset() + + for i in range(2000): + # objective.load_result("/tmp/cma") + # test with random actions + ac = env.action_space.sample() + obs, rew, d, info = env.step(ac) + if i % 10 == 0: + env.render(mode=render_mode) + if d: + env.reset() + + env.close() \ No newline at end of file