From bc6fa0e8ec7dd8ec1b4fff2eefeefc2e6415a566 Mon Sep 17 00:00:00 2001 From: Reggie McLean Date: Sat, 29 Jul 2023 13:03:35 -0400 Subject: [PATCH 1/3] 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, From f16371f95675be642e2ee448d7d8582c9065120d Mon Sep 17 00:00:00 2001 From: Reggie McLean Date: Thu, 3 Aug 2023 13:19:40 -0400 Subject: [PATCH 2/3] Re-running pre-commit --- metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py index 209a9296b..af704f646 100644 --- a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py +++ b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py @@ -459,8 +459,10 @@ 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') + 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 From 13eec08c297f155e700b139757bc833bd7942069 Mon Sep 17 00:00:00 2001 From: Reggie McLean Date: Tue, 8 Aug 2023 11:46:30 -0400 Subject: [PATCH 3/3] removing getattr use --- metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py index af704f646..ee8f9114e 100644 --- a/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py +++ b/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py @@ -459,7 +459,7 @@ 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: + if self.curr_path_length > self.max_path_length: raise ValueError( "Maximum path length allowed by the benchmark has been exceeded" )