PDDL机器人奉茶规划领域文件编译失败,请求排查语法错误
PDDL奉茶机器人Domain语法错误排查与修复
错误核心原因
metric-ff报错的关键在于PDDL动作的effect部分不允许使用析取式(or)——你声明的:disjunctive-preconditions仅适用于前置条件(precondition),不能用于状态效果(effect)。你的COGER-TAZA动作effect里的(or (taza-vacia ?t) (not (taza-vacia ?t)))属于非法语法,而且这个语句是恒真的,对状态没有任何实际修改,完全冗余。
另外还有几个隐性问题:
- 使用了未定义的谓词
at-robot,但predicates里只定义了通用的(at ?x - entidad ?l - location),机器人属于robot-entidad(entidad的子类),直接用(at ?r ?l)即可。 MOVER动作的effect里重复声明了静态谓词connected,静态谓词不会被动作修改,无需重复。COGER-TAZA包含?a、?m、?p等未使用的参数,增加代码冗余。COGER-TAZA前置条件里的(or (taza-vacia ?t) (not (taza-vacia ?t)))是恒真条件,完全可以省略。
修复后的完整Domain代码
(define (domain robots) (:requirements :strips :typing :disjunctive-preconditions) (:types entidad robot-entidad persona-entidad taza-entidad armario-entidad maquina-entidad localizacion brazo) (:predicates (at ?x - entidad ?l - localizacion) (in ?t - taza-entidad ?x - entidad) (free ?r - robot-entidad ?b - brazo) (taza-vacia ?t - taza-entidad) (connected ?l - localizacion ?l1 - localizacion) ) (:action MOVER :parameters (?r - robot-entidad ?l - localizacion ?l1 - localizacion) :precondition (and (at ?r ?l) (connected ?l ?l1)) :effect (and (at ?r ?l1) (not (at ?r ?l)))) (:action COGER-TAZA :parameters (?r - robot-entidad ?b - brazo ?t - taza-entidad ?l - localizacion) :precondition (and (at ?r ?l) (at ?t ?l) (free ?r ?b) (or (in ?t ?a) (in ?t ?p) (in ?t ?m))) :effect (and (in ?t ?r) (not (free ?r ?b)))) (:action HACER-TE :parameters (?r - robot-entidad ?b - brazo ?t - taza-entidad ?m - maquina-entidad ?l - localizacion) :precondition (and (at ?r ?l) (at ?m ?l) (at ?t ?l) (in ?t ?r) (taza-vacia ?t)) :effect (not (taza-vacia ?t))) (:action SERVIR-TE :parameters (?r - robot-entidad ?b - brazo ?t - taza-entidad ?p - persona-entidad ?l - localizacion) :precondition (and (at ?r ?l) (at ?t ?l) (at ?p ?l) (in ?t ?r) (not (taza-vacia ?t)) (not (free ?r ?b))) :effect (and (in ?t ?p) (free ?r ?b))) )
额外优化说明
- 给
taza-vacia谓词添加类型约束?t - taza-entidad,符合PDDL类型规范。 COGER-TAZA的effect补充(not (free ?r ?b)),补上拿杯子后手臂被占用的关键状态变化。- 移除所有动作effect中冗余的静态状态声明(比如重复的
at、in),动作只需声明发生变化的状态即可。
内容的提问来源于stack exchange,提问作者Luis
相关产品推荐
相关产品推荐

