From bc6fa0e8ec7dd8ec1b4fff2eefeefc2e6415a566 Mon Sep 17 00:00:00 2001 From: Reggie McLean Date: Sat, 29 Jul 2023 13:03:35 -0400 Subject: [PATCH] Fixing missing number of steps check --- metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py index 75a624faa..209a9296b 100644 --- a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py +++ b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py @@ -459,6 +459,8 @@ def step(self, action): assert len(action) == 4, f"Actions should be size 4, got {len(action)}" self.set_xyz_action(action[:3]) self.do_simulation([action[-1], -action[-1]], n_frames=self.frame_skip) + if getattr(self, 'curr_path_length', 0) > self.max_path_length: + raise ValueError('Maximum path length allowed by the benchmark has been exceeded') self.curr_path_length += 1 # Running the simulator can sometimes mess up site positions, so @@ -470,6 +472,7 @@ def step(self, action): return ( self._last_stable_obs, # observation just before going unstable 0.0, # reward (penalize for causing instability) + False, False, # termination flag always False { # info "success": False,