File size: 11,843 Bytes
06c11b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597756d
 
06c11b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597756d
 
06c11b0
597756d
 
06c11b0
597756d
 
06c11b0
597756d
 
06c11b0
 
 
 
 
 
597756d
 
06c11b0
597756d
06c11b0
 
 
 
 
 
597756d
 
06c11b0
597756d
 
06c11b0
 
 
 
 
 
597756d
06c11b0
597756d
06c11b0
 
 
 
 
 
597756d
06c11b0
597756d
06c11b0
 
 
 
 
 
597756d
06c11b0
597756d
06c11b0
 
 
 
 
 
597756d
06c11b0
597756d
06c11b0
 
 
 
597756d
 
 
 
 
 
 
 
 
 
06c11b0
 
 
 
 
597756d
 
06c11b0
 
597756d
 
06c11b0
 
 
 
 
597756d
 
 
 
 
 
 
 
 
06c11b0
597756d
 
06c11b0
 
 
 
597756d
 
06c11b0
 
597756d
 
06c11b0
 
597756d
 
06c11b0
 
597756d
 
06c11b0
 
597756d
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
num2words = {
    1: "one",
    2: "two",
    3: "three",
    4: "four",
    5: "five",
    6: "six",
    7: "seven",
    8: "eight",
    9: "nine",
    10: "ten",
    11: "eleven",
    12: "twelve",
    13: "thirteen",
    14: "fourteen",
    15: "fifteen",
    16: "sixteen",
    17: "seventeen",
    18: "eighteen",
    19: "nineteen",
    20: "twenty"
}

num2words_2 = {
    1: "first",
    2: "second",
    3: "third",
    4: "fourth",
    5: "fifth",
    6: "sixth",
    7: "seventh",
    8: "eighth",
    9: "ninth",
    10: "tenth",
    11: "eleventh",
    12: "twelfth",
    13: "thirteenth",
    14: "fourteenth",
    15: "fifteenth",
    16: "sixteenth",
    17: "seventeenth",
    18: "eighteenth",
    19: "nineteenth",
    20: "twentieth"
}

def get_language_goal(self, env):
    language_goals = []
    
    if env == "BinFill":
        color_counts = {
            "red": getattr(self.env.unwrapped, "red_cubes_target_number", 0),
            "blue": getattr(self.env.unwrapped, "blue_cubes_target_number", 0),
            "green": getattr(self.env.unwrapped, "green_cubes_target_number", 0),
        }
        phrases = []
        for color, count in color_counts.items():
            if count <= 0:
                continue
            word = num2words.get(count, str(count))
            noun = "cube" if count == 1 else "cubes"
            phrases.append(f"{word} {color} {noun}")

        if not phrases:
            language_goals.append("put the cubes into the bin, then press the button to stop")
            language_goals.append("put the cubes into the bin and press the button to stop")
        elif len(phrases) == 1:
            language_goals.append(f"put {phrases[0]} into the bin, then press the button to stop")
            language_goals.append(f"put {phrases[0]} into the bin and press the button to stop")
        elif len(phrases) == 2:
            language_goals.append(f"put {phrases[0]} and {phrases[1]} into the bin, then press the button to stop")
            language_goals.append(f"put {phrases[0]} and {phrases[1]} into the bin and press the button to stop")
        else:
            language_goals.append(f"put {', '.join(phrases[:-1])} and {phrases[-1]} into the bin, then press the button to stop")
            language_goals.append(f"put {', '.join(phrases[:-1])} and {phrases[-1]} into the bin and press the button to stop")

    elif env == "PickXtimes":
        repeats = getattr(self.env.unwrapped, "num_repeats", 1)
        target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
        if repeats > 1:
            word = num2words.get(repeats, str(repeats))
            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")
            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")
        else:
            language_goals.append(f"pick up the {target_color} cube and place it on the target, then press the button to stop")

    elif env == "SwingXtimes":
        repeats = getattr(self.env.unwrapped, "num_repeats", 1)
        target_color = getattr(self.env.unwrapped, "target_color_name", "unknown")
        if repeats > 1:
            word = num2words.get(repeats, str(repeats))
            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")
            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")
        else:
            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")
            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")

    elif env == "VideoUnmask":
        color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
        cube_0_color = color_names[0]
        cube_1_color = color_names[1]
        if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
            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")
        else:
            language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube")

    elif env == "VideoUnmaskSwap":
        color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
        cube_0_color = color_names[0]
        cube_1_color = color_names[1]
        if self.pick_times == 2:
            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")
        else:
            language_goals.append(f"watch the video carefully, then pick up the container hiding the {cube_0_color} cube")

    elif env == "ButtonUnmask":
        color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
        cube_0_color = color_names[0]
        cube_1_color = color_names[1]
        if self.env.unwrapped.configs[self.difficulty]['pick'] > 1:
            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")
        else:
            language_goals.append(f"first press the button, then pick up the container hiding the {cube_0_color} cube")

    elif env == "ButtonUnmaskSwap":
        color_names = getattr(self.env.unwrapped, "color_names", ["unknown", "unknown", "unknown"])
        cube_0_color = color_names[0]
        cube_1_color = color_names[1]
        if self.pick_times == 2:
            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")
        else:
            language_goals.append(f"first press both buttons on the table, then pick up the container hiding the {cube_0_color} cube")

    elif env == "VideoPlaceButton":
        target_color_name = self.target_color_name
        target_target_language = self.target_target_language
        
        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")
        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")
        
        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")
        if target_target_language == "before":
            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")
        else:
            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")
        

    elif env == "VideoPlaceOrder":
        target_color_name = self.target_color_name
        which_in_subset = self.which_in_subset
        num = num2words_2.get(which_in_subset, str(which_in_subset))
        language_goals.append(f"watch the video carefully, then place the {target_color_name} cube on the {num} target it was previously placed on")
        language_goals.append(f"watch the video carefully and place the {target_color_name} cube on the {num} target where it was placed")

    elif env == 'PickHighlight':
        language_goals.append(f"first press the button, then pick up all cubes that have been highlighteted with white areas on the table")
        language_goals.append(f"first press the button, then pick up all highlighted cubes, finally press the button again to stop")

    elif env == "VideoRepick":
        num_repeats = self.num_repeats
        if num_repeats > 1:
            word = num2words.get(num_repeats, str(num_repeats))
            
            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')
            if word == "two":
                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")
                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")
            else:
                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")
                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")
            
        else:
            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')
            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")

    elif env == "StopCube":
        repeats = getattr(self.env.unwrapped, "stop_time", 1)
        word = num2words_2.get(repeats, str(repeats))
        language_goals.append(f"press the button to stop the cube just as it reaches the target for the {word} time")
        language_goals.append(f"press the button to stop the cube exactly at the target on its {word} visit")

    elif env == "InsertPeg":
        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")
        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")

    elif env == "MoveCube":
        language_goals.append(f"watch the video carefully, then move the cube to the target in the same manner as before")
        language_goals.append(f"watch the video carefully, then move the cube to the target in the same manner shown in the video")

    elif env == "PatternLock":
        language_goals.append(f"watch the video carefully, then use the stick attached to the robot to retrace the same pattern")
        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")

    elif env == "RouteStick":
        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") 
        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")

    return language_goals