From 1983e9d96e6eb1010e1c1e775becef51b3eb621d Mon Sep 17 00:00:00 2001 From: ottofabian Date: Thu, 16 Sep 2021 11:48:14 +0200 Subject: [PATCH] fixed issue of incorrectly retrieving the current position for metaworld tasks --- alr_envs/meta/goal_change_mp_wrapper.py | 2 +- alr_envs/meta/goal_endeffector_change_mp_wrapper.py | 2 +- alr_envs/meta/goal_object_change_mp_wrapper.py | 2 +- alr_envs/meta/object_change_mp_wrapper.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alr_envs/meta/goal_change_mp_wrapper.py b/alr_envs/meta/goal_change_mp_wrapper.py index 15f4de9..a558365 100644 --- a/alr_envs/meta/goal_change_mp_wrapper.py +++ b/alr_envs/meta/goal_change_mp_wrapper.py @@ -53,7 +53,7 @@ class MPWrapper(MPEnvWrapper): @property def current_pos(self) -> Union[float, int, np.ndarray]: r_close = self.env.data.get_joint_qpos("r_close") - return np.hstack([self.env.data.mocap_pos.flatten(), r_close]) + return np.hstack([self.env.data.mocap_pos.flatten() / self.env.action_scale, r_close]) @property def current_vel(self) -> Union[float, int, np.ndarray, Tuple]: diff --git a/alr_envs/meta/goal_endeffector_change_mp_wrapper.py b/alr_envs/meta/goal_endeffector_change_mp_wrapper.py index 95c29e3..8912a72 100644 --- a/alr_envs/meta/goal_endeffector_change_mp_wrapper.py +++ b/alr_envs/meta/goal_endeffector_change_mp_wrapper.py @@ -53,7 +53,7 @@ class MPWrapper(MPEnvWrapper): @property def current_pos(self) -> Union[float, int, np.ndarray]: r_close = self.env.data.get_joint_qpos("r_close") - return np.hstack([self.env.data.mocap_pos.flatten(), r_close]) + return np.hstack([self.env.data.mocap_pos.flatten() / self.env.action_scale, r_close]) @property def current_vel(self) -> Union[float, int, np.ndarray, Tuple]: diff --git a/alr_envs/meta/goal_object_change_mp_wrapper.py b/alr_envs/meta/goal_object_change_mp_wrapper.py index 6811ace..63e16b7 100644 --- a/alr_envs/meta/goal_object_change_mp_wrapper.py +++ b/alr_envs/meta/goal_object_change_mp_wrapper.py @@ -53,7 +53,7 @@ class MPWrapper(MPEnvWrapper): @property def current_pos(self) -> Union[float, int, np.ndarray]: r_close = self.env.data.get_joint_qpos("r_close") - return np.hstack([self.env.data.mocap_pos.flatten(), r_close]) + return np.hstack([self.env.data.mocap_pos.flatten() / self.env.action_scale, r_close]) @property def current_vel(self) -> Union[float, int, np.ndarray, Tuple]: diff --git a/alr_envs/meta/object_change_mp_wrapper.py b/alr_envs/meta/object_change_mp_wrapper.py index c7e506b..4293148 100644 --- a/alr_envs/meta/object_change_mp_wrapper.py +++ b/alr_envs/meta/object_change_mp_wrapper.py @@ -53,7 +53,7 @@ class MPWrapper(MPEnvWrapper): @property def current_pos(self) -> Union[float, int, np.ndarray]: r_close = self.env.data.get_joint_qpos("r_close") - return np.hstack([self.env.data.mocap_pos.flatten(), r_close]) + return np.hstack([self.env.data.mocap_pos.flatten() / self.env.action_scale, r_close]) @property def current_vel(self) -> Union[float, int, np.ndarray, Tuple]: