|
|
|
|
|
|
"There can only be one brain in a UnityEnvironment " |
|
|
|
"if it is wrapped in a gym." |
|
|
|
) |
|
|
|
if len(self._env.external_brain_names) <= 0: |
|
|
|
raise UnityGymException( |
|
|
|
"There are not any external brain in the UnityEnvironment" |
|
|
|
) |
|
|
|
|
|
|
|
self.brain_name = self._env.external_brain_names[0] |
|
|
|
brain = self._env.brains[self.brain_name] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _single_step(self, info): |
|
|
|
if self.use_visual: |
|
|
|
visual_obs = info.visual_observations |
|
|
|
if isinstance(visual_obs, list): |
|
|
|
visual_obs = np.array(visual_obs) |
|
|
|
info.visual_observations[0][0, :, :, :] |
|
|
|
visual_obs[0][0, :, :, :] |
|
|
|
) |
|
|
|
default_observation = self.visual_obs |
|
|
|
else: |
|
|
|