18 client.wait_for_server()
19 goal = PDDLPlannerGoal()
20 goal.domain.name =
"manip" 21 goal.domain.requirements =
":typing" 22 goal.domain.types =
"object" 23 goal.domain.predicates = [
"(on ?obj0 ?obj1 - object)",
24 "(clear ?obj - object)",
25 "(ontable ?obj - object)",
26 "(holding ?obj - object)",
29 pickup.name =
"pickup" 30 pickup.parameters =
"(?obj - object)" 31 pickup.precondition =
"(and (ontable ?obj) (clear ?obj) (handempty))" 32 pickup.effect =
"""(and (not (ontable ?obj)) (not (clear ?obj)) (not (handempty)) (holding ?obj))""" 33 putdown = PDDLAction()
34 putdown.name =
"putdown" 35 putdown.parameters =
"(?obj - object)" 36 putdown.precondition =
"(and (holding ?obj))" 37 putdown.effect =
"""(and 44 stack.parameters =
"(?obj0 ?obj1 - object)" 45 stack.precondition =
"""(and 48 stack.effect =
"""(and 54 unstack = PDDLAction()
55 unstack.name =
"unstack" 56 unstack.parameters =
"(?obj0 ?obj1 - object)" 57 unstack.precondition =
"""(and 61 unstack.effect =
"""(and 63 (not (on ?obj0 ?obj1)) 67 goal.domain.actions = [pickup, unstack, stack, putdown]
68 goal.problem.name =
"sample" 69 goal.problem.domain =
"manip" 70 goal.problem.objects = [PDDLObject(name=
"a", type=
"object"),
71 PDDLObject(name=
"b", type=
"object"),
72 PDDLObject(name=
"c", type=
"object")]
73 goal.problem.initial = [
"(on c a)",
79 goal.problem.goal =
"(and (on a b) (on b c))" 80 rospy.loginfo(str(goal))
81 client.send_goal(goal)
82 client.wait_for_result()
83 result = client.get_result()
84 rospy.logdebug(str(result))
85 rospy.loginfo(str(result.sequence))
86 self.assertEquals(len(result.sequence), 6,
"result sequence is 6")
88 if __name__ ==
'__main__':
90 rospy.init_node(
'pddl_planner_client', anonymous=
True)
91 rosunit.unitrun(
'pddl_planner',
'test_pddl_planner', TestPddlPlanner)
def test_pddl_planner(self)