I am new to PDDL and AI planning area. I am actually creating a plan for a humanoid interacting with a human in a scenario. The scenario is as follows
- Human enters the room (where robot and some objects are present in the room)
- Robot detects human
- Greets human after detecting
- Then human asks for a cup
- Robot assumes that human wants to drink coffee and responds to human on what time human took medication (there should be a gap of 1 hour for medication and coffee)
- Human responds with the time
- If the time matches to 1 hour gap, Robot responds that it will find cup
- Robot detects the cup on the table
- Robot responds to human that cup is on the table
- Human picks the cup
- Robot greets the human after detecting that the human is holding the cup
My PDDL domain file logic is as follows:
(define (domain sp)
(:requirements :typing :strips :adl)
(:types location agent item - object
robot human speak - agent
room - location
fruit cup table - item
clear polite listenatt - speak)
(:predicates
(at ?o - object ?l - location)
(detected_human ?p - human ?l - room)
(greeted ?r - robot ?p - human)
(detected_cup ?c - cup ?l - room)
(holded ?c - cup ?p - human)
(medichecked ?r - robot ?p - human)
(human_asked ?p - human)
(robot_responded ?r - robot ?cl - clear ?pl - polite)
)
(:action detect_human
:parameters (?p - human ?r - robot ?l - location)
:precondition (at ?r ?l)
:effect (detected_human ?p ?l)
)
(:action detect_cup
:parameters (?p - human ?c - cup ?r - robot ?l - location )
:precondition (and (detected_human ?p ?l)
(human_asked ?p)
(medichecked ?r ?p)
)
:effect (detected_cup ?c ?l)
)
(:action greet
:parameters (?r - robot ?p - human ?l - location ?pl - polite ?cl - clear)
:precondition (and (at ?r ?l) (detected_human ?p ?l))
:effect (and (greeted ?r ?p) (robot_responded ?r ?cl ?pl))
)
(:action hold
:parameters (?c - cup ?p - human ?l - location ?r - robot ?cl - clear ?pl - polite)
:precondition (and (detected_human ?p ?l)
(detected_cup ?c ?l)
(robot_responded ?r ?cl ?pl)
(medichecked ?r ?p)
)
:effect (holded ?c ?p)
)
(:action check_medi
:parameters (?p - human ?l - location ?r - robot)
:precondition (human_asked ?p)
:effect (medichecked ?r ?p)
)
(:action human_ask
:parameters (?p - human ?l - location ?r - robot)
:precondition (and (detected_human ?p ?l) (greeted ?r ?p))
:effect (human_asked ?p)
)
(:action robot_respond
:parameters (?p - human ?l - location ?r - robot ?cl - clear ?pl - polite ?c -cup)
:precondition (and (at ?r ?l) (detected_human ?p ?l))
:effect (and (when (human_asked ?p) (robot_responded ?r ?cl ?pl))
(when (detected_cup ?c ?l) (robot_responded ?r ?cl ?pl)))
)
)
My PDDL problem file is as follows:
(define (problem test12)
(:domain sp)
(:objects person0 - Human
pepper0 - Robot
apple - Fruit
cup0 - Cup
table0 - Table
room0 - Room
clear0 - Clear
polite0 - Polite)
(:init
(at pepper0 room0)
)
(:goal (holded cup0 person0)
)
currently it generates the following plan:
plan-found
(detect_human person0 pepper0 room0)
(greet pepper0 person0 room0 polite0 clear0)
(human_ask person0 room0 pepper0)
(check_medi person0 room0 pepper0)
(detect_cup person0 cup0 pepper0 room0)
(hold cup0 person0 room0 pepper0 clear0 polite0)
I wanted the expected plan to be something like this:
plan-found
(detect_human person0 pepper0 room0)
(greet pepper0 person0 room0 polite0 clear0)
(human_ask person0 room0 pepper0)
(robot_respond person0 polite0 clear0 room0)
(check_medi person0 room0 pepper0)
(robot_respond person0 polite0 clear0 room0)
(detect_cup person0 cup0 pepper0 room0)
(robot_respond person0 polite0 clear0 room0)
(hold cup0 person0 room0 pepper0 clear0 polite0)
I am not sure why the robot_respond
action is never coming in the plan even though it is given in the effects and preconditions.
I appreciate if any direction on this problem. Its been more than a week I am struggling to get the logic correct.
robot_responded ...
variable by addingrobot_responded ...
to the precondition of the human actions and adding(not (robot_responded ... ))
as an effect. You probably also need to add (not (greeded ...) to the precondition of actiongreet
. – David Speck