TDDC17AICourse/lab4/part1/task1_domain.pddl
2021-08-22 13:07:04 +02:00

73 lines
2.3 KiB
Text

;; TDDC17 - Lab 4
;; Shakey's World
;; The objective here is to give a basic
;; domain for the Shakey's World problem.
;; Our domain definition
(define (domain shakey)
;; We only use strips
(:requirements :strips)
(:types
room ;; Represent a room
object ;; Represent any object (small objects or boxes)
gripper ;; Represent Shakey's gripper
)
;; Predicates definition
(:predicates
(position ?r - room) ;; Is Shakey in the given room?
(light ?r - room) ;; Are lights on in the given room?
(connected_wide ?r1 ?r2 - room) ;; Are rooms connected by a wide door?
(connected ?r1 ?r2 - room) ;; Are rooms connected by a door?
(in ?o - object ?r - room) ;; Is the given object in the given room?
(is_empty ?g - gripper) ;; Is the given gripper empty?
(hold_on ?g - gripper ?o - object) ;; Is the given gripper holding the given object?
(is_big ?o - object) ;; Is this object big? I.e. is this object a box?
)
;; Actions definition
;; Robot's actions
(:action move ;; MOVE action, from the room ?pos to ?trg
:parameters (?pos ?trg - room)
:precondition (and (position ?pos)
(connected ?pos ?trg))
:effect (and (not (position ?pos)) (position ?trg))
)
(:action turn_on_light ;; Act of turning on lights. Requires a support.
:parameters (?pos - room ?support - object)
:precondition (and (position ?pos)
(in ?support ?pos)
(is_big ?support)
(not (light ?pos)))
:effect (light ?pos)
)
;; Object actions
(:action grab ;; Action to GRAB sth
:parameters (?what - object ?where - room ?g - gripper)
:precondition (and (position ?where)
(light ?where)
(in ?what ?where)
(is_empty ?g)
(not (is_big ?what)))
:effect (and (not (is_empty ?g))(hold_on ?g ?what)(in ?what ?where))
)
(:action release ;; Action to RELEASE sth
:parameters (?what - object ?where - room ?g - gripper)
:precondition (and (position ?where)
(hold_on ?g ?what))
:effect (and (not (hold_on ?g ?what))(in ?what ?where)(is_empty ?g))
)
(:action push ;; Action to PUSH sth
:parameters (?what - object ?r1 - room ?r2 - room)
:precondition (and (position ?r1)
(is_big ?what)
(in ?what ?r1)
(connected_wide ?r1 ?r2))
:effect (and (position ?r2)(not (position ?r1))(in ?what ?r2)(not(in ?what ?r1)))
)
)