3 from __future__
import print_function
5 female_names = [
"emma",
"olivia",
"sophia",
"ava",
"isabella",
"mia",
"abigail",
"emily",
"charlotte",
"harper"]
6 male_names = [
"noah",
"liam",
"mason",
"jacob",
"william",
"ethan",
"james",
"alexander",
"michael",
"benjamin"]
7 names = female_names + male_names
12 {
"name":
"desk",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
13 {
"name":
"left_rack",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
14 {
"name":
"right_rack",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
15 {
"name":
"sideboard",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"},
16 {
"name":
"kitchen_table",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"},
17 {
"name":
"little_desk",
"room":
"bedroom",
"category":
"ToDo",
"manipulation":
"yes"},
18 {
"name":
"teepee",
"room":
"bedroom",
"category":
"ToDo",
"manipulation":
"no"},
19 {
"name":
"bed",
"room":
"bedroom",
"category":
"ToDo",
"manipulation":
"yes"},
20 {
"name":
"entrance_shelf",
"room":
"entrance",
"category":
"ToDo",
"manipulation":
"yes"},
21 {
"name":
"kitchen_shelf",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"},
22 {
"name":
"bookcase",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
23 {
"name":
"sofa",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
24 {
"name":
"coffee_table",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"yes"},
25 {
"name":
"tv",
"room":
"living_room",
"category":
"ToDo",
"manipulation":
"no"},
26 {
"name":
"bistro_table",
"room":
"balcony",
"category":
"ToDo",
"manipulation":
"yes"},
27 {
"name":
"left_planks",
"room":
"balcony",
"category":
"ToDo",
"manipulation":
"yes"},
28 {
"name":
"right_planks",
"room":
"balcony",
"category":
"ToDo",
"manipulation":
"yes"},
29 {
"name":
"balcony_shelf",
"room":
"balcony",
"category":
"ToDo",
"manipulation":
"yes"},
30 {
"name":
"kitchen_counter",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"},
31 {
"name":
"fridge",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"},
32 {
"name":
"kitchen_rack",
"room":
"kitchen",
"category":
"ToDo",
"manipulation":
"yes"}
35 location_rooms = list(set([o[
"room"]
for o
in locations])) + [
'corridor']
36 location_categories = list(set([o[
"category"]
for o
in locations]))
37 location_names = list(set([o[
"name"]
for o
in locations]))
38 manipulation_locations = list(set([o[
"name"]
for o
in locations
if o[
"manipulation"] ==
"yes"]))
42 most_probable_location_in_room_map = {
43 "living_room" :
"desk",
44 "kitchen" :
"kitchen_table",
45 "bedroom" :
"little_desk",
46 "entrance" :
"entrance_shelf",
47 "balcony" :
"bistro_table"
52 if room_id
in most_probable_location_in_room_map:
53 return most_probable_location_in_room_map[room_id]
57 {
"name":
"curry",
"category":
"snack"},
58 {
"name":
"plate",
"category":
"container"},
59 {
"name":
"shampoo",
"category":
"cleaning_stuff"},
60 {
"name":
"green_tea",
"category":
"drink"},
61 {
"name":
"chewing_gum",
"category":
"snack"},
62 {
"name":
"chopsticks",
"category":
"cutlery"},
63 {
"name":
"soup_container",
"category":
"container"},
64 {
"name":
"aquarius",
"category":
"drink"},
65 {
"name":
"fries",
"category":
"snack"},
66 {
"name":
"bowl",
"category":
"container"},
67 {
"name":
"candy",
"category":
"snack"},
68 {
"name":
"asience",
"category":
"cleaning_stuff"},
69 {
"name":
"fork",
"category":
"cutlery"},
70 {
"name":
"spoon",
"category":
"cutlery"},
71 {
"name":
"hair_spray",
"category":
"cleaning_stuff"},
72 {
"name":
"radish",
"category":
"food"},
73 {
"name":
"apple",
"category":
"fruit"},
74 {
"name":
"cold_brew",
"category":
"drink"},
75 {
"name":
"onion",
"category":
"food"},
76 {
"name":
"corn",
"category":
"food"},
77 {
"name":
"jelly",
"category":
"snack"},
78 {
"name":
"bread",
"category":
"food"},
79 {
"name":
"cup_star",
"category":
"snack"},
80 {
"name":
"orange",
"category":
"fruit"},
81 {
"name":
"moisturizer",
"category":
"cleaning_stuff"},
82 {
"name":
"coke",
"category":
"drink"}
85 object_names = list(set([o[
"name"]
for o
in objects]))
86 object_categories = list(set([o[
"category"]
for o
in objects]))
88 category_locations = {
89 "container": {
"left_rack":
"on_top_of"},
90 "cleaning_stuff": {
"right_rack":
"on_top_of"},
91 "cutlery": {
"sideboard":
"on_top_of"},
92 "food": {
"kitchen_shelf":
"shelf3"},
93 "drink": {
"kitchen_counter":
"on_top_of"},
94 "snack": {
"kitchen_rack":
"shelf2"},
95 "fruit": {
"bistro_table":
"on_top_of"}
101 "kitchen_shelf": [
"shelf2",
"shelf3",
"shelf4",
"shelf5",
"shelf6"],
102 "balcony_shelf": [
"shelf2",
"shelf3",
"shelf4"],
103 "kitchen_rack": [
"shelf2",
"shelf3",
"shelf4"],
104 "kitchen_table": [
"on_top_of",
"on_top_of_back"],
105 "sideboard": [
"on_top_of",
"shelf1"],
106 "left_rack": [
"on_top_of",
"shelf3",
"shelf2"],
107 "right_rack": [
"on_top_of",
"shelf3",
"shelf2"],
108 "left_planks": [
"on_top_of"],
109 "right_planks": [
"on_top_of"]
112 inspect_positions = {
119 ''' colors from printing on screen '''
127 UNDERLINE =
'\033[4m'
131 General function for printing shortcuts
132 name: name of the progam that instanciates make_prints
133 sentence: sentence to be displayed
135 Ex: "[<EXECUTIVE NAME>] <SENTENCE TO BE DISPLAYED>"
141 prefix = bcolors.HEADER + name + bcolors.ENDC
143 print(prefix + bcolors.OKBLUE + sentence + bcolors.ENDC)
146 print(prefix + bcolors.FAIL + sentence + bcolors.ENDC)
149 print(prefix + bcolors.WARNING + sentence + bcolors.ENDC)
151 return printOk, printError, printWarning
157 for loc
in locations:
158 if loc[
"name"] == location:
164 if location
in location_rooms:
166 for loc
in locations:
167 if loc[
"name"] == location:
173 if location
in inspect_areas:
174 return inspect_areas[location]
180 if location
in inspect_positions
and area
in inspect_positions[location]:
181 return inspect_positions[location][area]
187 for loc
in locations:
188 if loc[
"name"] == location
and loc[
"manipulation"] ==
"yes":
194 for loc
in locations:
195 if loc[
"name"] == location
and (loc[
"manipulation"] ==
"yes" or loc[
"manipulation"] ==
"only_putting"):
200 def get_locations(room=None, pick_location=None, place_location=None):
201 return [loc[
"name"]
for loc
in locations
202 if (room ==
None or loc[
"room"] == room)
and \
203 (pick_location ==
None or pick_location ==
is_pick_location(loc[
"name"]))
and \
208 return [obj[
"name"]
for obj
in objects
209 if category ==
None or category == obj[
"category"]]
221 location, area_name = next(iter(category_locations[obj_cat].items()))
222 return location, area_name
227 if __name__ ==
"__main__":
228 print(
"\n-----------------------------------------------------------------------------")
232 print(
"object '{}'".format(obj))
233 print(
" category: '{}'".format(cat))
234 print(
" found '{} {}'".format(area_name, location))
236 print(
"\n-----------------------------------------------------------------------------")
238 print(
"location '{}', room: '{}'".format(loc,
get_room(loc)))
240 print(
"\n-----------------------------------------------------------------------------")
241 print(
"Pick locations:")
243 print(
" {}".format(loc))
245 print(
"\n-----------------------------------------------------------------------------")
246 print(
"Place locations:")
248 print(
" {}".format(loc))
250 print(
"\n-----------------------------------------------------------------------------")
251 print(
"None-manipulation locations:")
252 for loc
in get_locations(pick_location=
False, place_location=
False):
253 print(
" {}".format(loc))