Skip to content

Commit 51b4100

Browse files
(rwc2022)(restaurant) knowledge only (#1333)
feat: Add grammar for rwc2022 Co-authored-by: Peter van Dooren <[email protected]>
1 parent 2850892 commit 51b4100

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 ["drink", "fruit", "snack"] or d["name"] == "corn_flakes":
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+
25+
rospy.init_node('blaat')
26+
a = Api("hero", None)
27+
rospy.sleep(rospy.Duration(0.5))
28+
while not rospy.is_shutdown():
29+
try:
30+
result = a.query("blaat", order_grammar, "O")
31+
except:
32+
pass
33+
rospy.sleep(rospy.Duration(3.0))

0 commit comments

Comments
 (0)