3 from __future__
import print_function
5 female_names = [
"Emma",
"Olivia",
"Sophia",
"Isabella",
"Ava",
"Mia",
"Emily",
"Abigail",
"Madison",
"Charlotte"]
6 male_names = [
"Noah",
"Liam",
"Mason",
"Jacob",
"William",
"Ethan",
"Michael",
"Alexander",
"James",
"Daniel"]
8 names = female_names + male_names
11 {
"name":
"apple",
"category":
"food"},
12 {
"name":
"avocado",
"category":
"food"},
13 {
"name":
"bowl",
"category":
"container"},
14 {
"name":
"chocolate_sprinkles",
"category":
"food"},
15 {
"name":
"cloth",
"category":
"cleaning_stuff"},
16 {
"name":
"dishwashing_soap",
"category":
"cleaning_stuff"},
17 {
"name":
"kinder_coke",
"category":
"drink"},
18 {
"name":
"lemon",
"category":
"food"},
19 {
"name":
"licorice",
"category":
"candy"},
20 {
"name":
"little_bananas",
"category":
"candy"},
21 {
"name":
"macaroni",
"category":
"food"},
22 {
"name":
"milk",
"category":
"drink"},
23 {
"name":
"paprika",
"category":
"food"},
24 {
"name":
"pineapple_cookies",
"category":
"candy"},
25 {
"name":
"plate",
"category":
"container"},
26 {
"name":
"rice",
"category":
"food"},
27 {
"name":
"smoothie",
"category":
"drink"},
28 {
"name":
"soap",
"category":
"cleaning_stuff"},
29 {
"name":
"sponge",
"category":
"cleaning_stuff"},
30 {
"name":
"storage_box",
"category":
"container"},
31 {
"name":
"strawberry_cookies",
"category":
"candy"},
32 {
"name":
"tea",
"category":
"drink"},
33 {
"name":
"toilet_paper",
"category":
"cleaning_stuff"},
34 {
"name":
"tuc",
"category":
"candy"},
35 {
"name":
"wafer",
"category":
"candy"},
36 {
"name":
"water",
"category":
"drink"}
39 object_names = list(set([o[
"name"]
for o
in objects]))
40 object_categories = list(set([o[
"category"]
for o
in objects]))
44 return list(set([o[
"name"]
for o
in objects
if o[
"category"] == category]))
49 {
"name":
"closet",
"room":
"bedroom",
"location_category":
"shelf",
"manipulation":
"yes"},
50 {
"name":
"nightstand",
"room":
"bedroom",
"location_category":
"table",
"manipulation":
"yes"},
51 {
"name":
"bed",
"room":
"bedroom",
"location_category":
"seat",
"manipulation":
"yes"},
52 {
"name":
"fridge",
"room":
"kitchen",
"location_category":
"appliance",
"manipulation":
"no"},
53 {
"name":
"kitchen_trashbin",
"room":
"kitchen",
"location_category":
"bin",
"manipulation":
"only_putting"},
54 {
"name":
"kitchencounter",
"room":
"kitchen",
"location_category":
"table",
"manipulation":
"yes"},
55 {
"name":
"sink",
"room":
"kitchen",
"location_category":
"appliance",
"manipulation":
"only_putting"},
56 {
"name":
"hallway_trashbin",
"room":
"kitchen",
"location_category":
"bin",
"manipulation":
"only_putting"},
57 {
"name":
"sideboard",
"room":
"livingroom",
"location_category":
"shelf",
"manipulation":
"yes"},
58 {
"name":
"dinnerchairs",
"room":
"livingroom",
"location_category":
"seat",
"manipulation":
"no"},
59 {
"name":
"dinnertable",
"room":
"livingroom",
"location_category":
"table",
"manipulation":
"yes"},
60 {
"name":
"bookcase",
"room":
"livingroom",
"location_category":
"shelf",
"manipulation":
"yes"},
61 {
"name":
"couch",
"room":
"livingroom",
"location_category":
"seat",
"manipulation":
"yes"},
62 {
"name":
"tv_stand",
"room":
"livingroom",
"location_category":
"shelf",
"manipulation":
"yes"}
65 rooms = list(set([o[
"room"]
for o
in locations]))
66 grab_locations = list(set([o[
"name"]
for o
in locations
if o[
"manipulation"] ==
"yes"]))
67 put_locations = list(set([o[
"name"]
for o
in locations
if o[
"manipulation"] !=
"no"]))
69 category_locations = {
70 "cleaning_stuff": {
"closet":
"on_top_of"},
71 "food": {
"kitchencounter":
"left_of_sink"},
72 "drink": {
"kitchencounter":
"right_of_sink"},
73 "candy": {
"sideboard":
"on_top_of"},
74 "container": {
"dinnertable":
"on_top_of"}
78 "closet" : [
"on_top_of"],
79 "bookcase" : [
"shelf1",
"shelf2",
"shelf3",
"shelf4"],
80 "dinnertable" : [
"on_top_of"],
81 "kitchencounter" : [
"right_of_sink",
"left_of_sink"],
82 "sideboard" : [
"on_top_of_left",
"on_top_of_right"],
83 "tv_stand" : [
"on_top_of_left",
"on_top_of_right"]
89 "right_of_sink" :
"in_front_of_right_sink",
90 "left_of_sink" :
"in_front_of_left_sink"
98 if loc[
"name"] == location:
103 for loc
in locations:
104 if loc[
"name"] == location:
109 if location
in inspect_areas:
110 return inspect_areas[location]
115 if location
in inspect_positions
and area
in inspect_positions[location]:
116 return inspect_positions[location][area]
121 for loc
in locations:
122 if loc[
"name"] == location
and loc[
"manipulation"] ==
"yes":
127 for loc
in locations:
128 if loc[
"name"] == location
and (loc[
"manipulation"] ==
"yes" or loc[
"manipulation"] ==
"only_putting"):
132 def get_locations(room=None, pick_location=None, place_location=None):
133 return [loc[
"name"]
for loc
in locations
134 if (room ==
None or loc[
"room"] == room)
and \
139 return [obj[
"name"]
for obj
in objects
140 if category ==
None or category == obj[
"category"]]
150 location, area_name = next(iter(category_locations[obj_cat].items()))
151 return location, area_name
156 if __name__ ==
"__main__":
157 print(
"\n-----------------------------------------------------------------------------")
161 print(
"object '{}'".format(obj))
162 print(
" category: '{}'".format(cat))
163 print(
" found '{} {}'".format(area_name, location))
165 print(
"\n-----------------------------------------------------------------------------")
167 print(
"location '{}', room: '{}'".format(loc,
get_room(loc)))
169 print(
"\n-----------------------------------------------------------------------------")
170 print(
"Pick locations:")
172 print(
" {}".format(loc))
174 print(
"\n-----------------------------------------------------------------------------")
175 print(
"Place locations:")
177 print(
" {}".format(loc))
179 print(
"\n-----------------------------------------------------------------------------")
180 print(
"None-manipulation locations:")
181 for loc
in get_locations(pick_location=
False, place_location=
False):
182 print(
" {}".format(loc))