3 from __future__
import print_function
5 female_names = [
"angie",
"mary",
"amy",
"kimberley",
"lisa",
"melissa",
"michelle",
"jennifer",
"elizabeth",
"julie"]
6 male_names = [
"brian",
"michael",
"christopher",
"william",
"john",
"david",
"james",
"robert",
"scott",
"richard"]
7 names = female_names + male_names
12 {
'name':
'bed',
'room':
'bedroom',
'category':
'beacon',
'manipulation':
'no'},
13 {
'name':
'desk',
'room':
'bedroom',
'category':
'shelf',
'manipulation':
'yes'},
14 {
'name':
'bookcase',
'room':
'bedroom',
'category':
'shelf',
'manipulation':
'yes'},
15 {
'name':
'side_table',
'room':
'bedroom',
'category':
'table',
'manipulation':
'yes'},
17 {
'name':
'bar',
'room':
'kitchen',
'category':
'bar',
'manipulation':
'yes'},
18 {
'name':
'kitchen_table',
'room':
'kitchen',
'category':
'table',
'manipulation':
'yes'},
19 {
'name':
'kitchen_cabinet',
'room':
'kitchen',
'category':
'table',
'manipulation':
'yes'},
20 {
'name':
'sink',
'room':
'kitchen',
'category':
'table',
'manipulation':
'no'},
22 {
'name':
'tv_table',
'room':
'living_room',
'category':
'table',
'manipulation':
'yes'},
23 {
'name':
'cupboard',
'room':
'living_room',
'category':
'shelf',
'manipulation':
'yes'},
24 {
'name':
'couch',
'room':
'living_room',
'category':
'seat',
'manipulation':
'yes'},
25 {
'name':
'couch_table',
'room':
'living_room',
'category':
'beacon',
'manipulation':
'yes'},
27 {
'name':
'dining_table',
'room':
'dining_room',
'category':
'beacon',
'manipulation':
'yes'},
28 {
'name':
'cabinet',
'room':
'dining_room',
'category':
'shelf',
'manipulation':
'yes'},
29 {
'name':
'display_case',
'room':
'dining_room',
'category':
'table',
'manipulation':
'no'},
30 {
'name':
'storage_shelf',
'room':
'dining_room',
'category':
'shelf',
'manipulation':
'yes'}
34 location_rooms = list(set([ o[
"room"]
for o
in locations ]))
35 location_categories = list(set([ o[
"category"]
for o
in locations ]))
36 location_names = list(set([ o[
"name"]
for o
in locations ]))
37 manipulation_locations = list(set([ o[
"name"]
for o
in locations
if o[
"manipulation"] ==
"yes" ]))
39 rooms = location_rooms + [
"workshop"]
42 {
'category':
'care',
'name':
'shower_gel',
'color':
'pink'},
43 {
'category':
'care',
'name':
'soap',
'color':
'white'},
44 {
'category':
'care',
'name':
'toothpaste',
'color':
'green'},
45 {
'category':
'cleaning_stuff',
'name':
'sponge',
'color':
'yellow'},
46 {
'category':
'cleaning_stuff',
'name':
'wiper',
'color':
'yellow'},
47 {
'category':
'container',
'name':
'box',
'color':
'yellow'},
48 {
'category':
'container',
'name':
'tray',
'color':
'white'},
49 {
'category':
'drinks',
'name':
'beer',
'color':
'yellow'},
50 {
'category':
'drinks',
'name':
'cacao',
'color':
'brown'},
51 {
'category':
'drinks',
'name':
'coke',
'color':
'red'},
52 {
'category':
'drinks',
'name':
'malz',
'color':
'brown'},
53 {
'category':
'drinks',
'name':
'mixdrink',
'color':
'brown'},
54 {
'category':
'drinks',
'name':
'orange_juice',
'color':
'orange'},
55 {
'category':
'drinks',
'name':
'peppermint_tea',
'color':
'green'},
56 {
'category':
'drinks',
'name':
'water',
'color':
'transparent'},
57 {
'category':
'snacks',
'name':
'cookies',
'color':
'blue'},
58 {
'category':
'snacks',
'name':
'fruit_bar',
'color':
'green'},
59 {
'category':
'snacks',
'name':
'kinder',
'color':
'white'},
60 {
'category':
'snacks',
'name':
'nuts',
'color':
'yellow'},
61 {
'category':
'food',
'name':
'apple',
'color':
'green'},
62 {
'category':
'food',
'name':
'green_paprika',
'color':
'green'},
63 {
'category':
'food',
'name':
'kiwi',
'color':
'brown'},
64 {
'category':
'food',
'name':
'lemon',
'color':
'yellow'},
65 {
'category':
'food',
'name':
'noodles',
'color':
'yellow'},
66 {
'category':
'food',
'name':
'pepper',
'color':
'brown'},
67 {
'category':
'food',
'name':
'salt',
'color':
'salt'},
68 {
'category':
'food',
'name':
'tomato',
'color':
'red'},
69 {
'category':
'kitchen_stuff',
'name':
'fork',
'color':
'green'},
70 {
'category':
'kitchen_stuff',
'name':
'spoon',
'color':
'green'},
71 {
'category':
'kitchen_stuff',
'name':
'knife',
'color':
'green'},
72 {
'category':
'kitchen_stuff',
'name':
'plate',
'color':
'green'},
73 {
'category':
'kitchen_stuff',
'name':
'cup',
'color':
'green'}
81 object_names = list(set([ o[
"name"]
for o
in objects ]))
82 object_categories = list(set([ o[
"category"]
for o
in objects ]))
83 object_color = list(set([ o[
"color"]
for o
in objects ]))
87 category_locations = {
89 "care": {
"bookcase":
"shelf2"},
90 "container": {
"cupboard":
"on_top_off"},
91 "drinks": {
"kitchen_table":
"on_top_of"},
92 "snacks": {
"couch_table":
"on_top_of"},
93 "food": {
"cabinet":
"shelf2"},
94 "cleaning_stuff": {
"kitchen_cabinet":
"on_top_of"},
95 "kitchen_stuff" : {
"kitchen_table":
"on_top_of"}
100 "cabinet": [
"shelf2",
"shelf3",
"shelf4"],
101 "display_case": [
"shelf2",
"shelf3",
"shelf4"],
102 "storage_shelf": [
"shelf2",
"shelf3",
"shelf4"],
103 "bookcase": [
"shelf2",
"shelf3",
"shelf4"]
106 inspect_positions = {
111 ''' colors from printing on screen '''
120 UNDERLINE =
'\033[4m'
124 General function for printing shortcuts
125 name: name of the program that instantiates make_prints
126 sentence: sentence to be displayed
128 Ex: "[<EXECUTIVE NAME>] <SENTENCE TO BE DISPLAYED>"
134 prefix = bcolors.HEADER + name + bcolors.ENDC
136 print(prefix + bcolors.OKBLUE + sentence + bcolors.ENDC)
139 print(prefix + bcolors.FAIL + sentence + bcolors.ENDC)
142 print(prefix + bcolors.WARNING + sentence + bcolors.ENDC)
144 return printOk, printError, printWarning
149 for loc
in locations:
150 if loc[
"name"] == location:
156 for loc
in locations:
157 if loc[
"name"] == location:
163 return (entity_id
in rooms)
167 if location
in inspect_areas:
168 return inspect_areas[location]
174 if location
in inspect_positions
and area
in inspect_positions[location]:
175 return inspect_positions[location][area]
181 for loc
in locations:
182 if loc[
"name"] == location
and loc[
"manipulation"] ==
"yes":
188 for loc
in locations:
189 if loc[
"name"] == location
and (loc[
"manipulation"] ==
"yes" or loc[
"manipulation"] ==
"only_putting"):
194 def get_locations(room=None, pick_location=None, place_location=None):
195 return [loc[
"name"]
for loc
in locations
196 if (room ==
None or loc[
"room"] == room)
and \
197 (pick_location ==
None or pick_location ==
is_pick_location(loc[
"name"]))
and \
202 return [obj[
"name"]
for obj
in objects
203 if category ==
None or category == obj[
"category"]]
220 location, area_name = next(iter(category_locations[obj_cat].items()))
221 return location, area_name
226 if __name__ ==
"__main__":
227 print(
"\n-----------------------------------------------------------------------------")
231 print(
"object '{}'".format(obj))
232 print(
" category: '{}'".format(cat))
233 print(
" found '{} {}'".format(area_name, location))
235 print(
"\n-----------------------------------------------------------------------------")
237 print(
"location '{}', room: '{}'".format(loc,
get_room(loc)))
239 print(
"\n-----------------------------------------------------------------------------")
240 print(
"Pick locations:")
242 print(
" {}".format(loc))
244 print(
"\n-----------------------------------------------------------------------------")
245 print(
"Place locations:")
247 print(
" {}".format(loc))
249 print(
"\n-----------------------------------------------------------------------------")
250 print(
"None-manipulation locations:")
251 for loc
in get_locations(pick_location=
False, place_location=
False):
252 print(
" {}".format(loc))