Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing missing number of steps check #435

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 +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
Loading