Open KutayDemiray opened 1 year ago
Some initial task planning PDDL code:
(:requirements :typing :strips)
(:types
; Boxes, which are the only moveable objects
location locatable - object
bot box - locatable
robot - bot
)
(:predicates
; Is object on given location?
(on ?obj - locatable ?loc - location)
; Is robot holding box?
(holding ?arm - locatable ?box - box)
; Is the arm free?
(arm-empty)
; Is there a valid path between two locs?
(path ?location1 - location ?location2 - location)
)
(:action pick-up
:parameters
(?arm - bot
?box - locatable
?loc - location)
:precondition
(and
(on ?arm ?loc)
(on ?box ?loc)
(arm-empty)
)
:effect
(and
(not (on ?box ?loc))
(holding ?arm ?box)
(not (arm-empty))
)
)
(:action drop
:parameters
(?arm - bot
?box - locatable
?loc - location
)
:precondition
(and
(on ?arm ?loc)
(holding ?arm ?box)
)
:effect
(and
(on ?box ?loc)
(arm-empty)
(not (holding ?arm ?box))
)
)
(:action move
:parameters
(?arm - bot
?from - location
?to - location)
:precondition
(and
(on ?arm ?from)
(path ?from ?to)
)
:effect
(and
(not (on ?arm ?from))
(on ?arm ?to)
)
)
(define (problem letseat-simple)
(:domain letseat)
(:objects
arm - robot
box - box
pickup-area - location
place-area - location
)
(:init
;(on arm table) do we need this?
(on box pickup-area)
(arm-empty)
(path box plate)
)
(:goal
(on box place-area)
)
Until we include motion planning as well, this is probably not usable.
Here's the general idea for the first actual version of task planning:
We split the truck volume into H x W x D = 2 x 2 x 3 volumes.
We define light, heavy, high priority and low priority as box properties. A box must be either light or heavy, and either high or low priority. If needed we can also expand on these types later on.
We require the agent to place high priority boxes to front, low priority boxes to back, and also have no heavy boxes above light ones (i.e. prioritize placing light boxes to the top half and heavy boxes to the bottom half of the truck volume).
Here is what I have in mind:
(define (domain box-placement)
(:requirements :typing :strips)
(:types
; Boxes, which are the only moveable objects
location locatable - object
bot box - locatable
robot - bot
)
(:predicates
; Is object on given location?
(on ?obj - locatable ?loc - location)
; Is robot holding box?
(holding ?arm - locatable ?box - box)
; Is the arm free?
(arm-empty)
; Is the location occupied?
(occupied ?loc - location)
; Box type checking
(is_highprio ?box - box)
(is_lowprio ?box - box)
(is_light ?box - box)
(is_heavy ?box - box)
; (Truck) location checking
(is_ground ?location - location)
(has_heavy_below ?location - location)
(has_highprio_behind ?location - location)
)
(:action pick-up
:parameters
(?arm - bot
?box - locatable
?loc - location)
:precondition
(and
(on ?arm ?loc)
(on ?box ?loc)
(arm-empty)
)
:effect
(and
(not (on ?box ?loc))
(holding ?arm ?box)
(not (arm-empty))
)
)
(:action drop
:parameters
(?arm - bot
?box - box
?loc - location
)
:precondition
(and
(on ?arm ?loc)
(holding ?arm ?box)
(not (occupied ?loc))
; lowprio boxes should not have highprio behind
(not
(and
(is_highprio ?box)
(not (has_highprio_behind ?loc))
)
)
; heavy boxes can either be put on the ground or only have heavy boxes below
(not
(and
(is_heavy ?box)
(or
(not (has_heavy_below ?loc))
(is_ground ?loc)
)
)
)
)
:effect
(and
(on ?box ?loc)
(arm-empty)
(not (holding ?arm ?box))
)
)
(:action move
:parameters
(
?r - bot
?loc1 - location
?loc2 - location
)
:precondition
(and
(on ?r ?loc1)
)
:effect
(and
(on ?r ?loc2)
(not (on ?r ?loc1))
)
)
)
This issue does not cover the actual execution of the plan for now.
Task and motion planning should be done jointly. Use PDDL for domain and problem description.
Useful Resources