Skip to content

Commit

Permalink
Fix reproducibility of FetchPickAndPlace-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
amacati committed Feb 10, 2024
1 parent 50c8019 commit 54043fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gymnasium_robotics/envs/fetch/fetch_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ def _reset_sim(self):
self.data.time = self.initial_time
self.data.qpos[:] = np.copy(self.initial_qpos)
self.data.qvel[:] = np.copy(self.initial_qvel)
self.data.qacc_warmstart[:] = np.copy(self.initial_qacc_warmstart)
self.data.ctrl[:] = np.copy(self.initial_ctrl)
self.data.mocap_pos[:] = np.copy(self.initial_mocap_pos)
self.data.mocap_quat[:] = np.copy(self.initial_mocap_quat)
if self.model.na != 0:
self.data.act[:] = None

Expand Down
4 changes: 4 additions & 0 deletions gymnasium_robotics/envs/robot_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ def _initialize_simulation(self):
self.initial_time = self.data.time
self.initial_qpos = np.copy(self.data.qpos)
self.initial_qvel = np.copy(self.data.qvel)
self.initial_ctrl = np.copy(self.data.ctrl)
self.initial_qacc_warmstart = np.copy(self.data.qacc_warmstart)
self.initial_mocap_pos = np.copy(self.data.mocap_pos)
self.initial_mocap_quat = np.copy(self.data.mocap_quat)

def _reset_sim(self):
self.data.time = self.initial_time
Expand Down

0 comments on commit 54043fc

Please sign in to comment.