robocup_knowledge
rwc2023/challenge_restaurant.py
Go to the documentation of this file.
1 # TU/e Robotics
2 from robocup_knowledge import knowledge_loader
3 
4 # Common knowledge
5 common = knowledge_loader.load_knowledge("common")
6 
7 order_grammar = """
8 O[P] -> ORDER[P]
9 ORDER[OO] -> ITEM1[OO] | ITEM2[OO] | ITEM3[OO]
10 ITEM1[{"item1": F1}] -> ITEM[F1]
11 ITEM2[{"item1": F1, "item2": F2}] -> ITEM[F1] and ITEM[F2]
12 ITEM3[{"item1": F1, "item2": F2, "item3": F3}] -> ITEM[F1] ITEM[F2] and ITEM[F3]
13 """
14 
15 # Create grammar
16 for d in common.objects:
17  if d["category"] in ["drinks", "foods", "fruits", "snacks"]:
18  name = d["name"]
19  order_grammar += f"\nITEM['{name}'] -> {name}"
20 
21 if __name__ == "__main__":
22  import rospy
23  from robot_skills.api import Api
24  rospy.init_node('blaat')
25  a = Api("", None)
26  rospy.sleep(rospy.Duration(0.5))
27  while True:
28  result = a.query("blaat", order_grammar, "O")
29  import ipdb;ipdb.set_trace()