1 from __future__
import print_function
3 female_names = [
"amelia",
"angel",
"ava",
"charlie",
"charlotte",
"hunter",
"max",
"mia",
"olivia",
"parker",
"sam"]
4 male_names = [
"angel",
"charlie",
"hunter",
"jack",
"max",
"noah",
"oliver",
"parker",
"sam",
"thomas",
"william"]
5 names = female_names + male_names
8 {
"name":
"house_plant",
"room":
"living_room",
"manipulation":
False},
9 {
"name":
"coat_rack",
"room":
"living_room",
"manipulation":
False},
10 {
"name":
"sofa",
"room":
"living_room",
"manipulation":
False},
11 {
"name":
"couch_table",
"room":
"living_room",
"manipulation":
True},
12 {
"name":
"tv",
"room":
"living_room",
"manipulation":
False},
13 {
"name":
"side_table",
"room":
"living_room",
"manipulation":
True},
14 {
"name":
"book_shelf",
"room":
"living_room",
"manipulation":
True},
15 {
"name":
"kitchen_shelf",
"room":
"kitchen",
"manipulation":
True},
16 {
"name":
"pantry",
"room":
"kitchen",
"manipulation":
True},
17 {
"name":
"dinner_table",
"room":
"kitchen",
"manipulation":
True},
18 {
"name":
"kitchen_bin",
"room":
"kitchen",
"manipulation":
True},
19 {
"name":
"fridge",
"room":
"kitchen",
"manipulation":
True},
20 {
"name":
"washing_machine",
"room":
"kitchen",
"manipulation":
True},
21 {
"name":
"sink",
"room":
"kitchen",
"manipulation":
False},
22 {
"name":
"small_shelf",
"room":
"bedroom",
"manipulation":
True},
23 {
"name":
"cupboard",
"room":
"bedroom",
"manipulation":
True},
24 {
"name":
"big_shelf",
"room":
"bedroom",
"manipulation":
True},
25 {
"name":
"bed",
"room":
"bedroom",
"manipulation":
False},
26 {
"name":
"desk",
"room":
"office",
"manipulation":
True},
27 {
"name":
"show_rack",
"room":
"office",
"manipulation":
False},
28 {
"name":
"bin",
"room":
"office",
"manipulation":
False},
29 {
"name":
"office_shelf",
"room":
"office",
"manipulation":
True},
32 location_rooms = list(set([o[
"room"]
for o
in locations]))
33 rooms = location_rooms
34 location_names = list(set([o[
"name"]
for o
in locations]))
35 manipulation_locations = list(set([o[
"name"]
for o
in locations
if o[
"manipulation"]]))
38 {
'name':
'water',
'category':
'drink'},
39 {
'name':
'milk',
'category':
'drink'},
40 {
'name':
'coke',
'category':
'drink'},
41 {
'name':
'tonic',
'category':
'drink'},
42 {
'name':
'bubble_tea',
'category':
'drink'},
43 {
'name':
'ice_tea',
'category':
'drink'},
44 {
'name':
'cloth',
'category':
'cleaning_supply'},
45 {
'name':
'sponge',
'category':
'cleaning_supply'},
46 {
'name':
'cleaner',
'category':
'cleaning_supply'},
47 {
'name':
'corn_flakes',
'category':
'pantry_item'},
48 {
'name':
'tuna_can',
'category':
'pantry_item'},
49 {
'name':
'coffee_jar',
'category':
'pantry_item'},
50 {
'name':
'sugar',
'category':
'pantry_item'},
51 {
'name':
'mustard',
'category':
'pantry_item'},
52 {
'name':
'apple',
'category':
'fruit'},
53 {
'name':
'peach',
'category':
'fruit'},
54 {
'name':
'orange',
'category':
'fruit'},
55 {
'name':
'banana',
'category':
'fruit'},
56 {
'name':
'strawberry',
'category':
'fruit'},
57 {
'name':
'pockys',
'category':
'snack'},
58 {
'name':
'pringles',
'category':
'snack'},
59 {
'name':
'spoon',
'category':
'cutlery'},
60 {
'name':
'fork',
'category':
'cutlery'},
61 {
'name':
'plate',
'category':
'cutlery'},
62 {
'name':
'bowl',
'category':
'cutlery'},
63 {
'name':
'mug',
'category':
'cutlery'},
64 {
'name':
'knife',
'category':
'cutlery'},
67 object_names = list(set([o[
"name"]
for o
in objects]))
68 object_categories = list(set([o[
"category"]
for o
in objects]))
70 category_locations = {
71 "fruit": {
"couch_table":
"on_top_of"},
72 "drink": {
"side_table":
"on_top_of"},
73 "pantry_item": {
"pantry":
"on_top_of"},
74 "cutlery": {
"dinner_table":
"on_top_of"},
75 "cleaning_supply": {
"small_shelf":
"on_top_of"},
76 "snack": {
"desk":
"on_top_of"}
80 "kitchen_shelf": [
"shelf2_r",
"shelf3_r",
"shelf4_r"],
92 'shelf3_r':
'in_front_of_r',
93 'shelf4_r':
'in_front_of_r',
99 drink_spec =
"T['drink': O] -> OPTIONS[O]\n\n"
100 for drink
in [obj[
"name"]
for obj
in objects
if obj[
"category"] ==
"drink"]:
101 drink_spec +=
"OPTIONS['{drink}'] -> {drink}\n".format(drink=drink)
105 for loc
in locations:
106 if loc[
"name"] == location:
112 for loc
in locations:
113 if loc[
"name"] == location:
119 return (entity_id
in rooms)
123 if location
in inspect_areas:
124 return inspect_areas[location]
130 if location
in inspect_positions
and area
in inspect_positions[location]:
131 return inspect_positions[location][area]
137 for loc
in locations:
138 if loc[
"name"] == location
and loc[
"manipulation"] ==
"yes":
144 for loc
in locations:
145 if loc[
"name"] == location
and (loc[
"manipulation"] ==
"yes" or loc[
"manipulation"] ==
"only_putting"):
150 def get_locations(room=None, pick_location=None, place_location=None):
151 return [loc[
"name"]
for loc
in locations
152 if (room ==
None or loc[
"room"] == room)
and \
153 (pick_location ==
None or pick_location ==
is_pick_location(loc[
"name"]))
and \
165 return [obj[
"name"]
for obj
in objects
166 if category ==
None or category == obj[
"category"]]
195 location, area_name = next(iter(category_locations[obj_cat].items()))
196 return location, area_name