适配POPF时间规划器时PDDL域/问题文件报错求助
PDDL域文件与问题文件适配POPF规划器报错排查
问题背景
基于TBM2示例编写PDDL域文件和问题文件,适配时间规划器POPF,运行命令rosrun rosplan_planning_system popf new.domain.pddl new_problem.pddl时出现报错,无法完成规划。
域文件(new.domain.pddl)
; Specification in PDDL1 of the rockin TBM2 drill test domain ; author : Oscar Lima, olima_84@yahoo.com (define (domain idmind_agent) (:requirements :strips :typing :fluents :negative-preconditions :disjunctive-preconditions :durative-actions ) (:types location ; locations in the arena, points of interest robot ; your amazing yet powerful robot object ; objects to be manipulated by the robot gripper ; robot gripper robot_platform ; platform slots for the robot to store objects ) (:predicates ; robot ?r is at location ?l (at ?r - robot ?l - location) ; object ?o is on location ?l (on ?o - object ?l - location) ; object ?o is stored on robot platform ?rp (stored ?o - object ?rp - robot_platform) ; robot platform ?rp is occupied, yb has 3 free places to store objects (occupied ?rp - robot_platform) ; gripper ?g is holding object ?o (holding ?g - gripper ?o - object) ; gripper ?g is free (does not contain object) (gripper_is_free ?g - gripper) ) ; moves a robot ?r from ?source - location to a ?destination - location ; NOTE : the situation in which the robot arm is in any position before moving ; is not handled at the planning level, hence we advise to always move the arm ; to a folded position, then navigate (:durative-action move_base :parameters (?source ?destination - location ?r - robot ?g - gripper) :duration (= ?duration 1) :condition (and (at start (at ?r ?source)) (over all (gripper_is_free ?g)) ) :effect (and (at start (not (at ?r ?source))) (at end (at ?r ?destination)) ) ) ; pick an object ?o which is inside a location ?l with a free gripper ?g ; with robot ?r that is at location ?l (:durative-action pick :parameters (?o - object ?l - location ?r - robot ?g - gripper) :duration (= ?duration 1) :condition (and (at start (on ?o ?l)) (over all (at ?r ?l)) (at start (gripper_is_free ?g)) ) :effect (and (at end (holding ?g ?o)) (at start (not (on ?o ?l))) (at start (not (gripper_is_free ?g))) ) ) ; stage an object ?o in a robot platform ?rp which is not occupied with a gripper ?g ; which is holding the object ?o (:durative-action stage :parameters (?o - object ?rp - robot_platform ?g - gripper) :duration (= ?duration 1) :condition (and (at start (holding ?g ?o)) (at start (not (occupied ?rp))) (at start (not (gripper_is_free ?g))) ) :effect (and (at start (not (holding ?g ?o))) (at start (gripper_is_free ?g)) (at start (stored ?o ?rp)) (at start (occupied ?rp)) ) ) ; unstage an object ?o stored on a robot platform ?rp with a free gripper ?g (:durative-action unstage :parameters (?o - object ?rp - robot_platform ?g - gripper) :duration (= ?duration 1) :condition (and (at start (gripper_is_free ?g)) (at start (stored ?o ?rp)) (at start (not (holding ?g ?o))) ) :effect (and (at start (not (gripper_is_free ?g))) (at start (not (stored ?o ?rp))) (at start (not (occupied ?rp))) (at start(holding ?g ?o)) ) ) ; places and object ?o with a gripper ?g which is holding the object ?o ; with a robot ?r at a location ?l on robot_platform ?rp (:durative-action drop_on_platform :parameters (?o - object ?l - location ?g - gripper ?r - robot ?rp - robot_platform) :duration (= ?duration 1) :condition (and (over all (at ?r ?l)) (at start (holding ?g ?o)) (at start (not (stored ?o ?rp))) ) :effect (and (at end (gripper_is_free ?g)) ; the gripper is free (at end (on ?o ?l)) ; object is now on location l (at start (not (holding ?g ?o))) ; the gripper is no longer holding the object ) ) )
问题文件(new_problem.pddl)
(define (problem problem_1) (:domain idmind_agent) (:objects dock S1 S2 S3 S4 S5 - location platform_middle platform_left platform_right - robot_platform idmind - robot o1 o2 - object robotiq - gripper ) (:init (at idmind dock) (on o1 S2) (on o2 S2) (not (occupied platform_middle)) (not (occupied platform_left)) (not (occupied platform_right)) (gripper_is_free robotiq) ) (:goal (and (on o1 S1) (on o2 S4) ) ) )
报错信息
rosrun rosplan_planning_system popf new.domain.pddl new_problem.pddl Critical Errors Encountered in Domain/Problem File -------------------------------------------------- Due to critical errors in the supplied domain/problem file, the planner has to terminate. The errors encountered are as follows: Errors: 1, warnings: 9 new_problem.pddl: line: 11: Warning: Undeclared requirement :typing new_problem.pddl: line: 11: Warning: Undeclared requirement :typing new_problem.pddl: line: 11: Warning: Undeclared requirement :typing new_problem.pddl: line: 11: Warning: Undeclared requirement :typing new_problem.pddl: line: 11: Warning: Undeclared requirement :typing new_problem.pddl: line: 14: Warning: Undeclared symbol: at new_problem.pddl: line: 15: Warning: Undeclared symbol: on new_problem.pddl: line: 17: Warning: Undeclared symbol: occupied new_problem.pddl: line: 20: Warning: Undeclared symbol: gripper_is_free new_problem.pddl: line: 30: Error: Syntax error in problem file - types used, but no :types section in domain file.
错误原因分析
核心错误:POPF未正确加载域文件的
:types定义
报错提示“types used, but no :types section in domain file”,但域文件明确包含:types块,大概率是域文件路径错误或POPF读取域文件失败。比如命令中指定的new.domain.pddl路径不正确,或者文件损坏,导致POPF无法解析域文件的类型和谓词定义,进而将问题文件中的所有类型引用、谓词都判定为未声明。关联警告的根源
所有“未声明要求:typing”“未声明符号”的警告,都是核心错误引发的连锁反应——POPF没读到域文件内容,无法识别问题文件中使用的类型、谓词。
解决办法
步骤1:验证文件路径与完整性
- 确认
new.domain.pddl和new_problem.pddl都在当前工作目录下,运行命令前先执行ls检查文件是否存在。 - 打开
new.domain.pddl,确认:types块、:predicates块没有缺失或语法错误(比如括号不匹配)。
步骤2:修复域文件潜在语法问题
修正unstage动作效果中的语法错误:(at start(holding ?g ?o))缺少空格,改为(at start (holding ?g ?o))。
步骤3:调整命令执行方式
- 如果文件不在当前目录,使用绝对路径指定文件,例如:
rosrun rosplan_planning_system popf /full/path/to/new.domain.pddl /full/path/to/new_problem.pddl - 单独测试域文件是否能被POPF解析:先只传入域文件,确认域文件本身无语法问题。
步骤4:确认问题文件的一致性
确保问题文件中引用的域idmind_agent与域文件中定义的(define (domain idmind_agent))完全一致(大小写敏感)。
内容的提问来源于stack exchange,提问作者RB_Code
相关产品推荐
相关产品推荐

