Rendering works (fps look fast tho? TODO action bounding is too wide [-1,1])

This commit is contained in:
Cadene 2024-03-08 15:33:35 +00:00
parent ebbcad8c05
commit 6500945be5
2 changed files with 10 additions and 12 deletions

View File

@ -73,11 +73,11 @@ def download(data_dir, dataset_id):
data_dir.mkdir(parents=True, exist_ok=True) data_dir.mkdir(parents=True, exist_ok=True)
gdown.download_folder(FOLDER_URLS[dataset_id], output=data_dir) gdown.download_folder(FOLDER_URLS[dataset_id], output=str(data_dir))
# because of the 50 files limit per directory, two files episode 48 and 49 were missing # because of the 50 files limit per directory, two files episode 48 and 49 were missing
gdown.download(EP48_URLS[dataset_id], output=data_dir / "episode_48.hdf5", fuzzy=True) gdown.download(EP48_URLS[dataset_id], output=str(data_dir / "episode_48.hdf5"), fuzzy=True)
gdown.download(EP49_URLS[dataset_id], output=data_dir / "episode_49.hdf5", fuzzy=True) gdown.download(EP49_URLS[dataset_id], output=str(data_dir / "episode_49.hdf5"), fuzzy=True)
class AlohaExperienceReplay(AbstractExperienceReplay): class AlohaExperienceReplay(AbstractExperienceReplay):

View File

@ -370,14 +370,10 @@ class AlohaEnv(EnvBase):
raise NotImplementedError() raise NotImplementedError()
# self._prev_action_queue = deque(maxlen=self.num_prev_action) # self._prev_action_queue = deque(maxlen=self.num_prev_action)
def render(self, mode="rgb_array", width=384, height=384): def render(self, mode="rgb_array", width=640, height=480):
if width != height: # TODO(rcadene): render and visualizer several cameras (e.g. angle, front_close)
raise NotImplementedError() image = self._env.physics.render(height=height, width=width, camera_id="top")
tmp = self._env.render_size return image
self._env.render_size = width
out = self._env.render(mode)
self._env.render_size = tmp
return out
def _format_raw_obs(self, raw_obs): def _format_raw_obs(self, raw_obs):
if self.from_pixels: if self.from_pixels:
@ -535,8 +531,10 @@ class AlohaEnv(EnvBase):
# ) # )
# TODO(rcaene): add bounds (where are they????) # TODO(rcaene): add bounds (where are they????)
self.action_spec = UnboundedContinuousTensorSpec( self.action_spec = BoundedTensorSpec(
shape=(len(ACTIONS)), shape=(len(ACTIONS)),
low=-1,
high=1,
dtype=torch.float32, dtype=torch.float32,
device=self.device, device=self.device,
) )