Skip to content

Commit

Permalink
Fixing missing number of steps check
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Jul 29, 2023
1 parent 844d76d commit bc6fa0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit bc6fa0e

Please sign in to comment.