Skip to content

Commit

Permalink
fixes Box low's precision warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacr committed Apr 15, 2024
1 parent 0745f6c commit 8e224a0
Show file tree
Hide file tree
Showing 88 changed files with 475 additions and 214 deletions.
5 changes: 4 additions & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_assembly_peg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def __init__(self):
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
5 changes: 4 additions & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_box_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def __init__(self):
np.hstack((obj_high, goal_high)),
)

self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
9 changes: 6 additions & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_button_press.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def __init__(self):
self.hand_init_pos = self.init_config["hand_init_pos"]

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)

self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
15 changes: 9 additions & 6 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_coffee_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ def __init__(self):
self.hand_init_pos = self.init_config["hand_init_pos"]

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down Expand Up @@ -81,9 +84,9 @@ def reset_model(self):
obj_pos = goal_pos + np.array([0, -0.1, -0.28])
self._target_pos = button_pos

self.sim.model.body_pos[
self.model.body_name2id("coffee_machine")
] = self.obj_init_pos
self.sim.model.body_pos[self.model.body_name2id("coffee_machine")] = (
self.obj_init_pos
)
self.sim.model.body_pos[self.model.body_name2id("button")] = self._target_pos
self._set_obj_xyz(obj_pos)
self._target_pos = self._get_site_pos("coffee_goal")
Expand Down
11 changes: 7 additions & 4 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_coffee_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def __init__(self):
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down Expand Up @@ -93,9 +96,9 @@ def reset_model(self):
self.obj_init_pos = np.concatenate((goal_pos[:2], [self.obj_init_pos[-1]]))
machine_pos = goal_pos[:3] - np.array([0, -0.15, -0.27])
button_pos = machine_pos + np.array([0.0, -0.12, 0.05])
self.sim.model.body_pos[
self.model.body_name2id("coffee_machine")
] = machine_pos
self.sim.model.body_pos[self.model.body_name2id("coffee_machine")] = (
machine_pos
)
self.sim.model.body_pos[self.model.body_name2id("button")] = button_pos

self._set_obj_xyz(self.obj_init_pos)
Expand Down
11 changes: 7 additions & 4 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_coffee_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def __init__(self):
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down Expand Up @@ -92,9 +95,9 @@ def reset_model(self):
self.obj_init_pos = np.concatenate((goal_pos[:2], [self.obj_init_pos[-1]]))
machine_pos = self._target_pos - np.array([0, -0.1, -0.27])
button_pos = machine_pos + np.array([0.0, -0.12, 0.05])
self.sim.model.body_pos[
self.model.body_name2id("coffee_machine")
] = machine_pos
self.sim.model.body_pos[self.model.body_name2id("coffee_machine")] = (
machine_pos
)
self.sim.model.body_pos[self.model.body_name2id("button")] = button_pos

self._set_obj_xyz(self.obj_init_pos)
Expand Down
9 changes: 6 additions & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_dial_turn.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def __init__(self):
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
9 changes: 6 additions & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_door.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

self.door_angle_idx = self.model.get_joint_qpos_addr("doorjoint")

Expand Down
9 changes: 6 additions & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_door_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
9 changes: 6 additions & 3 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_door_unlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def __init__(self):
self.hand_init_pos = self.init_config["hand_init_pos"]

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down
15 changes: 9 additions & 6 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_drawer_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ def __init__(self):
self.hand_init_pos = self.init_config["hand_init_pos"]

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down Expand Up @@ -85,9 +88,9 @@ def reset_model(self):
drawer_cover_pos = self.obj_init_pos.copy()
drawer_cover_pos[2] -= 0.02
self.sim.model.body_pos[self.model.body_name2id("drawer")] = self.obj_init_pos
self.sim.model.body_pos[
self.model.body_name2id("drawer_cover")
] = drawer_cover_pos
self.sim.model.body_pos[self.model.body_name2id("drawer_cover")] = (
drawer_cover_pos
)
self.sim.model.site_pos[self.model.site_name2id("goal")] = self._target_pos
self._set_obj_xyz(-0.2)
self.maxDist = np.abs(
Expand Down
15 changes: 9 additions & 6 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_drawer_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ def __init__(self):
self.hand_init_pos = self.init_config["hand_init_pos"]

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down Expand Up @@ -87,9 +90,9 @@ def reset_model(self):
drawer_cover_pos = self.obj_init_pos.copy()
drawer_cover_pos[2] -= 0.02
self.sim.model.body_pos[self.model.body_name2id("drawer")] = self.obj_init_pos
self.sim.model.body_pos[
self.model.body_name2id("drawer_cover")
] = drawer_cover_pos
self.sim.model.body_pos[self.model.body_name2id("drawer_cover")] = (
drawer_cover_pos
)
self.sim.model.site_pos[self.model.site_name2id("goal")] = self._target_pos
self.maxPullDist = 0.2
self.target_reward = 1000 * self.maxPullDist + 1000 * 2
Expand Down
15 changes: 9 additions & 6 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_faucet_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down Expand Up @@ -79,9 +82,9 @@ def reset_model(self):
self._target_pos = final_pos

self.sim.model.body_pos[self.model.body_name2id("faucet")] = self.obj_init_pos
self.sim.model.body_pos[
self.model.body_name2id("faucetBase")
] = self.obj_init_pos
self.sim.model.body_pos[self.model.body_name2id("faucetBase")] = (
self.obj_init_pos
)
self.maxPullDist = np.linalg.norm(self._target_pos - self.obj_init_pos)

return self._get_obs()
Expand Down
15 changes: 9 additions & 6 deletions metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_faucet_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def __init__(self):
goal_high = self.hand_high

self._random_reset_space = Box(
np.array(obj_low),
np.array(obj_high),
np.array(obj_low, dtype=np.float32),
np.array(obj_high, dtype=np.float32),
)
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))

@property
def model_name(self):
Expand Down Expand Up @@ -80,9 +83,9 @@ def reset_model(self):
self._target_pos = final_pos

self.sim.model.body_pos[self.model.body_name2id("faucet")] = self.obj_init_pos
self.sim.model.body_pos[
self.model.body_name2id("faucetBase")
] = self.obj_init_pos
self.sim.model.body_pos[self.model.body_name2id("faucetBase")] = (
self.obj_init_pos
)
self.maxPullDist = np.linalg.norm(self._target_pos - self.obj_init_pos)

return self._get_obs()
Expand Down
5 changes: 4 additions & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def __init__(self):
self.liftThresh = liftThresh

self._random_reset_space = Box(np.array(obj_low), np.array(obj_high))
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
5 changes: 4 additions & 1 deletion metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_hand_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def __init__(self):
np.hstack((obj_low, goal_low)),
np.hstack((obj_high, goal_high)),
)
self.goal_space = Box(np.array(goal_low), np.array(goal_high))
self.goal_space = Box(
np.array(goal_low, dtype=np.float32),
np.array(goal_high, dtype=np.float32),
)

@property
def model_name(self):
Expand Down
Loading

0 comments on commit 8e224a0

Please sign in to comment.