robocup_knowledge
rwc2017/challenge_spr.py
Go to the documentation of this file.
1 from __future__ import print_function
2 
3 from robocup_knowledge import knowledge_loader
4 common = knowledge_loader.load_knowledge("common")
5 
6 not_understood_sentences = [
7  "I'm so sorry! Can you please speak louder and slower? And wait for the ping!",
8  "I am deeply sorry. Please try again, but wait for the ping!",
9  "You and I have communication issues. Speak up!",
10  "All this noise is messing with my audio. Try again"
11  ]
12 grammar_target = "T"
13 
14 
19 
20 grammar = """
21 T[{actions : <A1>}] -> C[A1]
22 
23 C[{A}] -> Q[A]
24 """
25 
26 # Q questions are implemented already in the challenge.
27 # NQ questions are still not implemented, so the robot should not understand them. Future tasks! :)
28 
29 
34 
35 grammar += """
36 V_GUIDE -> guide | escort | take | lead | accompany
37 
38 DET -> the | a | an | some
39 MANIPULATION_AREA_DESCRIPTIONS -> on top of | at | in | on
40 """
41 
42 for room in common.location_rooms:
43  grammar += '\nROOMS[%s] -> %s' % (room, room)
44 for loc in common.get_locations():
45  grammar += '\nLOCATIONS[%s] -> %s' % (loc, loc)
46 grammar += '\n ROOMS_AND_LOCATIONS[X] -> ROOMS[X] | LOCATIONS[X]'
47 for obj in common.object_names:
48  grammar += '\nOBJECT_NAMES[%s] -> %s' % (obj, obj)
49 for loc in common.get_locations(pick_location=True, place_location=True):
50  grammar += '\nMANIPULATION_AREA_LOCATIONS[%s] -> MANIPULATION_AREA_DESCRIPTIONS the %s' % (loc, loc)
51 for cat in common.object_categories:
52  grammar += '\nOBJECT_CATEGORIES[%s] -> %s' % (cat, cat)
53 grammar += '\nOBJECT_CATEGORIES[objects] -> objects'
54 for place in common.location_names:
55  grammar += '\n PLACEMENTS_AND_BEACONS[%s] -> %s' % (place, place)
56 
57 
62 
63 grammar += '''
64 Q["action" : "answer", "solution": "Nagoya"] -> what city are we in
65 Q["action" : "answer", "solution": "Tech united"] -> what is the name of your team
66 Q["action" : "answer", "solution": "31"] -> how many teams participate in robocup at home this year
67 Q["action" : "answer", "solution": "Hillary Clinton"] -> who won the popular vote in the us election
68 Q["action" : "answer", "solution": "Mount Fuji"] -> what is the highest mountain in japan
69 Q["action" : "answer", "solution": "Pepper and HSR"] -> name the two robocup at home standard platforms
70 Q["action" : "answer", "solution": "Domestic Standard Platform League"] -> what does dspl stand for
71 Q["action" : "answer", "solution": "Social Standard Platform League"] -> what does sspl stand for
72 Q["action" : "answer", "solution": "SoftBank"] -> who did alphabet sell boston dynamics to
73 Q["action" : "answer", "solution": "over 410000 square metres"] -> nagoya has one of the largest train stations in the world. how large is it
74 Q["action" : "answer", "solution": "My team is located in Eindhoven"] -> where is your team located
75 Q["action" : "answer", "solution": "George Lucas"] -> who created star wars
76 Q["action" : "answer", "solution": "Sponge Bob Squarepants"] -> who lives in a pineapple under the sea
77 Q["action" : "answer", "solution": "the inventor of the first compiler"] -> who is grace hopper
78 Q["action" : "answer", "solution": "the inventor of the first compiler"] -> what invented grace hopper
79 
80 WHATWHICH -> what | which
81 
82 BIGGEST_ADJ -> biggest | heaviest
83 SMALLEST_ADJ -> smallest | lightest
84 
85 Q["action" : "answer", "solution": "bread"] -> WHATWHICH is the BIGGEST_ADJ object
86 Q["action" : "answer", "solution": "chopsticks"] -> WHATWHICH is the SMALLEST_ADJ object
87 Q["action" : "answer", "solution": "bread"] -> WHATWHICH is the BIGGEST_ADJ food
88 Q["action" : "answer", "solution": "onion"] -> WHATWHICH is the SMALLEST_ADJ food
89 Q["action" : "answer", "solution": "plate"] -> WHATWHICH is the BIGGEST_ADJ container
90 Q["action" : "answer", "solution": "soup_container"] -> WHATWHICH is the SMALLEST_ADJ container
91 Q["action" : "answer", "solution": "green_tea"] -> WHATWHICH is the BIGGEST_ADJ drink
92 Q["action" : "answer", "solution": "coke"] -> WHATWHICH is the SMALLEST_ADJ drink
93 Q["action" : "answer", "solution": "hair_spray"] -> WHATWHICH is the BIGGEST_ADJ cleaning stuff
94 Q["action" : "answer", "solution": "moisturizer"] -> WHATWHICH is the SMALLEST_ADJ cleaning stuff
95 Q["action" : "answer", "solution": "spoon"] -> WHATWHICH is the BIGGEST_ADJ cutlery
96 Q["action" : "answer", "solution": "chopsticks"] -> WHATWHICH is the SMALLEST_ADJ cutlery
97 
98 Q["action" : "answer", "solution": "the bedroom has one door"] -> how many doors has the bedroom
99 Q["action" : "answer", "solution": "the entrance has one door"] -> how many doors has the entrance
100 Q["action" : "answer", "solution": "the living room has one door"] -> how many doors has the living_room
101 Q["action" : "answer", "solution": "the kitchen has one door"] -> how many doors has the kitchen
102 Q["action" : "answer", "solution": "the corridor has zero doors"] -> how many doors has the corridor
103 Q["action" : "answer", "solution": "the balcony has zero doors"] -> how many doors has the balcony
104 '''
105 
106 
111 
112 grammar += '''
113 Q["action" : "count", "entity" : P] -> how many PEOPLE[P] are in the crowd | tell me the number of PEOPLE[P] in the crowd
114 '''
115 
116 
121 
122 grammar += '''
123 
124 Q["action" : "c_count", "entity" : X] -> how many people in the crowd are POSITION[X]
125 Q["action" : "c_count", "entity" : W] -> how many people in the crowd are GESTURE[W]
126 Q["action" : "random_gender", "entity" : X] -> the POSITION[X] person was GENDER | tell me if the POSITION[X] person was a GENDER
127 Q["action" : "random_gender", "entity" : X] -> the POSITION[X] person was GENDER or GENDER | tell me if the POSITION[X] person was a GENDER or GENDER | was the POSITION[X] person GENDER or GENDER
128 Q["action" : "random_gender", "entity" : W] -> tell me if the GESTURE[W] person was a GENDER
129 Q["action" : "random_gender", "entity" : W] -> tell me if the GESTURE[W] person was a GENDER or GENDER
130 Q["action" : "c_count", "entity" : L] -> tell me how many people were wearing COLOR[L]
131 '''
132 
133 
138 
139 grammar += '''
140 SEARCH -> where is | in WHATWHICH room is | where is located
141 
142 Q["action" : "find_placement", "entity" : Y] -> SEARCH the PLACEMENTS_AND_BEACONS[Y]
143 Q["action" : "find_placement", "entity" : Y] -> SEARCH the PLACEMENTS_AND_BEACONS[Y]
144 Q["action" : "count_placement", "entity" : Y, "location" : R] -> how many PLACEMENTS_AND_BEACONS[Y] are in the ROOMS[R]
145 Q["action" : "count_placement", "entity" : Y, "location" : R] -> how many OBJECT_CATEGORIES[Y] are in the ROOMS[R]
146 Q["action" : "count_placement", "entity" : Y, "location" : R] -> how many OBJECT_CATEGORIES[Y] are in the PLACEMENTS_AND_BEACONS[R]
147 '''
148 
149 
154 
155 grammar += '''
156 ADJR -> smaller | bigger | heavier | lighter
157 
158 Q["action" : "find_object", "entity" : O] -> where can i find DET OBJECT_NAMES[O]
159 Q["action" : "find_category", "entity" : C] -> where can i find DET OBJECT_CATEGORIES[C]
160 Q["action" : "return_category", "entity" : O] -> to WHATWHICH category belong the OBJECT_NAMES[O]
161 Q["action" : "return_color", "entity" : O] -> whats the color of the OBJECT_NAMES[O]
162 Q["action" : "compare_category", "entity_a" : O, "entity_b" : A] -> do the OBJECT_NAMES[O] and OBJECT_NAMES[A] belong to the same category
163 Q["action" : "count_object", "entity" : C] -> how many OBJECT_CATEGORIES[C] there are
164 
165 Q["action" : "count_object", "entity" : C, "location" : Y] -> how many OBJECT_CATEGORIES[C] are in the PLACEMENTS_AND_BEACONS[Y]
166 Q["action" : "count_object", "entity" : O, "location" : Y] -> how many OBJECT_NAMES[O] are in the PLACEMENTS_AND_BEACONS[Y]
167 Q["action" : "category_at_loc", "location" : Y] -> what objects are stored in the PLACEMENTS_AND_BEACONS[Y]
168 
169 Q["action" : "compare", "entity_a" : O, "entity_b" : A] -> between the OBJECT_NAMES[O] and OBJECT_NAMES[A] which one is ADJR
170 '''
171 
172 
177 
178 grammar += '''
179 
180 PEOPLE['people'] -> people
181 PEOPLE['children'] -> children
182 PEOPLE['adults'] -> adults
183 PEOPLE['elders'] -> elders
184 PEOPLE['males'] -> males
185 PEOPLE['females'] -> females
186 PEOPLE['men'] -> men
187 PEOPLE['women'] -> women
188 PEOPLE['boys'] -> boys
189 PEOPLE['girls'] -> girls
190 
191 GENDER -> male | female | man | woman | boy | girl
192 
193 POSITION['standing'] -> standing
194 POSITION['sitting'] -> sitting
195 POSITION['lying'] -> lying
196 
197 GESTURE['waving'] -> waving
198 GESTURE['rise_l_arm'] -> rising left arm
199 GESTURE['rise_r_arm'] -> rising right arm
200 GESTURE['left'] -> pointing left
201 GESTURE['right'] -> pointing right
202 
203 COLOR['red'] -> red
204 COLOR['blue'] -> blue
205 COLOR['white'] -> white
206 COLOR['black'] -> black
207 COLOR['green'] -> green
208 COLOR['yellow'] -> yellow
209 '''
210 
211 if __name__ == "__main__":
212  print("\n\n{}\n\n".format(grammar))
common.get_locations
def get_locations(room=None, manipulation_location=None)
Definition: rwc2023/common.py:156