Skip to content

Commit

Permalink
Fixing missing number of steps check (Farama-Foundation#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Aug 9, 2023
1 parent 844d76d commit 15f269b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 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,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 self.curr_path_length > 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 +474,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 15f269b

Please sign in to comment.