Примеры PDDL для роботизированной сборки

This commit is contained in:
movefasta 2022-09-26 14:12:50 +03:00
parent 376613b6b6
commit fc0fc53683
5 changed files with 312 additions and 0 deletions

View file

@ -0,0 +1,114 @@
;; Modified domain taken from
;; "Knowledge transfer in robot manipulation tasks" by Jacob O. Huckaby 2014
(define (domain assembly_domain_hackaby)
(:requirements :strips :typing :adl :fluents)
(:types
arm ; robotic manipulator arm
workspace ; workspace for assembly operations and storage
grip weld scan - tool ; manipulator tool for grip, weld, solder and other operations
part ; solid part, that cannot be disassembled
assembly ; assembly - can dissassembled
)
(:predicates
(arm-canreach ?a - arm ?s - workspace)
(arm-at ?a - arm ?s - workspace)
(arm-capabilities ?a - arm ?t - tool)
(arm-active ?a - arm ?t - tool)
(arm-holding ?a - arm ?p - part)
(part-at ?p - part ?s - workspace)
(part-state ?p - part ?t - tool)
(pose-detected ?a - arm ?p - part ?s - workspace)
)
(:action activate
:parameters (?a - arm ?old - tool ?new - tool)
:precondition (and
(arm-capabilities ?a ?new)
(arm-active ?a ?old))
:effect (and
(arm-active ?a ?new)
(not (arm-active ?a ?old))) )
(:action detect-pose-part
:parameters (?a - arm ?p - part ?s - workspace ?t - scan)
:precondition (and
(arm-at ?a ?s)
(arm-active ?a ?t)
(part-at ?p ?s))
:effect (pose-detected ?a ?p ?s)
)
(:action detect-pose-workspace
:parameters (?a - arm ?p - part ?s - workspace)
:precondition (and
(arm-at ?a ?s)
(arm-active ?a detect)
(arm-holding ?a ?p))
:effect (pose-detected ?a ?p ?s)
)
(:action grasp
:parameters (?a - arm ?p - part ?s - workspace)
:precondition (and
(arm-at ?a ?s)
(arm-active ?a grip)
(arm-holding ?a no-part)
(part-at ?p ?s)
(pose-detected ?a ?p ?s))
:effect (and
(arm-holding ?a ?p)
(not (arm-holding ?a no-part))
(not (part-at ?p ?s))
(not (pose-detected ?a ?p ?s)))
)
(:action ungrasp
:parameters (?a - arm ?p - part ?s - workspace)
:precondition (and
(arm-at ?a ?s)
(arm-active ?a grip)
(arm-holding ?a ?p)
(pose-detected ?a ?p ?s))
:effect (and
(arm-holding ?a no-part)
(not (arm-holding ?a ?p))
(part-at ?p ?s)
(not (pose-detected ?a ?p ?s)))
)
(:action move
:parameters (?a - arm ?from - workspace ?to - workspace)
:precondition (and
(arm-at ?a ?from)
(arm-canreach ?a ?to)
(arm-holding ?a no-part))
:effect (and
(arm-at ?a ?to)
(not (arm-at ?a ?from)))
)
(:action carry
:parameters (?a - arm ?p - part ?from - workspace ?to - workspace)
:precondition (and
(arm-at ?a ?from)
(arm-canreach ?a ?to)
(arm-holding ?a ?p))
:effect (and
(arm-at ?a ?to)
(not (arm-at ?a ?from)))
)
(:action employ
:parameters (?a - arm ?t - tool ?p - part ?s - workspace)
:precondition (and
(arm-at ?a ?s)
(arm-active ?a ?t)
(arm-holding ?a no-part)
(part-at ?p ?s)
(pose-detected ?a ?p ?s))
:effect (and
(part-state ?p ?t)
(not (pose-detected ?a ?p ?s)))
)
)

View file

