Skip to content

Commit

Permalink
Merge pull request #837 from tue-robotics/rgo2019_rest
Browse files Browse the repository at this point in the history
Rgo2019 rest
  • Loading branch information
JosjaG committed Jun 4, 2019
2 parents 17afabd + 6b13d6b commit 0000279
Show file tree
Hide file tree
Showing 47 changed files with 1,494 additions and 376 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CLEAN UP KNOWLEDGE FILE RGO2019

from robocup_knowledge import knowledge_loader
common = knowledge_loader.load_knowledge("common")

"""
Local knowledge info needed:
The room to search has to have enough (way)points to cover the complete area.
This means waypoints on the floor, and known (furniture) object points.
Exact coordinates of the locations are in ed_object_models.
"""

initial_pose = "initial_pose"
starting_point = "cleanup_initial"

# required keys: entity_id (str), room_id (str), navigation_area (str), segment_areas (list)
# Trashbin and trashcan are not looking points, so must not be in the cleaning_locations list

cleaning_locations = [
{'name': 'sideboard', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'tv_table', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'left_armchair', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'coffee_table', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'couch', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'right_armchair', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'high_table', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'bookcase', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ["shelf1", "shelf2"]},
# {'name': 'trash_bin', 'room': 'living_room', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},

{'name': 'desk', 'room': 'bedroom', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'bed', 'room': 'bedroom', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'side_table', 'room': 'bedroom', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},

{'name': 'kitchen_cabinet', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'dishwasher', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'kitchen_table', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'cabinet', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'white_drawer', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
# {'name': 'trash_can', 'room': 'kitchen', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},

{'name': 'bar_table', 'room': 'bar', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'sofa', 'room': 'bar', 'navigate_area': 'near', 'segment_areas': ['on_top_of']},
{'name': 'cupboard', 'room': 'bar', 'navigate_area': 'near', 'segment_areas': ['shelf1', 'shelf2']}
]
grammar_target = "T"

grammar = "T -> kitchen"
grammar += "\nT -> living_room"
grammar += "\nT -> bedroom"
grammar += "\nT -> bar"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# RESTAURANT KNOWLEDGE FILE RGO2019

# TU/e Robotics
from robocup_knowledge import knowledge_loader

# Common knowledge
common = knowledge_loader.load_knowledge("common")

order_grammar = """
O[P] -> ORDER[P] | can i have a ORDER[P] | i would like ORDER[P] | can i get ORDER[P] | could i have ORDER[P] | may i get ORDER[P] | bring me ORDER[P]
ORDER[OO] -> COMBO[OO] | BEVERAGE[OO]
BEVERAGE[{"beverage": B}] -> BEV[B]
BEVERAGE[{"beverage": B}] -> DET BEV[B]
COMBO[{"food1": F1, "food2": F2}] -> FOOD[F1] and FOOD[F2] | FOOD[F1] with FOOD[F2]
COMBO[{"food1": F1, "food2": F2}] -> DET FOOD[F1] and FOOD[F2] | DET FOOD[F1] with FOOD[F2]
COMBO[{"food1": F1, "food2": F2}] -> FOOD[F1] and DET FOOD[F2] | FOOD[F1] with DET FOOD[F2]
COMBO[{"food1": F1, "food2": F2}] -> DET FOOD[F1] and DET FOOD[F2] | DET FOOD[F1] with DET FOOD[F2]
DET -> a | an
"""

# COMBO[{"food1": F1, "food2": F2}] -> DET FOOD[F1] and DET FOOD[F2] | DET FOOD[F1] with DET FOOD[F2]
# BEVERAGE[{"beverage": B}] -> DET BEV[B]

# Add drinks
for d in common.objects:
if d["category"] == "drink":
order_grammar += "\nBEV['{}'] -> {}[B]".format(d["name"], d["name"].replace('_', ' '))
elif d["category"] == "food" or d["category"] == "snack":
order_grammar += "\nFOOD['{}'] -> {}".format(d["name"], d["name"].replace('_', ' '))

if __name__ == "__main__":
import rospy
from robot_skills.api import Api
rospy.init_node('blaat')
a = Api("", None)
rospy.sleep(rospy.Duration(0.5))
while True:
result = a.query("blaat", order_grammar, "O")
import ipdb;ipdb.set_trace()
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SERVING DRINKS KNOWLEDGE FILE RGO2019

# Bar where the drinks are located
bar_id = "bar_table"

# Room where the party takes place, i.e., where the robot should look for people
room_id = "living_room"

# Default guest
operator_name = "default_guest"

# Starting location
starting_point = "serving_drinks_initial"

# Number of drinks to be served
NR_DRINKS = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TAKE OUT THE GARBAGE KNOWLEDGE FILE RGO2019

from robocup_knowledge import knowledge_loader

# Common knowledge
common = knowledge_loader.load_knowledge("common")

starting_point = "initial_pose"
trashbin_id = "trash_bin"
trashbin_id2 = "trash_can"
drop_zone_id = "drop_area"
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# RIPS KNOWLEDGE FILE RGO2019

# TU/e Robotics
from robocup_knowledge import knowledge_loader

# Common knowledge
common = knowledge_loader.load_knowledge("common")

grammar_target = "T"

location_grammar = """
T[A] -> COURTESY_PREFIX VP[A] | VP[A]
COURTESY_PREFIX -> robot please | could you | could you please | please
"""

for loc in common.location_rooms:
location_grammar += '\nLOCATION[{"id": "%s"}] -> %s' % (loc, loc)

for loc in common.location_names:
location_grammar += '\nLOCATION[{"id": "%s"}] -> %s' % (loc, loc)

for loc in common.object_names:
category = common.get_object_category(loc)
if category not in common.category_locations:
continue

entity_id = common.get_object_category_location(category)[0]

location_grammar += '\nLOCATION[{"id": "%s"}] -> %s' % (entity_id, loc)

location_grammar += '\nDET_LOCATION[Y] -> LOCATION[Y] | the LOCATION[Y]'

location_grammar += """
V_GUIDE -> guide | bring | lead
VP[{"target-location": Y}] -> DET_LOCATION[Y] | V_GUIDE me to DET_LOCATION[Y] | i want to go to DET_LOCATION[Y] | i would like to go to DET_LOCATION[Y] | i like to go to DET_LOCATION[Y] | tell me how to go to DET_LOCATION[Y] | tell me how to reach DET_LOCATION[Y]
"""

if __name__ == "__main__":
print("Where is this Grammar:\n\n{}\n\n".format(location_grammar))

from grammar_parser.cfgparser import CFGParser

grammar_parser = CFGParser.fromstring(location_grammar)
grammar_parser.verify()
grammar_parser.check_rules()

0 comments on commit 0000279

Please sign in to comment.