Fix: MujocoEnv no longer supports manual assignment of mujoco_bindings

This commit is contained in:
Dominik Moritz Roth 2023-05-27 12:55:46 +02:00
parent dbd7c37da5
commit 110a8a9c0c

View File

@ -22,6 +22,7 @@ class TableTennisEnv(MujocoEnv, utils.EzPickle):
"""
7 DoF table tennis environment
"""
def __init__(self, ctxt_dim: int = 4, frame_skip: int = 4,
goal_switching_step: int = None,
enable_artificial_wind: bool = False):
@ -52,8 +53,7 @@ class TableTennisEnv(MujocoEnv, utils.EzPickle):
MujocoEnv.__init__(self,
model_path=os.path.join(os.path.dirname(__file__), "assets", "xml", "table_tennis_env.xml"),
frame_skip=frame_skip,
mujoco_bindings="mujoco")
frame_skip=frame_skip,)
if ctxt_dim == 2:
self.context_bounds = CONTEXT_BOUNDS_2DIMS
@ -202,7 +202,7 @@ class TableTennisEnv(MujocoEnv, utils.EzPickle):
if not self._hit_ball:
return 0.2 * (1 - np.tanh(min_r_b_dist**2))
if self._ball_landing_pos is None:
min_b_des_b_dist = np.min(np.linalg.norm(np.array(self._ball_traj)[:,:2] - self._goal_pos[:2], axis=1))
min_b_des_b_dist = np.min(np.linalg.norm(np.array(self._ball_traj)[:, :2] - self._goal_pos[:2], axis=1))
return 2 * (1 - np.tanh(min_r_b_dist ** 2)) + (1 - np.tanh(min_b_des_b_dist**2))
min_b_des_b_land_dist = np.linalg.norm(self._goal_pos[:2] - self._ball_landing_pos[:2])
over_net_bonus = int(self._ball_landing_pos[0] < 0)