task goal update
Browse files
src/robomme/robomme_env/utils/task_goal.py
CHANGED
|
@@ -45,8 +45,8 @@ num2words_2 = {
|
|
| 45 |
}
|
| 46 |
|
| 47 |
def get_language_goal(self, env):
|
| 48 |
-
|
| 49 |
-
|
| 50 |
if env == "BinFill":
|
| 51 |
color_counts = {
|
| 52 |
"red": getattr(self.env.unwrapped, "red_cubes_target_number", 0),
|
|
@@ -62,135 +62,137 @@ def get_language_goal(self, env):
|
|
| 62 |
phrases.append(f"{word} {color} {noun}")
|
| 63 |
|
| 64 |
if not phrases:
|
| 65 |
-
|
| 66 |
-
|
| 67 |
elif len(phrases) == 1:
|
| 68 |
-
|
| 69 |
-
|
| 70 |
elif len(phrases) == 2:
|
| 71 |
-
|
| 72 |
-
|
| 73 |
else:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
|
| 77 |
elif env == "PickXtimes":
|
| 78 |
repeats = getattr(self.env.unwrapped, "num_repeats", 1)
|
| 79 |
target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
|
| 80 |
if repeats > 1:
|
| 81 |
word = num2words.get(repeats, str(repeats))
|
| 82 |
-
|
| 83 |
-
|
| 84 |
else:
|
| 85 |
-
|
| 86 |
-
language_goal_2 = f"pick up the {target_color} cube and place it on the target, then press the button to stop"
|
| 87 |
|
| 88 |
elif env == "SwingXtimes":
|
| 89 |
repeats = getattr(self.env.unwrapped, "num_repeats", 1)
|
| 90 |
target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
|
| 91 |
if repeats > 1:
|
| 92 |
word = num2words.get(repeats, str(repeats))
|
| 93 |
-
|
| 94 |
-
|
| 95 |
else:
|
| 96 |
-
|
| 97 |
-
|
| 98 |
|
| 99 |
elif env == "VideoUnmask":
|
| 100 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 101 |
cube_0_color = color_names[0]
|
| 102 |
cube_1_color = color_names[1]
|
| 103 |
if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
|
| 104 |
-
|
| 105 |
-
language_goal_2 = f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube"
|
| 106 |
else:
|
| 107 |
-
|
| 108 |
-
language_goal_2 = f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube"
|
| 109 |
|
| 110 |
elif env == "VideoUnmaskSwap":
|
| 111 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 112 |
cube_0_color = color_names[0]
|
| 113 |
cube_1_color = color_names[1]
|
| 114 |
if self.pick_times == 2:
|
| 115 |
-
|
| 116 |
-
language_goal_2 = f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube"
|
| 117 |
else:
|
| 118 |
-
|
| 119 |
-
language_goal_2 = f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube"
|
| 120 |
|
| 121 |
elif env == "ButtonUnmask":
|
| 122 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 123 |
cube_0_color = color_names[0]
|
| 124 |
cube_1_color = color_names[1]
|
| 125 |
if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
|
| 126 |
-
|
| 127 |
-
language_goal_2 = f"first press the button, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube"
|
| 128 |
else:
|
| 129 |
-
|
| 130 |
-
language_goal_2 = f"first press the button, then pick up the container hiding the {cube_0_color} cube"
|
| 131 |
|
| 132 |
elif env == "ButtonUnmaskSwap":
|
| 133 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 134 |
cube_0_color = color_names[0]
|
| 135 |
cube_1_color = color_names[1]
|
| 136 |
if self.pick_times == 2:
|
| 137 |
-
|
| 138 |
-
language_goal_2 = f"first press both buttons on the table, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube"
|
| 139 |
else:
|
| 140 |
-
|
| 141 |
-
language_goal_2 = f"first press both buttons on the table, then pick up the container hiding the {cube_0_color} cube"
|
| 142 |
|
| 143 |
elif env == "VideoPlaceButton":
|
| 144 |
target_color_name = self.target_color_name
|
| 145 |
target_target_language = self.target_target_language
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
elif env == "VideoPlaceOrder":
|
| 150 |
target_color_name = self.target_color_name
|
| 151 |
which_in_subset = self.which_in_subset
|
| 152 |
num = num2words_2.get(which_in_subset, str(which_in_subset))
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
elif env == 'PickHighlight':
|
| 157 |
-
|
| 158 |
-
|
| 159 |
|
| 160 |
elif env == "VideoRepick":
|
| 161 |
num_repeats = self.num_repeats
|
| 162 |
if num_repeats > 1:
|
| 163 |
word = num2words.get(num_repeats, str(num_repeats))
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
else:
|
| 167 |
-
|
| 168 |
-
|
| 169 |
|
| 170 |
elif env == "StopCube":
|
| 171 |
repeats = getattr(self.env.unwrapped, "stop_time", 1)
|
| 172 |
word = num2words_2.get(repeats, str(repeats))
|
| 173 |
-
|
| 174 |
-
|
| 175 |
|
| 176 |
elif env == "InsertPeg":
|
| 177 |
-
|
| 178 |
-
|
| 179 |
|
| 180 |
elif env == "MoveCube":
|
| 181 |
-
|
| 182 |
-
|
| 183 |
|
| 184 |
elif env == "PatternLock":
|
| 185 |
-
|
| 186 |
-
|
| 187 |
|
| 188 |
elif env == "RouteStick":
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
language_goal_2 = language_goal_2 or ""
|
| 194 |
-
if language_goal == language_goal_2:
|
| 195 |
-
return [language_goal]
|
| 196 |
-
return [language_goal, language_goal_2]
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
def get_language_goal(self, env):
|
| 48 |
+
language_goals = []
|
| 49 |
+
|
| 50 |
if env == "BinFill":
|
| 51 |
color_counts = {
|
| 52 |
"red": getattr(self.env.unwrapped, "red_cubes_target_number", 0),
|
|
|
|
| 62 |
phrases.append(f"{word} {color} {noun}")
|
| 63 |
|
| 64 |
if not phrases:
|
| 65 |
+
language_goals.append("put the cubes into the bin, then press the button to stop")
|
| 66 |
+
language_goals.append("put the cubes into the bin and press the button to stop")
|
| 67 |
elif len(phrases) == 1:
|
| 68 |
+
language_goals.append(f"put {phrases[0]} into the bin, then press the button to stop")
|
| 69 |
+
language_goals.append(f"put {phrases[0]} into the bin and press the button to stop")
|
| 70 |
elif len(phrases) == 2:
|
| 71 |
+
language_goals.append(f"put {phrases[0]} and {phrases[1]} into the bin, then press the button to stop")
|
| 72 |
+
language_goals.append(f"put {phrases[0]} and {phrases[1]} into the bin and press the button to stop")
|
| 73 |
else:
|
| 74 |
+
language_goals.append(f"put {', '.join(phrases[:-1])} and {phrases[-1]} into the bin, then press the button to stop")
|
| 75 |
+
language_goals.append(f"put {', '.join(phrases[:-1])} and {phrases[-1]} into the bin and press the button to stop")
|
| 76 |
|
| 77 |
elif env == "PickXtimes":
|
| 78 |
repeats = getattr(self.env.unwrapped, "num_repeats", 1)
|
| 79 |
target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
|
| 80 |
if repeats > 1:
|
| 81 |
word = num2words.get(repeats, str(repeats))
|
| 82 |
+
language_goals.append(f"pick up the {target_color} cube and place it on the target, repeating this action {word} times, then press the button to stop")
|
| 83 |
+
language_goals.append(f"pick up the {target_color} cube and place it on the target, repeating this pick-and-place action {word} times, then press the button to stop")
|
| 84 |
else:
|
| 85 |
+
language_goals.append(f"pick up the {target_color} cube and place it on the target, then press the button to stop")
|
|
|
|
| 86 |
|
| 87 |
elif env == "SwingXtimes":
|
| 88 |
repeats = getattr(self.env.unwrapped, "num_repeats", 1)
|
| 89 |
target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
|
| 90 |
if repeats > 1:
|
| 91 |
word = num2words.get(repeats, str(repeats))
|
| 92 |
+
language_goals.append(f"pick up the {target_color} cube, move it to the top of the right-side target, then move it to the top of the left-side target, repeating this back-and-forth motion {word} times, finally press the button to stop")
|
| 93 |
+
language_goals.append(f"pick up the {target_color} cube, move it to the right-side target and then to the left-side target, repeating this right-to-left swing motion {word} times, then put down the cube and press the button to stop")
|
| 94 |
else:
|
| 95 |
+
language_goals.append(f"pick up the {target_color} cube, move it to the top of the right-side target, then put it down on the left-side target, finally press the button to stop")
|
| 96 |
+
language_goals.append(f"pick up the {target_color} cube, move it to the right-side target and then put it down on the left-side target, then press the button to stop")
|
| 97 |
|
| 98 |
elif env == "VideoUnmask":
|
| 99 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 100 |
cube_0_color = color_names[0]
|
| 101 |
cube_1_color = color_names[1]
|
| 102 |
if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
|
| 103 |
+
language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube")
|
|
|
|
| 104 |
else:
|
| 105 |
+
language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube")
|
|
|
|
| 106 |
|
| 107 |
elif env == "VideoUnmaskSwap":
|
| 108 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 109 |
cube_0_color = color_names[0]
|
| 110 |
cube_1_color = color_names[1]
|
| 111 |
if self.pick_times == 2:
|
| 112 |
+
language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube")
|
|
|
|
| 113 |
else:
|
| 114 |
+
language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube")
|
|
|
|
| 115 |
|
| 116 |
elif env == "ButtonUnmask":
|
| 117 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 118 |
cube_0_color = color_names[0]
|
| 119 |
cube_1_color = color_names[1]
|
| 120 |
if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
|
| 121 |
+
language_goals.append(f"first press the button, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube")
|
|
|
|
| 122 |
else:
|
| 123 |
+
language_goals.append(f"first press the button, then pick up the container hiding the {cube_0_color} cube")
|
|
|
|
| 124 |
|
| 125 |
elif env == "ButtonUnmaskSwap":
|
| 126 |
color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
|
| 127 |
cube_0_color = color_names[0]
|
| 128 |
cube_1_color = color_names[1]
|
| 129 |
if self.pick_times == 2:
|
| 130 |
+
language_goals.append(f"first press both buttons on the table, then pick up the container hiding the {cube_0_color} cube, finally pick up another container hiding the {cube_1_color} cube")
|
|
|
|
| 131 |
else:
|
| 132 |
+
language_goals.append(f"first press both buttons on the table, then pick up the container hiding the {cube_0_color} cube")
|
|
|
|
| 133 |
|
| 134 |
elif env == "VideoPlaceButton":
|
| 135 |
target_color_name = self.target_color_name
|
| 136 |
target_target_language = self.target_target_language
|
| 137 |
+
|
| 138 |
+
language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the target right {target_target_language} the button was pressed")
|
| 139 |
+
language_goals.append(f"watch the video carefully, and place the {target_color_name} cube on the target where it was placed immediately {target_target_language} the button was pressed")
|
| 140 |
+
|
| 141 |
+
language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the target where it was previously placed {target_target_language} the button was pressed")
|
| 142 |
+
if target_target_language == "before":
|
| 143 |
+
language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the target where it was last placed before the button was pressed")
|
| 144 |
+
else:
|
| 145 |
+
language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the target where it was first placed after the button was pressed")
|
| 146 |
+
|
| 147 |
|
| 148 |
elif env == "VideoPlaceOrder":
|
| 149 |
target_color_name = self.target_color_name
|
| 150 |
which_in_subset = self.which_in_subset
|
| 151 |
num = num2words_2.get(which_in_subset, str(which_in_subset))
|
| 152 |
+
language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the {num} target it was previously placed on")
|
| 153 |
+
language_goals.append(f"watch the video carefully and place the {target_color_name} cube on the {num} target where it was placed")
|
| 154 |
|
| 155 |
elif env == 'PickHighlight':
|
| 156 |
+
language_goals.append(f"first press the button, then pick up all cubes that have been highlighteted with white areas on the table")
|
| 157 |
+
language_goals.append(f"first press the button, then pick up all highlighted cubes, finally press the button again to stop")
|
| 158 |
|
| 159 |
elif env == "VideoRepick":
|
| 160 |
num_repeats = self.num_repeats
|
| 161 |
if num_repeats > 1:
|
| 162 |
word = num2words.get(num_repeats, str(num_repeats))
|
| 163 |
+
|
| 164 |
+
language_goals.append(f'watch the video carefully, then repeatedly pick up and put down the same block that was previously picked up for {word} times, finally put it down and press the button to stop')
|
| 165 |
+
if word == "two":
|
| 166 |
+
language_goals.append(f"watch the video carefully, then pick up the same cube that was previously picked up twice, and finally press the button to stop")
|
| 167 |
+
language_goals.append(f"watch the video carefully, identify the cube that was picked up, then pick up and place down the same cube twice, finally press the button to stop")
|
| 168 |
+
else:
|
| 169 |
+
language_goals.append(f"watch the video carefully, then pick up the same cube that was previously picked up {word} times, and finally press the button to stop")
|
| 170 |
+
language_goals.append(f"watch the video carefully, identify the cube that was picked up, then pick up and place down the same cube {word} times, finally press the button to stop")
|
| 171 |
+
|
| 172 |
else:
|
| 173 |
+
language_goals.append(f'watch the video carefully, then pick up the same block that was previously picked up again, finally put it down and press the button to stop')
|
| 174 |
+
language_goals.append(f"watch the video carefully, then pick up the same cube that was previously picked up again, finally press the button to stop")
|
| 175 |
|
| 176 |
elif env == "StopCube":
|
| 177 |
repeats = getattr(self.env.unwrapped, "stop_time", 1)
|
| 178 |
word = num2words_2.get(repeats, str(repeats))
|
| 179 |
+
language_goals.append(f"press the button to stop the cube just as it reaches the target for the {word} time")
|
| 180 |
+
language_goals.append(f"press the button to stop the cube exactly at the target on its {word} visit")
|
| 181 |
|
| 182 |
elif env == "InsertPeg":
|
| 183 |
+
language_goals.append(f"watch the video carefully, then grasp the same end of the same peg you've picked before and insert it into the same side of the box")
|
| 184 |
+
language_goals.append(f"watch the video carefully, then grasp the same peg at the same end and insert it into the same side of the box as in the video")
|
| 185 |
|
| 186 |
elif env == "MoveCube":
|
| 187 |
+
language_goals.append(f"watch the video carefully, then move the cube to the target in the same manner as before")
|
| 188 |
+
language_goals.append(f"watch the video carefully, then move the cube to the target in the same manner shown in the video")
|
| 189 |
|
| 190 |
elif env == "PatternLock":
|
| 191 |
+
language_goals.append(f"watch the video carefully, then use the stick attached to the robot to retrace the same pattern")
|
| 192 |
+
language_goals.append(f"watch the video carefully, then use the stick attached to the robot to retrace the same pattern shown in the video")
|
| 193 |
|
| 194 |
elif env == "RouteStick":
|
| 195 |
+
language_goals.append(f"watch the video carefully, then use the stick attached to the robot to navigate around the sticks on the table, following the same path")
|
| 196 |
+
language_goals.append(f"watch the video carefully, then use the stick attached to the robot to navigate around the sticks on the table, following the same path shown in the video")
|
| 197 |
+
|
| 198 |
+
return language_goals
|
|
|
|
|
|
|
|
|
|
|
|