adding domain
This commit is contained in:
parent
37bdfcd5e9
commit
b376c78e3b
3 changed files with 29 additions and 1 deletions
|
@ -13,3 +13,5 @@ class FS:
|
|||
|
||||
f.write(data)
|
||||
|
||||
def readFile(path:str):
|
||||
return open(path).read()
|
||||
|
|
20
pddl/mocks/domain.txt
Normal file
20
pddl/mocks/domain.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
;; Modified domain taken from
|
||||
;; "Knowledge transfer in robot manipulation tasks" by Jacob O. Huckaby 2014
|
||||
(define (domain robossembler)
|
||||
(:requirements :strips :typing :adl :fluents :durative-actions)
|
||||
(:types
|
||||
printer workspace - zone
|
||||
part
|
||||
arm
|
||||
assembly
|
||||
)
|
||||
|
||||
(:predicates
|
||||
(arm_available ?a - arm)
|
||||
(part_at ?p - part ?z - zone)
|
||||
(printer_ready ?p - printer)
|
||||
(part_of ?part - part ?whole - assembly)
|
||||
(assembly_order ?prev ?next - assembly)
|
||||
(assembled ?whole - assembly ?z - zone)
|
||||
)
|
||||
);; end Domain ;;;;;;;;;;;;;;;;;;;;;;;;
|
|
@ -1,6 +1,8 @@
|
|||
from typing import List
|
||||
from helper.fs import FS
|
||||
from unified_planning.shortcuts import *
|
||||
from unified_planning import *
|
||||
import os
|
||||
|
||||
|
||||
class AssemblyToPddlUseCase:
|
||||
|
@ -34,4 +36,8 @@ class AssemblyToPddlUseCase:
|
|||
goal = Fluent(rootLabel)
|
||||
problem.add_goal(connected(objectsPartPddl[objectsPartPddl.__len__(
|
||||
) - 1], objectsAsmToPddl[objectsAsmToPddl.__len__() - 1]),)
|
||||
return {"problem": unified_planning.io.PDDLWriter(problem).get_problem(), 'domain': unified_planning.io.PDDLWriter(problem).get_domain()}
|
||||
|
||||
return {
|
||||
"problem": unified_planning.io.PDDLWriter(problem).get_problem(),
|
||||
'domain': FS.readFile(os.path.dirname(os.path.realpath(__file__)) + '/../../mocks' + '/domain.txt'),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue