Skip to content

Commit

Permalink
pre-commit and only load sensors specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mees committed Nov 2, 2021
1 parent e491213 commit 2e9e35b
Show file tree
Hide file tree
Showing 44 changed files with 4,260 additions and 4,261 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,3 @@ events.out*
/.idea/

egl_check/EGL_options.o

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ cd calvin_env/tacto
pip install -e .
cd ..
pip install -e .
```
```
2 changes: 1 addition & 1 deletion calvin_env/camera/tactile_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import numpy as np
import pybullet as p
import tacto

from calvin_env.camera.camera import Camera
import tacto

REPO_BASE = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))

Expand Down
11 changes: 9 additions & 2 deletions calvin_env/envs/play_lmp_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
try:
from lfp.datasets.utils.episode_utils import process_actions, process_depth, process_rgb, process_state
except ImportError:
from calvin_models.calvin_agent.datasets.utils.episode_utils import process_actions, process_depth, process_rgb, process_state
from calvin_models.calvin_agent.datasets.utils.episode_utils import (
process_actions,
process_depth,
process_rgb,
process_state,
)
import numpy as np
import torch

Expand All @@ -20,7 +25,9 @@
class PlayLMPWrapper(gym.Wrapper):
def __init__(self, dataset_loader, device, show_gui=False, **kwargs):
self.set_egl_device(device)
env = get_env(dataset_loader.abs_datasets_dir, show_gui=show_gui, **kwargs)
env = get_env(
dataset_loader.abs_datasets_dir, show_gui=show_gui, obs_space=dataset_loader.observation_space, **kwargs
)
super(PlayLMPWrapper, self).__init__(env)
self.observation_space_keys = dataset_loader.observation_space
self.transforms = dataset_loader.transforms
Expand Down
11 changes: 8 additions & 3 deletions calvin_env/envs/play_table_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
import pickle
import pkgutil
import re
import sys
import time

Expand Down Expand Up @@ -260,14 +261,18 @@ def serialize(self):
return data


def get_env(dataset_path, show_gui=True, **kwargs):
def get_env(dataset_path, obs_space, show_gui=True, **kwargs):
from pathlib import Path

from omegaconf import OmegaConf

render_conf = OmegaConf.load(Path(dataset_path) / ".hydra" / "merged_config.yaml")
if "cameras" in kwargs:
OmegaConf.update(render_conf, "cameras", kwargs["cameras"], merge=False)

exclude_keys = set(render_conf.cameras.keys()) - {
re.split("_", key)[1] for key in obs_space["rgb_obs"] + obs_space["depth_obs"]
}
for k in exclude_keys:
del render_conf.cameras[k]
if "scene" in kwargs:
scene_cfg = OmegaConf.load(Path(calvin_env.__file__).parents[1] / "conf/scene" / f"{kwargs['scene']}.yaml")
OmegaConf.merge(render_conf, scene_cfg)
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 2e9e35b

Please sign in to comment.