Skip to content

Commit

Permalink
pre-commit and fixing door env
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Jan 13, 2024
1 parent a8144aa commit 449a9d4
Show file tree
Hide file tree
Showing 51 changed files with 70 additions and 151 deletions.
23 changes: 18 additions & 5 deletions metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ class SawyerMocapBase(mjenv_gym):
"render_fps": 80,
}

def __init__(self, model_name, frame_skip=5, render_mode=None, camera_name=None, camera_id=None):
def __init__(
self,
model_name,
frame_skip=5,
render_mode=None,
camera_name=None,
camera_id=None,
):
mjenv_gym.__init__(
self,
model_name,
frame_skip=frame_skip,
observation_space=self.sawyer_observation_space,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)
self.reset_mocap_welds()
self.frame_skip = frame_skip
Expand Down Expand Up @@ -116,7 +123,7 @@ def __init__(
action_rot_scale=1.0,
render_mode=None,
camera_id=None,
camera_name=None
camera_name=None,
):
self.action_scale = action_scale
self.action_rot_scale = action_rot_scale
Expand Down Expand Up @@ -144,7 +151,13 @@ def __init__(

self._partially_observable = True

super().__init__(model_name, frame_skip=frame_skip, render_mode=render_mode, camera_name=camera_name, camera_id=camera_id)
super().__init__(
model_name,
frame_skip=frame_skip,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id,
)

mujoco.mj_forward(
self.model, self.data
Expand Down Expand Up @@ -466,7 +479,7 @@ def step(self, action):
raise ValueError("You must reset the env manually once truncate==True")
self.do_simulation([action[-1], -action[-1]], n_frames=self.frame_skip)
self.curr_path_length += 1

# Running the simulator can sometimes mess up site positions, so
# re-position them here to make sure they're accurate
for site in self._target_site_config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)


self.init_config = {
"obj_init_angle": 0.3,
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_basketball_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": 0.3,
"obj_init_pos": np.array([0, 0.6, 0.03], dtype=np.float32),
Expand Down
4 changes: 2 additions & 2 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_bin_picking_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)

self.init_config = {
"obj_init_angle": 0.3,
"obj_init_pos": np.array([-0.12, 0.7, 0.02]),
Expand Down
3 changes: 1 addition & 2 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_box_close_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)


self.init_config = {
"obj_init_angle": 0.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)

self.init_config = {
"obj_init_pos": np.array([0, 0.8, 0.115], dtype=np.float32),
"hand_init_pos": np.array([0, 0.4, 0.2], dtype=np.float32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.8, 0.115], dtype=np.float32),
"hand_init_pos": np.array([0, 0.4, 0.2], dtype=np.float32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0.0, 0.9, 0.115], dtype=np.float32),
"hand_init_pos": np.array([0, 0.4, 0.2], dtype=np.float32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0.0, 0.9, 0.115], dtype=np.float32),
"hand_init_pos": np.array([0, 0.4, 0.2], dtype=np.float32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.9, 0.28]),
"obj_init_angle": 0.3,
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_coffee_pull_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.75, 0.0]),
"obj_init_angle": 0.3,
Expand Down
3 changes: 1 addition & 2 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_coffee_push_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)


self.init_config = {
"obj_init_angle": 0.3,
"obj_init_pos": np.array([0.0, 0.6, 0.0]),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_dial_turn_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.7, 0.0]),
"hand_init_pos": np.array([0, 0.6, 0.2], dtype=np.float32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": 0.3,
"obj_init_pos": np.array([0, 0.7, 0.025]),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_door_close_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": 0.3,
"obj_init_pos": np.array([0.1, 0.95, 0.15], dtype=np.float32),
Expand Down
5 changes: 1 addition & 4 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_door_lock_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)

def __init__(self, render_mode=None, camera_name=None, camera_id=None):
self.tasks = tasks

self.init_config = {
"obj_init_pos": np.array([0, 0.85, 0.15], dtype=np.float32),
"hand_init_pos": np.array([0, 0.6, 0.2], dtype=np.float32),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_door_unlock_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.85, 0.15]),
"hand_init_pos": np.array([0, 0.6, 0.2], dtype=np.float32),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_door_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": np.array([0.3]),
"obj_init_pos": np.array([0.1, 0.95, 0.15]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": np.array(
[
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_drawer_open_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_angle": np.array(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.8, 0.0]),
"hand_init_pos": np.array([0.0, 0.4, 0.2]),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_faucet_open_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.8, 0.0]),
"hand_init_pos": np.array([0.0, 0.4, 0.2]),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_hammer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"hammer_init_pos": np.array([0, 0.5, 0.0]),
"hand_init_pos": np.array([0, 0.4, 0.2]),
Expand Down
4 changes: 1 addition & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_hand_insert_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.6, 0.05]),
"obj_init_angle": 0.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([-0.3, 0.7, 0.0]),
"hand_init_pos": np.array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([0, 0.9, 0.0]),
"hand_init_pos": np.array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def __init__(self, render_mode=None, camera_name=None, camera_id=None):
hand_high=hand_high,
render_mode=render_mode,
camera_name=camera_name,
camera_id=camera_id
camera_id=camera_id,
)



self.init_config = {
"obj_init_pos": np.array([-0.3, 0.7, 0.0]),
"hand_init_pos": np.array(
Expand Down
Loading

0 comments on commit 449a9d4

Please sign in to comment.