From 863ef77e5ee178cdc9975c151d05d38fe53cd88e Mon Sep 17 00:00:00 2001 From: Onur Date: Sun, 29 May 2022 11:59:02 +0200 Subject: [PATCH] safety --- alr_envs/alr/mujoco/beerpong/beerpong.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/alr_envs/alr/mujoco/beerpong/beerpong.py b/alr_envs/alr/mujoco/beerpong/beerpong.py index 017bfcd..6790523 100644 --- a/alr_envs/alr/mujoco/beerpong/beerpong.py +++ b/alr_envs/alr/mujoco/beerpong/beerpong.py @@ -106,6 +106,10 @@ class ALRBeerBongEnv(MujocoEnv, utils.EzPickle): return self._get_obs() def step(self, a): + # if a.shape[0] == 8: # we learn also when to release the ball + # self._release_step = a[-1] + # self._release_step = np.clip(self._release_step, 50, 250) + # self.release_step = 0.5/self.dt reward_dist = 0.0 angular_vel = 0.0 applied_action = a @@ -172,11 +176,16 @@ class ALRBeerBongEnv(MujocoEnv, utils.EzPickle): [self._steps], ]) + # TODO + @property + def active_obs(self): + return np.hstack([ + [False] * 7, # cos + [False] * 7, # sin + [True] * 2, # xy position of cup + [False] # env steps + ]) -class ALRBeerPongStepEnv(ALRBeerBongEnv): - def __init__(self, frame_skip=1, apply_gravity_comp=True, noisy=False, - rndm_goal=False, cup_goal_pos=None): - super(ALRBeerPongStepEnv, self).__init__(frame_skip, apply_gravity_comp, noisy, rndm_goal, cup_goal_pos) if __name__ == "__main__": env = ALRBeerBongEnv(rndm_goal=True)