in gym_hil/envs/panda_pick_gym_env.py [0:0]
def reset(self, seed=None, **kwargs) -> Tuple[Dict[str, np.ndarray], Dict[str, Any]]:
"""Reset the environment."""
# Ensure gymnasium internal RNG is initialized when a seed is provided
super().reset(seed=seed)
mujoco.mj_resetData(self._model, self._data)
# Reset the robot to home position
self.reset_robot()
# Sample a new block position
if self._random_block_position:
block_xy = np.random.uniform(*_SAMPLING_BOUNDS)
self._data.jnt("block").qpos[:3] = (*block_xy, self._block_z)
else:
block_xy = np.asarray([0.5, 0.0])
self._data.jnt("block").qpos[:3] = (*block_xy, self._block_z)
mujoco.mj_forward(self._model, self._data)
# Cache the initial block height
self._z_init = self._data.sensor("block_pos").data[2]
self._z_success = self._z_init + 0.1
obs = self._compute_observation()
return obs, {}