robocup_knowledge
siza_demo/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 for place in common.location_names:
54  grammar += '\n PLACEMENTS_AND_BEACONS[%s] -> %s' % (place, place)
55 
56 
61 
62 grammar += '''
63 Q["action" : "answer", "solution": "Magdeburg"] -> what city are we in
64 Q["action" : "answer", "solution": "Tech United"] -> what is the name of your team
65 Q["action" : "answer", "solution": "Chewbacca"] -> name the big hairy creature in star wars
66 Q["action" : "answer", "solution": "Isaac Asimov"] -> who wrote the three laws of robotics
67 Q["action" : "answer", "solution": "The Jetsons"] -> from what series do you know rosie the robot
68 Q["action" : "answer", "solution": "The Flintstones"] -> from what series do you know the baby bam bam
69 Q["action" : "answer", "solution": "Neo"] -> who is the main character of the matrix
70 Q["action" : "answer", "solution": "Peper and HSR"] -> name the two robocupathome standard platforms
71 Q["action" : "answer", "solution": "In my SSD"] -> where do you store your memories
72 Q["action" : "answer", "solution": "In Eindhoven The Netherlands"] -> where is your team located
73 
74 WHATWHICH -> what | which
75 
76 Q["action" : "answer", "solution": "basket"] -> WHATWHICH is the biggest object
77 Q["action" : "answer", "solution": "egg"] -> WHATWHICH is the smallest object
78 Q["action" : "answer", "solution": "pringles"] -> WHATWHICH is the biggest food
79 Q["action" : "answer", "solution": "egg"] -> WHATWHICH is the smallest food
80 Q["action" : "answer", "solution": "basket"] -> WHATWHICH is the biggest container
81 Q["action" : "answer", "solution": "coffecup"] -> WHATWHICH is the smallest container
82 Q["action" : "answer", "solution": "water"] -> WHATWHICH is the biggest drink
83 Q["action" : "answer", "solution": "orange drink"] -> WHATWHICH is the smallest drink
84 Q["action" : "answer", "solution": "paper"] -> WHATWHICH is the biggest cleaning stuff
85 Q["action" : "answer", "solution": "sponge"] -> WHATWHICH is the smallest cleaning stuff
86 Q["action" : "answer", "solution": "knife"] -> WHATWHICH is the biggest cutlery
87 Q["action" : "answer", "solution": "fork"] -> WHATWHICH is the smallest cutlery
88 
89 Q["action" : "answer", "solution": "the bedroom has two doors"] -> how many doors has the bedroom
90 Q["action" : "answer", "solution": "the living room has two doors"] -> how many doors has the livingroom
91 Q["action" : "answer", "solution": "the kitchen has one door"] -> how many doors has the kitchen
92 Q["action" : "answer", "solution": "in the workshop there are no doors"] -> how many doors has the workshop
93 '''
94 
95 
100 
101 grammar += '''
102 Q["action" : "count", "entity" : P] -> how many PEOPLE[P] are in the crowd | tell me the number of PEOPLE[P] in the crowd
103 '''
104 
105 
110 
111 grammar += '''
112 
113 NQ["action" : "c_count", "entity" : X] -> how many people in the crowd are POSITION[X]
114 NQ["action" : "c_count", "entity" : W] -> how many people in the crowd are GESTURE[W]
115 NQ["action" : "c_count", "entity" : L] -> tell me how many people were wearing COLOR[L]
116 NQ["action" : "random_gender", "entity" : X] -> the POSITION[X] person was GENDER | tell me if the POSITION[X] person was a GENDER
117 NQ["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
118 NQ["action" : "random_gender", "entity" : W] -> tell me if the GESTURE[W] person was a GENDER
119 NQ["action" : "random_gender", "entity" : W] -> tell me if the GESTURE[W] person was a GENDER or GENDER
120 '''
121 
122 
127 
128 grammar += '''
129 SEARCH -> where is | in WHATWHICH room is
130 
131 Q["action" : "find_placement", "entity" : Y] -> SEARCH the PLACEMENTS_AND_BEACONS[Y]
132 Q["action" : "count_placement", "entity" : Y, "location" : R] -> how many PLACEMENTS_AND_BEACONS[Y] are in the ROOMS[R]
133 '''
134 
135 
140 
141 grammar += '''
142 ADJR -> smaller | bigger
143 
144 Q["action" : "find_object", "entity" : O] -> where can i find DET OBJECT_NAMES[O]
145 Q["action" : "find_category", "entity" : C] -> where can i find DET OBJECT_CATEGORIES[C]
146 Q["action" : "return_category", "entity" : O] -> to WHATWHICH category belong the OBJECT_NAMES[O]
147 Q["action" : "return_color", "entity" : O] -> whats the color of the OBJECT_NAMES[O]
148 Q["action" : "compare_category", "entity_a" : O, "entity_b" : A] -> do the OBJECT_NAMES[O] and OBJECT_NAMES[A] belong to the same category
149 Q["action" : "count_object", "entity" : C] -> how many OBJECT_CATEGORIES[C] there are
150 
151 NQ["action" : "count_object", "entity" : C, "location" : Y] -> how many OBJECT_CATEGORIES[C] are in the PLACEMENTS_AND_BEACONS[Y]
152 NQ["action" : "count_object", "entity" : O, "location" : Y] -> how many OBJECT_NAMES[O] are in the PLACEMENTS_AND_BEACONS[Y]
153 NQ["action" : "category_at_loc", "location" : Y] -> what objects are stored in the PLACEMENTS_AND_BEACONS[Y]
154 
155 NQ["action" : "compare", "entity_a" : O, "entity_b" : A] -> between the OBJECT_NAMES[O] and OBJECT_NAMES[A] which one is ADJR
156 '''
157 
158 
163 
164 grammar += '''
165 
166 PEOPLE['people'] -> people
167 PEOPLE['children'] -> children
168 PEOPLE['adults'] -> adults
169 PEOPLE['elders'] -> elders
170 PEOPLE['males'] -> males
171 PEOPLE['females'] -> females
172 PEOPLE['men'] -> men
173 PEOPLE['women'] -> women
174 PEOPLE['boys'] -> boys
175 PEOPLE['girls'] -> girls
176 
177 GENDER['male'] -> male
178 GENDER['female'] -> female
179 GENDER['man'] -> man
180 GENDER['woman'] -> woman
181 GENDER['boy'] -> boy
182 GENDER['girl'] -> girl
183 
184 POSITION['standing'] -> standing
185 POSITION['sitting'] -> sitting
186 POSITION['lying'] -> lying
187 
188 GESTURE['waving'] -> waving
189 GESTURE['rise_l_arm'] -> rising left arm
190 GESTURE['rise_r_arm'] -> rising right arm
191 GESTURE['left'] -> pointing left
192 GESTURE['right'] -> pointing right
193 
194 COLOR['red'] -> red
195 COLOR['blue'] -> blue
196 COLOR['white'] -> white
197 COLOR['black'] -> black
198 COLOR['green'] -> green
199 COLOR['yellow'] -> yellow
200 '''
201 
202 if __name__ == "__main__":
203  print("\n\n{}\n\n".format(grammar))
common.get_locations
def get_locations(room=None, manipulation_location=None)
Definition: rwc2023/common.py:156