File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
robocup_knowledge/src/robocup_knowledge/environments/rwc2022 Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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"\n ITEM['{ 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 ))
You can’t perform that action at this time.
0 commit comments