Skip to content

Commit

Permalink
Fix _apply_action
Browse files Browse the repository at this point in the history
  • Loading branch information
aliberts committed Apr 9, 2024
1 parent 08ddd5a commit ce294c0
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions gym_xarm/tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,8 @@ 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)
if self.model.na != 0:
self.data.act[:] = None

mujoco.mj_forward(self.model, self.data)
self._sample_goal()
self._mujoco.mj_step(self.model, self.data, nstep=10)
return True

def get_obs(self):
Expand Down Expand Up @@ -307,13 +305,6 @@ def _apply_action(self, action):
np.concatenate([pos_ctrl, self.gripper_rotation, gripper_ctrl]),
)

self.data.time = self.initial_time
self.data.qpos[:] = np.copy(self.initial_qpos)
self.data.qvel[:] = np.copy(self.initial_qvel)
self._sample_goal()
self._mujoco.mj_step(self.model, self.data, nstep=10)
return True

def _set_gripper(self, gripper_pos, gripper_rotation):
self._utils.set_mocap_pos(self.model, self.data, "robot0:mocap", gripper_pos)
self._utils.set_mocap_quat(self.model, self.data, "robot0:mocap", gripper_rotation)
Expand Down

0 comments on commit ce294c0

Please sign in to comment.