From b538e326f9241483cc9837be45c77b75a9797620 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Mon, 19 Feb 2024 12:32:00 -0500 Subject: [PATCH] refine the RearrangeOpenCloseDrawerTaskV1 env --- .../sub_tasks/articulated_object_task.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/habitat-lab/habitat/tasks/rearrange/sub_tasks/articulated_object_task.py b/habitat-lab/habitat/tasks/rearrange/sub_tasks/articulated_object_task.py index 1be8198a78..f65b8b75a2 100644 --- a/habitat-lab/habitat/tasks/rearrange/sub_tasks/articulated_object_task.py +++ b/habitat-lab/habitat/tasks/rearrange/sub_tasks/articulated_object_task.py @@ -309,11 +309,20 @@ def _get_look_pos(self): return [0.0, 0.0, 0.0] def _gen_start_state(self): - targ_link = self.get_use_marker().joint_idx - drawers = np.zeros((8,)) - if np.random.random() > 0.5: - drawers[targ_link] = np.random.uniform(0.4, 0.5) - return drawers + if self._use_marker == "fridge_push_point": + state = np.zeros((2,)) + if np.random.random() > 0.5: + # Open the fridge + state = np.array( + [0, np.random.uniform(np.pi / 4, 2 * np.pi / 3)] + ) + else: + targ_link = self.get_use_marker().joint_idx + state = np.zeros((8,)) + if np.random.random() > 0.5: + # Open the drawer + state[targ_link] = np.random.uniform(0.4, 0.5) + return state def reset(self, episode: Episode): # There are 5 possible markers to use in replica_cad