@ -0,0 +1,102 @@
;; Assembly domain in ADL (from the SGP distribution).
(define (domain assembly_soar)
(:requirements :adl)
(:types
assembly
resource
) ;; individual parts are atomic assemblies
(:predicates
(available ?x - (either resource assembly))
(complete ?a - assembly)
(requires ?a - assembly ?r - resource)
(committed ?r - resource ?a - assembly)
(incorporated ?part ?whole - assembly)
(part-of ?part ?whole - assembly)
(to-be-removed ?part ?whole - assembly)
(assemble-order ?part1 ?part2 ?whole - assembly)
(transient-part ?part ?whole - assembly)
;; after ?part1 is included, ?part2 must be removed
;; for the ?whole to be complete:
(remove-order ?part1 ?part2 ?whole - assembly))
(:action detect
:parameters (?res - resource ?as - assembly)
:precondition (available ?res)
:effect (and (not (available ?res))
(object-detected ?res ?as)))
(:action commit
:parameters (?res - resource ?as - assembly)
:precondition (available ?res)
:effect (and (not (available ?res))
(committed ?res ?as)))
(:action release
:parameters (?res - resource ?as - assembly)
:precondition (committed ?res ?as)
:effect (and (not (committed ?res ?as))
(available ?res)))
(:action assemble
:parameters (?part ?whole - assembly)
:precondition (and (forall (?res - resource)
(imply (requires ?whole ?res)
(committed ?res ?whole)))
(or (part-of ?part ?whole)
(transient-part ?part ?whole))
(available ?part)
(forall (?prev - assembly)
(imply (assemble-order ?prev ?part ?whole)
(incorporated ?prev ?whole))))
:effect (and (incorporated ?part ?whole)
(not (available ?part))
(when (and (not (exists (?p - assembly)
(and (part-of ?p ?whole)
(not (= ?p ?part))
(not (incorporated ?p ?whole)))))
(not (exists (?tp - assembly)
(and (transient-part ?tp ?whole)
(incorporated ?tp ?whole)))))
(and (complete ?whole)
(available ?whole)))))
;; you can remove the last part added, or a cleanup part at the
;; end.
(:action remove
:parameters (?part ?whole - assembly)
:precondition (and (forall (?res - resource)
(imply (requires ?whole ?res)
(committed ?res ?whole)))
(incorporated ?part ?whole)
(or (and (transient-part ?part ?whole)
(forall (?prev1 - assembly)
(imply
(remove-order ?prev1 ?part ?whole)
(incorporated ?prev1 ?whole))))
(and (part-of ?part ?whole)
(not (exists (?prev2 - assembly)
(and (assemble-order
?prev2 ?part ?whole)
(incorporated
?prev2 ?whole)))))))
:effect (and (not (incorporated ?part ?whole))
(available ?part)
(when (and (not (exists (?p - assembly)
(and (part-of ?p ?whole)
(not (incorporated ?p ?whole))
)
)
)
(not (exists (?tp - assembly)
(and (transient-part ?tp ?whole)
(not (= ?tp ?part))
(incorporated ?tp ?whole))
)
)
)
(and (complete ?whole)
(available ?whole))
)
))
)

View file

@ -0,0 +1,27 @@
(define (problem p1) (:domain assembly_domain_hackaby)
(:objects
arm1 arm2 - arm
gearbox - part
part-bin workspace - workspace
grip - tool )
(:init
(arm-canreach arm1 part-bin)
(arm-canreach arm1 workspace)
(arm-canreach arm2 part-bin)
(arm-canreach arm2 workspace)
(arm-at arm1 part-bin)
(arm-at arm2 workspace)
(arm-capabilities arm1 grip)
(arm-capabilities arm1 detect)
(arm-capabilities arm2 grip)
(arm-capabilities arm2 detect)
(arm-active arm1 grip)
(arm-active arm2 grip)
(arm-holding arm1 no-part)
(arm-holding arm2 no-part)
(part-at gearbox part-bin))
(:goal
(and (part-state gearbox glue)
(part-state gearbox weld)
(part-at gearbox assembly-line)))
)

View file

@ -0,0 +1,39 @@
(define (problem assembly_problem_soar)
(:domain assembly_soar)
(:objects input_shaft_aSiduw19sd bracket whatsis sprocket doodad contraption
wire gimcrack plug hoozawhatsie thingumbob coil fastener
widget - assembly
grip-tool1 grip-tool2 arm1 arm2 equipment - resource)
(:init (available sprocket)
(available doodad)
(available contraption)
(available wire)
(available plug)
(available hoozawhatsie)
(available thingumbob)
(available fastener)
(available widget)
(available charger)
(available pliers)
(requires bracket charger)
(requires whatsis pliers)
(requires gimcrack pliers)
(requires coil pliers)
(part-of bracket kludge)
(part-of coil kludge)
(part-of whatsis bracket)
(part-of gimcrack bracket)
(part-of sprocket whatsis)
(part-of doodad whatsis)
(part-of contraption whatsis)
(part-of wire whatsis)
(part-of plug gimcrack)
(part-of hoozawhatsie gimcrack)
(part-of thingumbob gimcrack)
(part-of fastener coil)
(part-of widget coil)
(assemble-order bracket coil kludge)
(assemble-order whatsis gimcrack bracket)
(assemble-order wire contraption whatsis)
(assemble-order plug thingumbob gimcrack))
(:goal (complete kludge)))

View file

@ -0,0 +1,30 @@
;;!domain: assembly_soar
;;!problem: assembly_problem_soar
0.00100: (commit charger bracket)
0.00200: (commit pliers coil)
0.00300: (assemble fastener coil) : SDF (fastener, coil) + + skill -> SDF (fastenercoil)
(print bracket-1) - sdf model-gazebo: "bracket"
(print bracket-2)
0.00400: (assemble braket-1 bracket-2)
0.00500: (release pliers coil)
0.00600: (commit pliers gimcrack)
0.00700: (assemble plug gimcrack)
0.00800: (assemble thingumbob gimcrack)
0.00900: (assemble hoozawhatsie gimcrack)
0.01000: (release pliers gimcrack)
0.01100: (commit pliers whatsis)
0.01200: (assemble sprocket whatsis)
0.01300: (assemble doodad whatsis)
0.01400: (assemble wire whatsis)
0.01500: (assemble contraption whatsis)
0.01600: (assemble whatsis bracket)
0.01700: (assemble gimcrack bracket)
0.01800: (assemble bracket kludge)
0.01900: (assemble coil kludge)
; Makespan: 0.019
; Metric: 0.019
assemble_fastener_coil
assemble_coil_kludge