Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reginald-mclean committed Apr 22, 2024
1 parent 4f7da90 commit 6f46079
Show file tree
Hide file tree
Showing 32 changed files with 32 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def reset_model(self):
mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_SITE, "goal")
]
self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_box_close_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def reset_model(self):
mujoco.mj_step(self.model, self.data)

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def reset_model(self):
] = pos_machine

self._target_pos = pos_mug_goal
self.model.site('mug_goal').pos = self._target_pos
self.model.site("mug_goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def reset_model(self):
] = pos_machine

self._target_pos = pos_mug_goal
self.model.site('coffee_goal').pos = self._target_pos
self.model.site("coffee_goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_dial_turn_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def reset_model(self):
mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_BODY, "dial")
] = self.obj_init_pos
self.dial_push_position = self._get_pos_objects() + np.array([0.05, 0.02, 0.09])
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
mujoco.mj_forward(self.model, self.data)
return self._get_obs()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def reset_model(self):

# keep the door open after resetting initial positions
self._set_obj_xyz(-1.5708)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

@_assert_task_is_set
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_door_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def reset_model(self):
self.data.geom("handle").xpos[:-1] - self._target_pos[:-1]
)
self.target_reward = 1000 * self.maxPullDist + 1000 * 2
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def reset_model(self):
# Pull drawer out all the way and mark its starting position
self._set_obj_xyz(-self.maxDist)
self.obj_init_pos = self._get_pos_objects()
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def reset_model(self):
self._target_pos = self.obj_init_pos + np.array(
[0.0, -0.16 - self.maxDist, 0.09]
)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def reset_model(self):
[-self._handle_length, 0.0, 0.125]
)
mujoco.mj_forward(self.model, self.data)
self.model.site('goal_close').pos = self._target_pos
self.model.site("goal_close").pos = self._target_pos
return self._get_obs()

def _reset_hand(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def reset_model(self):
self._target_pos = self.obj_init_pos + np.array(
[+self._handle_length, 0.0, 0.125]
)
self.model.site('goal_open').pos = self._target_pos
self.model.site("goal_open").pos = self._target_pos
return self._get_obs()

def _reset_hand(self):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_hammer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def reset_model(self):
self.nail_init_pos = self._get_site_pos("nailHead")
self.obj_init_pos = self.hammer_init_pos.copy()
self._set_hammer_xyz(self.hammer_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def reset_model(self):
self._target_pos = goal_pos[-3:]

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def reset_model(self):
self._target_pos = self.obj_init_pos + np.array(
[0.12, 0.0, 0.25 + self.LEVER_RADIUS]
)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def reset_model(self):
mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_BODY, "box")
] = pos_box
self._target_pos = pos_box + np.array([0.03, 0.0, 0.13])
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def reset_model(self):
self.obj_init_pos = self._get_site_pos("pegEnd")

self._target_pos = pos_plug + np.array([0.15, 0.0, 0.0])
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def reset_model(self):
self.obj_init_pos = pos_obj
self._set_obj_xyz(self.obj_init_pos)
self._target_pos = pos_goal
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def reset_model(self):
self.init_right_pad = self.get_body_com("rightpad")

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def _gripper_caging_reward(self, action, obj_position):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def reset_model(self):
self.obj_init_pos = goal_pos[:3]

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_push_back_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def reset_model(self):
self.obj_init_pos = np.concatenate((goal_pos[:2], [self.obj_init_pos[-1]]))

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def _gripper_caging_reward(self, action, obj_position, obj_radius):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_push_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def reset_model(self):
self.obj_init_pos = np.concatenate((goal_pos[:2], [self.obj_init_pos[-1]]))

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_push_wall_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def reset_model(self):
self.obj_init_pos = np.concatenate((goal_pos[:2], [self.obj_init_pos[-1]]))

self._set_obj_xyz(self.obj_init_pos)
self.model.site('goal').pos = self._target_pos
self.model.site("goal").pos = self._target_pos
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
3 changes: 1 addition & 2 deletions metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_reach_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import mujoco
import numpy as np
from gymnasium.spaces import Box
from scipy.spatial.transform import Rotation
Expand Down Expand Up @@ -114,7 +113,7 @@ def reset_model(self):
self.obj_init_pos = goal_pos[:3]
self._set_obj_xyz(self.obj_init_pos)

self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def compute_reward(self, actions, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def reset_model(self):
self.obj_init_pos = goal_pos[:3]

self._set_obj_xyz(self.obj_init_pos)
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def compute_reward(self, actions, obs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def reset_model(self):
)

self._set_obj_xyz(self.obj_init_pos)
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def compute_reward(self, action, obs):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_soccer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def reset_model(self):
self.maxPushDist = np.linalg.norm(
self.obj_init_pos[:2] - np.array(self._target_pos)[:2]
)
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _gripper_caging_reward(self, action, obj_position, obj_radius):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def reset_model(self):
self._set_stick_xyz(self.stick_init_pos)
self._set_obj_xyz(self.obj_init_qpos)
self.obj_init_pos = self.get_body_com("object").copy()
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _stick_is_inserted(self, handle, end_of_stick):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def reset_model(self):
self._set_stick_xyz(self.stick_init_pos)
self._set_obj_xyz(self.obj_init_qpos)
self.obj_init_pos = self.get_body_com("object").copy()
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _gripper_caging_reward(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def reset_model(self):
self.maxPushDist = np.linalg.norm(
self.obj_init_pos[:2] - np.array(self._target_pos)[:2]
)
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _gripper_caging_reward(self, action, obj_position, obj_radius):
Expand Down
2 changes: 1 addition & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_sweep_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def reset_model(self):
self.get_body_com("obj")[:-1] - self._target_pos[:-1]
)
self.target_reward = 1000 * self.maxPushDist + 1000 * 2
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _gripper_caging_reward(self, action, obj_position, obj_radius):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def reset_model(self):
[0.2, 0.0, 0.0]
)
self.data.joint("window_slide").qpos = 0.2
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def _reset_hand(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def reset_model(self):

self.window_handle_pos_init = self._get_pos_objects()
self.data.joint("window_slide").qpos = 0.0
self._set_pos_site('goal', self._target_pos)
self._set_pos_site("goal", self._target_pos)
return self._get_obs()

def compute_reward(self, actions, obs):
Expand Down

0 comments on commit 6f46079

Please sign in to comment.