From aefd60030e7b0cfa915f761228b1c983b30c9854 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Thu, 18 Jun 2020 11:31:38 +0900 Subject: [PATCH 01/46] [pddl_planner/demos/hanoi/solve-hanoi.l] use evince instead of gnome-open --- pddl/pddl_planner/demos/hanoi/solve-hanoi.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l index fc481cd5..5e6bfbaf 100755 --- a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l +++ b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l @@ -81,7 +81,7 @@ (send gr :write-to-pdf "hanoi.pdf") (when (ros::get-param "~display_graph" "true") - (piped-fork "gnome-open hanoi.pdf")) + (piped-fork "evince hanoi.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) From 613944b71eda91d83ef97d67a9a449e47431ef66 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Fri, 19 Jun 2020 12:00:02 +0900 Subject: [PATCH 02/46] [pddl_planner/demos] use evince instead of gnome-open --- .../pddl_planner/demos/2008_okada_ias/solve-pour-tea.l | 2 +- .../demos/2011_kakiuchi/solve-cleanup-table.l | 2 +- pddl/pddl_planner/demos/2011_saito/solve-knock-door.l | 2 +- pddl/pddl_planner/demos/2011_saito/solve-simple-task.l | 2 +- .../demos/2011_saito/solve-taking-elevator.l | 2 +- .../demos/2013_fridge_demo/solve-bring-can.l | 2 +- pddl/pddl_planner/demos/2016_kamada_durative/tools.l | 10 +++++----- .../demos/search_object/solve-search-object.l | 2 +- .../solve-simple-failure-torelant.l | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l index f29e4b12..87584a57 100755 --- a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l +++ b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l @@ -122,7 +122,7 @@ (send gr :write-to-pdf "okada_ias.pdf") (when (ros::get-param "~display_graph" "true") - (piped-fork "gnome-open okada_ias.pdf")) + (piped-fork "evince okada_ias.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l b/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l index ecba2256..02717591 100755 --- a/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l +++ b/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l @@ -174,7 +174,7 @@ (send *graph* :write-to-pdf "kakiuchi_robomec.pdf") (when (ros::get-param "~display_graph") - (piped-fork "gnome-open kakiuchi_robomec.pdf")) + (piped-fork "evince kakiuchi_robomec.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l index c7b171ef..02846f9b 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l @@ -186,7 +186,7 @@ ;(send *graph* :write-to-pdf "knock_demo.pdf") ;(when (ros::get-param "~display_graph") -; (piped-fork "gnome-open knock_demo.pdf")) +; (piped-fork "evince knock_demo.pdf")) ;; action definition ;; domain -> package diff --git a/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l b/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l index 8d0075c2..dc8fe208 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l @@ -133,7 +133,7 @@ (send *graph* :write-to-pdf "knock_demo.pdf") (when (ros::get-param "~display_graph") - (piped-fork "gnome-open knock_demo.pdf")) + (piped-fork "evince knock_demo.pdf")) ;; action definition ;; domain -> package diff --git a/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l b/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l index b29162c6..f1d7a4a2 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l @@ -148,7 +148,7 @@ (send *graph* :write-to-pdf "knock_demo.pdf") (when (ros::get-param "~display_graph") - (piped-fork "gnome-open knock_demo.pdf") + (piped-fork "evince knock_demo.pdf") (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l index f55c0014..17e92c25 100755 --- a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l +++ b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l @@ -151,7 +151,7 @@ (when (and (ros::has-param "~display_graph") (ros::get-param "~display_graph")) - ;;(piped-fork "gnome-open debug.pdf") + ;;(piped-fork "evince debug.pdf") (load "package://roseus_smach/src/pddl2smach.l") (load "package://roseus_smach/src/state-machine-ros.l") diff --git a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l index 2187c812..07d79d1f 100644 --- a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l +++ b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l @@ -160,10 +160,10 @@ (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose.dot" ".verbose.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose_separated.dot" ".verbose_separated.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".inter_robot_relationship.dot" ".inter_robot_relationship.pdf")) - (piped-fork "gnome-open .normal.pdf") - (piped-fork "gnome-open .normal_separated.pdf") - (piped-fork "gnome-open .verbose.pdf") - (piped-fork "gnome-open .verbose_separated.pdf") - (piped-fork "gnome-open .inter_robot_relationship.pdf") + (piped-fork "evince .normal.pdf") + (piped-fork "evince .normal_separated.pdf") + (piped-fork "evince .verbose.pdf") + (piped-fork "evince .verbose_separated.pdf") + (piped-fork "evince .inter_robot_relationship.pdf") )) ) diff --git a/pddl/pddl_planner/demos/search_object/solve-search-object.l b/pddl/pddl_planner/demos/search_object/solve-search-object.l index 3ca4d715..dd452b83 100755 --- a/pddl/pddl_planner/demos/search_object/solve-search-object.l +++ b/pddl/pddl_planner/demos/search_object/solve-search-object.l @@ -140,7 +140,7 @@ (when (and (ros::has-param "~display_graph") (ros::get-param "~display_graph")) - ;;(piped-fork "gnome-open debug.pdf") + ;;(piped-fork "evince debug.pdf") (load "package://roseus_smach/src/pddl2smach.l") (load "package://roseus_smach/src/state-machine-ros.l") diff --git a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l index 83cff962..4b4d0645 100755 --- a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l +++ b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l @@ -72,7 +72,7 @@ (setq *graph* (pddl-plan-to-graph nil :domain *domain* :problem *problem* :failed-nodes *failed-nodes* :debug t)) (send *graph* :write-to-pdf "/tmp/graph.pdf" nil "simple_failure_torelant") - (piped-fork "gnome-open /tmp/graph.pdf") + (piped-fork "evince /tmp/graph.pdf") (require :pddl2smach "package://roseus_smach/src/pddl2smach.l") (require :state-machine-ros "package://roseus_smach/src/state-machine-ros.l") From 2457cd5f513bb92d1bfe2e19599f482456f79bb3 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Fri, 19 Jun 2020 12:42:23 +0900 Subject: [PATCH 03/46] [pddl_planner/demos/simple_metrix] add launch file --- .../demos/simple_metric/demo_simple_metric_plan.launch | 6 ++++++ pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l | 1 + 2 files changed, 7 insertions(+) create mode 100644 pddl/pddl_planner/demos/simple_metric/demo_simple_metric_plan.launch diff --git a/pddl/pddl_planner/demos/simple_metric/demo_simple_metric_plan.launch b/pddl/pddl_planner/demos/simple_metric/demo_simple_metric_plan.launch new file mode 100644 index 00000000..f40e9682 --- /dev/null +++ b/pddl/pddl_planner/demos/simple_metric/demo_simple_metric_plan.launch @@ -0,0 +1,6 @@ + + + + diff --git a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l index a87801e2..f1d2f5b0 100644 --- a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l +++ b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l @@ -70,3 +70,4 @@ (load "package://pddl_planner/src/pddl-result-graph.l") (setq *graph* (make-graph-from-pddl-results (list *result*) :node-name :pprint)) (send (make-readable-graph *graph*) :write-to-pdf "test.pdf") +(piped-fork "evince test.pdf") From e06c077405a456f818b36bf8a18c6df568fcd662 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Thu, 21 Jan 2021 14:46:22 +0900 Subject: [PATCH 04/46] add launch to run simple_metric_plan --- .../demos/simple_metric/demo_simple_metric.launch | 6 ++++++ pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 pddl/pddl_planner/demos/simple_metric/demo_simple_metric.launch mode change 100644 => 100755 pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l diff --git a/pddl/pddl_planner/demos/simple_metric/demo_simple_metric.launch b/pddl/pddl_planner/demos/simple_metric/demo_simple_metric.launch new file mode 100644 index 00000000..6067612c --- /dev/null +++ b/pddl/pddl_planner/demos/simple_metric/demo_simple_metric.launch @@ -0,0 +1,6 @@ + + + + + diff --git a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l old mode 100644 new mode 100755 index a87801e2..32c56738 --- a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l +++ b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l @@ -1,3 +1,5 @@ +#!/usr/bin/env roseus + (ros::roseus "simple_metric_plan") (load "package://pddl_planner/src/eus-pddl-client.l") @@ -69,4 +71,4 @@ (setq *result* (solve-pddl-planning *domain* *problem* :debug t)) (load "package://pddl_planner/src/pddl-result-graph.l") (setq *graph* (make-graph-from-pddl-results (list *result*) :node-name :pprint)) -(send (make-readable-graph *graph*) :write-to-pdf "test.pdf") +(send (make-readable-graph *graph*) :write-to-pdf "simple_metric_plan.pdf") From 0a164d243d4ffe75bc41077c0b25f65aa6792091 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Thu, 21 Jan 2021 18:46:05 +0900 Subject: [PATCH 05/46] Add obinata's multiple robot cooperation demo --- .../demo_cooperation_task.launch | 10 + .../solve-cooperation-task.l | 199 ++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 pddl/pddl_planner/demos/2020_obinata_cooperation/demo_cooperation_task.launch create mode 100755 pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l diff --git a/pddl/pddl_planner/demos/2020_obinata_cooperation/demo_cooperation_task.launch b/pddl/pddl_planner/demos/2020_obinata_cooperation/demo_cooperation_task.launch new file mode 100644 index 00000000..894b8695 --- /dev/null +++ b/pddl/pddl_planner/demos/2020_obinata_cooperation/demo_cooperation_task.launch @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l new file mode 100755 index 00000000..5dad840e --- /dev/null +++ b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l @@ -0,0 +1,199 @@ +#!/usr/bin/env roseus + +#| +使い方 +$ roslaunch pddl_planner demo_cooperation_task.launch demo:=office +$ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car + +初期条件: +・fetchは73B2、spotは2号館入り口にいる +・書類は73B2、弁当はキッチンカーにある +・ロボットが移動できる場所は以下の組み合わせのみで、fetch、spotで異なる移動コストが与えられている。 + - 73B2 <-> エレベータ + - 73B2 <-> 階段 + - エレベータ <-> 事務室 + - エレベータ <-> 2号館入り口 + - 階段 <-> 事務室 + - 階段 <-> 2号館入り口 + - 2号館入り口 <-> キッチンカー + +終了条件(以下のどちらかをrosparamで選択可能): +・書類が事務室にあり、かつ、fetchが73B2に戻ってくる +・弁当が73B2にある + +その他の条件: +・コストを最小化した経路を計算 +・spotはfetchが2号館入り口に居るときのみ移動可能 +・ロボット(fetch or spot)は、物品(書類 or 弁当)と同じ場所に居るときのみ、その物品と一緒に移動できる。 +|# + +(ros::roseus "solve_cooperation_task") + +(load "package://pddl_planner/src/pddl-result-graph.l") +(load "package://pddl_planner/src/eus-pddl-client.l") + +;; domain +(setq *domain* (instance pddl-domain :init :name 'cooperation)) +(send *domain* :requirements '(:typing :action-costs)) +(send *domain* :types '(robot item place)) +;; predicates: 述語 +(send *domain* :predicates '((robot-in-place ?robot - robot ?place - place) ;; ?robotが?placeに存在する + (item-in-place ?item - item ?place - place) ;; ?itemが?placeに存在する + (can-move ?from ?to - place))) ;; ロボットが?toから?fromに移動できるか +;; 使用する関数の宣言 +(send *domain* :functions '((total-cost) ;; 合計の移動コスト + (move-cost ?robot - robot ?from - place ?to - place))) ;; 各移動にかかるコスト + +;; making action +(setq *actions* + (list + (setq *fetch-move* (instance pddl-action :init + :name "fetch-move" + :parameters '((?from ?to place)) + :precondition '((robot-in-place fetch ?from) + (can-move ?from ?to)) + :effect '((robot-in-place fetch ?to) + (not (robot-in-place fetch ?from)) + (increase (total-cost) (move-cost fetch ?from ?to))))) + (setq *spot-move* (instance pddl-action :init + :name "spot-move" + :parameters '((?from ?to place)) + :precondition '((robot-in-place spot ?from) + (robot-in-place fetch eng2-entrance) + (can-move ?from ?to)) + :effect '((robot-in-place spot ?to) + (not (robot-in-place spot ?from)) + (increase (total-cost) (move-cost spot ?from ?to))))) + (setq *fetch-move-with-obj* (instance pddl-action :init + :name "fetch-move-with-obj" + :parameters '((?item item) (?from ?to place)) + :precondition '((robot-in-place fetch ?from) + (item-in-place ?item ?from) + (can-move ?from ?to)) + :effect '((robot-in-place fetch ?to) + (item-in-place ?item ?to) + (not (robot-in-place fetch ?from)) + (not (item-in-place ?item ?from)) + (increase (total-cost) (move-cost fetch ?from ?to)) + ))) + (setq *spot-move-with-obj* (instance pddl-action :init + :name "spot-move-with-obj" + :parameters '((?item item) (?from ?to place)) + :precondition '((robot-in-place spot ?from) + (robot-in-place fetch eng2-entrance) + (item-in-place ?item ?from) + (can-move ?from ?to)) + :effect '((robot-in-place spot ?to) + (item-in-place ?item ?to) + (not (robot-in-place spot ?from)) + (not (item-in-place ?item ?from)) + (increase (total-cost) (move-cost spot ?from ?to)) + ))) + + )) + +;;add actions to domain +(dolist (action *actions*) + (send *domain* :add :action action)) + +;; problem +(setq *problem* (instance pddl-problem :init :name 'otsukai :domain 'cooperation)) + +;; 使用する変数の宣言。 +(send *problem* :objects + '( + ;; item + (document . item) + (lunch-box . item) + ;; robot + (fetch . robot) + (spot . robot) + ;; places + (room-73b2 . place) + (stairs . place) + (elevator . place) + (eng2-entrance . place) + (office . place) + (kitchen-car . place))) + +;; 初期条件 +(send *problem* :initial-condition + '(;; 物品・ロボットの初期位置 + (item-in-place lunch-box kitchen-car) + (item-in-place document room-73b2) + (robot-in-place fetch room-73b2) + (robot-in-place spot eng2-entrance) + ;; 移動可能な場所 + (can-move room-73b2 elevator) + (can-move room-73b2 stairs) + (can-move elevator office) + (can-move elevator eng2-entrance) + (can-move stairs office) + (can-move stairs eng2-entrance) + (can-move eng2-entrance kitchen-car) + (can-move elevator room-73b2) ;; ここからfromとtoを逆にしている + (can-move stairs room-73b2) + (can-move office elevator) + (can-move eng2-entrance elevator) + (can-move office stairs) + (can-move eng2-entrance stairs) + (can-move kitchen-car eng2-entrance) + ;; トータル移動コスト + (= (total-cost) 0) + ;; fetch移動コスト + (= (move-cost fetch room-73b2 elevator) 3) + (= (move-cost fetch room-73b2 stairs) 99999) + (= (move-cost fetch elevator office) 10) + (= (move-cost fetch elevator eng2-entrance) 5) + (= (move-cost fetch stairs office) 99999) + (= (move-cost fetch stairs eng2-entrance) 1) + (= (move-cost fetch eng2-entrance kitchen-car) 100) + (= (move-cost fetch elevator room-73b2) 3) ;; ここからfromとtoを逆にしている + (= (move-cost fetch stairs room-73b2) 99999) + (= (move-cost fetch office elevator) 10) + (= (move-cost fetch eng2-entrance elevator) 5) + (= (move-cost fetch office stairs) 99999) + (= (move-cost fetch eng2-entrance stairs) 99999) + (= (move-cost fetch kitchen-car eng2-entrance) 100) + ;; spot移動コスト + (= (move-cost spot room-73b2 elevator) 30) + (= (move-cost spot room-73b2 stairs) 50) + (= (move-cost spot elevator office) 100) + (= (move-cost spot elevator eng2-entrance) 100) + (= (move-cost spot stairs office) 50) + (= (move-cost spot stairs eng2-entrance) 50) + (= (move-cost spot eng2-entrance kitchen-car) 3) + (= (move-cost spot elevator room-73b2) 30) ;; ここからfromとtoを逆にしている + (= (move-cost spot stairs room-73b2) 50) + (= (move-cost spot office elevator) 100) + (= (move-cost spot eng2-entrance elevator) 100) + (= (move-cost spot office stairs) 50) + (= (move-cost spot eng2-entrance stairs) 50) + (= (move-cost spot kitchen-car eng2-entrance) 3) + )) + +(cond + ;; 終了条件1: + ;; 最後、書類が事務室にあり、かつ、fetchが73B2に戻ってくる + ((equal (ros::get-param "~demo") "office") + (send *problem* :goal-condition + '((robot-in-place fetch room-73b2) + (item-in-place document office)))) + ;; 終了条件2 + ;; 最後、弁当箱が73B2にある。 + ((equal (ros::get-param "~demo") "kitchen_car") + (send *problem* :goal-condition + '((item-in-place lunch-box room-73b2)))) + (t + (ros::ros-error "Invalid rosparam for ~demo") + (exit))) + +;; solve planning +(send *problem* :metric '(minimize (total-cost))) +(pprint (setq *result* (solve-pddl-planning *domain* *problem*))) +(setq gr (make-graph-from-pddl-results (list *result*) :node-name :pprint)) +(send gr :write-to-pdf "cooperation.pdf") +(when (ros::get-param "~display_graph" "true") + (piped-fork "xdg-open cooperation.pdf")) +(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) + (ros::exit)) From 02fb8a02ee6c743a0edeb9b0889f9a6bf9e9f28f Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Tue, 26 Jan 2021 15:19:16 +0900 Subject: [PATCH 06/46] Use different initial condition for office demo and kitchen car demo --- .../solve-cooperation-task.l | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l index 5dad840e..fa2c5eab 100755 --- a/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l +++ b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l @@ -173,21 +173,28 @@ $ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car )) (cond - ;; 終了条件1: - ;; 最後、書類が事務室にあり、かつ、fetchが73B2に戻ってくる + ;; 事務室デモ + ;; 初期条件の追加:最初、書類が73B2にある。 + ;; 終了条件:最後、書類が事務室にあり、かつ、fetchが73B2に戻ってくる ((equal (ros::get-param "~demo") "office") - (send *problem* :goal-condition + (setq *initial-condition* (cons '(item-in-place document room-73b2) *initial-condition*)) + (setq *goal-condition* '((robot-in-place fetch room-73b2) (item-in-place document office)))) - ;; 終了条件2 - ;; 最後、弁当箱が73B2にある。 + ;; キッチンカーデモ + ;; 初期条件の追加:最初、お弁当がキッチンカーがある。 + ;; 終了条件:最後、弁当箱が73B2にある。 ((equal (ros::get-param "~demo") "kitchen_car") - (send *problem* :goal-condition + (setq *initial-condition* (cons '(item-in-place lunch-box kitchen-car) *initial-condition*)) + (setq *goal-condition* '((item-in-place lunch-box room-73b2)))) (t (ros::ros-error "Invalid rosparam for ~demo") (exit))) +(send *problem* :initial-condition *initial-condition*) +(send *problem* :goal-condition *goal-condition*) + ;; solve planning (send *problem* :metric '(minimize (total-cost))) (pprint (setq *result* (solve-pddl-planning *domain* *problem*))) From 07164860c2d8f8c464e25590184863fa978c450c Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Tue, 26 Jan 2021 15:19:51 +0900 Subject: [PATCH 07/46] Use only move-with-obj action by introducing none item --- .../solve-cooperation-task.l | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l index fa2c5eab..d277b15c 100755 --- a/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l +++ b/pddl/pddl_planner/demos/2020_obinata_cooperation/solve-cooperation-task.l @@ -47,23 +47,6 @@ $ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car ;; making action (setq *actions* (list - (setq *fetch-move* (instance pddl-action :init - :name "fetch-move" - :parameters '((?from ?to place)) - :precondition '((robot-in-place fetch ?from) - (can-move ?from ?to)) - :effect '((robot-in-place fetch ?to) - (not (robot-in-place fetch ?from)) - (increase (total-cost) (move-cost fetch ?from ?to))))) - (setq *spot-move* (instance pddl-action :init - :name "spot-move" - :parameters '((?from ?to place)) - :precondition '((robot-in-place spot ?from) - (robot-in-place fetch eng2-entrance) - (can-move ?from ?to)) - :effect '((robot-in-place spot ?to) - (not (robot-in-place spot ?from)) - (increase (total-cost) (move-cost spot ?from ?to))))) (setq *fetch-move-with-obj* (instance pddl-action :init :name "fetch-move-with-obj" :parameters '((?item item) (?from ?to place)) @@ -89,7 +72,6 @@ $ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car (not (item-in-place ?item ?from)) (increase (total-cost) (move-cost spot ?from ?to)) ))) - )) ;;add actions to domain @@ -103,6 +85,7 @@ $ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car (send *problem* :objects '( ;; item + (none . item) (document . item) (lunch-box . item) ;; robot @@ -117,10 +100,14 @@ $ roslaunch pddl_planner demo_cooperation_task.launch demo:=kitchen_car (kitchen-car . place))) ;; 初期条件 -(send *problem* :initial-condition +(setq *initial-condition* '(;; 物品・ロボットの初期位置 - (item-in-place lunch-box kitchen-car) - (item-in-place document room-73b2) + (item-in-place none room-73b2) + (item-in-place none elevator) + (item-in-place none stairs) + (item-in-place none office) + (item-in-place none eng2-entrance) + (item-in-place none kitchen-car) (robot-in-place fetch room-73b2) (robot-in-place spot eng2-entrance) ;; 移動可能な場所 From 04fbb905eb77fc5107a8228ff4503b5218dbeced Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 5 Feb 2021 13:48:52 +0900 Subject: [PATCH 08/46] use xdg-open instad of evince. Both installed by ubuntu-desktop package, but as @knorth55 said, xdg-open is replacement for gnome-open --- .../pddl_planner/demos/2008_okada_ias/solve-pour-tea.l | 2 +- .../demos/2011_kakiuchi/solve-cleanup-table.l | 2 +- pddl/pddl_planner/demos/2011_saito/solve-knock-door.l | 2 +- pddl/pddl_planner/demos/2011_saito/solve-simple-task.l | 2 +- .../demos/2011_saito/solve-taking-elevator.l | 2 +- .../demos/2013_fridge_demo/solve-bring-can.l | 2 +- pddl/pddl_planner/demos/2016_kamada_durative/tools.l | 10 +++++----- pddl/pddl_planner/demos/hanoi/solve-hanoi.l | 2 +- .../demos/search_object/solve-search-object.l | 2 +- .../solve-simple-failure-torelant.l | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l index 87584a57..9c446b5d 100755 --- a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l +++ b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l @@ -122,7 +122,7 @@ (send gr :write-to-pdf "okada_ias.pdf") (when (ros::get-param "~display_graph" "true") - (piped-fork "evince okada_ias.pdf")) + (piped-fork "xdg-open okada_ias.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l b/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l index 02717591..f69c659f 100755 --- a/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l +++ b/pddl/pddl_planner/demos/2011_kakiuchi/solve-cleanup-table.l @@ -174,7 +174,7 @@ (send *graph* :write-to-pdf "kakiuchi_robomec.pdf") (when (ros::get-param "~display_graph") - (piped-fork "evince kakiuchi_robomec.pdf")) + (piped-fork "xdg-open kakiuchi_robomec.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l index 02846f9b..b0787b68 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l @@ -186,7 +186,7 @@ ;(send *graph* :write-to-pdf "knock_demo.pdf") ;(when (ros::get-param "~display_graph") -; (piped-fork "evince knock_demo.pdf")) +; (piped-fork "xdg-open knock_demo.pdf")) ;; action definition ;; domain -> package diff --git a/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l b/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l index dc8fe208..eb02f6dd 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-simple-task.l @@ -133,7 +133,7 @@ (send *graph* :write-to-pdf "knock_demo.pdf") (when (ros::get-param "~display_graph") - (piped-fork "evince knock_demo.pdf")) + (piped-fork "xdg-open knock_demo.pdf")) ;; action definition ;; domain -> package diff --git a/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l b/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l index f1d7a4a2..9d93cda7 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-taking-elevator.l @@ -148,7 +148,7 @@ (send *graph* :write-to-pdf "knock_demo.pdf") (when (ros::get-param "~display_graph") - (piped-fork "evince knock_demo.pdf") + (piped-fork "xdg-open knock_demo.pdf") (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l index 17e92c25..e162abf7 100755 --- a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l +++ b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l @@ -151,7 +151,7 @@ (when (and (ros::has-param "~display_graph") (ros::get-param "~display_graph")) - ;;(piped-fork "evince debug.pdf") + ;;(piped-fork "xdg-open debug.pdf") (load "package://roseus_smach/src/pddl2smach.l") (load "package://roseus_smach/src/state-machine-ros.l") diff --git a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l index 07d79d1f..fe8a5275 100644 --- a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l +++ b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l @@ -160,10 +160,10 @@ (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose.dot" ".verbose.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose_separated.dot" ".verbose_separated.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".inter_robot_relationship.dot" ".inter_robot_relationship.pdf")) - (piped-fork "evince .normal.pdf") - (piped-fork "evince .normal_separated.pdf") - (piped-fork "evince .verbose.pdf") - (piped-fork "evince .verbose_separated.pdf") - (piped-fork "evince .inter_robot_relationship.pdf") + (piped-fork "xdg-open .normal.pdf") + (piped-fork "xdg-open .normal_separated.pdf") + (piped-fork "xdg-open .verbose.pdf") + (piped-fork "xdg-open .verbose_separated.pdf") + (piped-fork "xdg-open .inter_robot_relationship.pdf") )) ) diff --git a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l index 5e6bfbaf..22cbd0d3 100755 --- a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l +++ b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l @@ -81,7 +81,7 @@ (send gr :write-to-pdf "hanoi.pdf") (when (ros::get-param "~display_graph" "true") - (piped-fork "evince hanoi.pdf")) + (piped-fork "xdg-open hanoi.pdf")) (when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) (ros::exit)) diff --git a/pddl/pddl_planner/demos/search_object/solve-search-object.l b/pddl/pddl_planner/demos/search_object/solve-search-object.l index dd452b83..c736487b 100755 --- a/pddl/pddl_planner/demos/search_object/solve-search-object.l +++ b/pddl/pddl_planner/demos/search_object/solve-search-object.l @@ -140,7 +140,7 @@ (when (and (ros::has-param "~display_graph") (ros::get-param "~display_graph")) - ;;(piped-fork "evince debug.pdf") + ;;(piped-fork "xdg-open debug.pdf") (load "package://roseus_smach/src/pddl2smach.l") (load "package://roseus_smach/src/state-machine-ros.l") diff --git a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l index 4b4d0645..fa00aa86 100755 --- a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l +++ b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l @@ -72,7 +72,7 @@ (setq *graph* (pddl-plan-to-graph nil :domain *domain* :problem *problem* :failed-nodes *failed-nodes* :debug t)) (send *graph* :write-to-pdf "/tmp/graph.pdf" nil "simple_failure_torelant") - (piped-fork "evince /tmp/graph.pdf") + (piped-fork "xdg-open /tmp/graph.pdf") (require :pddl2smach "package://roseus_smach/src/pddl2smach.l") (require :state-machine-ros "package://roseus_smach/src/state-machine-ros.l") From 6d924e565b356bc80158c82f5d65c62b2978e18d Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 5 Feb 2021 13:56:11 +0900 Subject: [PATCH 09/46] update jsk_travis to 0.5.18 --- .travis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis b/.travis index 74e96892..92c11b11 160000 --- a/.travis +++ b/.travis @@ -1 +1 @@ -Subproject commit 74e968928601f613b2cec821c1a5975baafc1127 +Subproject commit 92c11b11bd185418f12af29c88c04793d1f761b9 From 8a6a8b138a6c3ddbbee417178fab036acb3b6ef0 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 18:42:08 +0900 Subject: [PATCH 10/46] add test to reproduce https://github.com/jsk-ros-pkg/jsk_demos/issues/1286 --- pddl/pddl_planner/test/test-sample-pddl.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pddl/pddl_planner/test/test-sample-pddl.test b/pddl/pddl_planner/test/test-sample-pddl.test index a217b74b..9cc4e160 100644 --- a/pddl/pddl_planner/test/test-sample-pddl.test +++ b/pddl/pddl_planner/test/test-sample-pddl.test @@ -23,4 +23,16 @@ + + + + + + From 7dba75b4c5a61b5d6c1b0f9c607bea7fb066d8d0 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 18:50:14 +0900 Subject: [PATCH 11/46] use shell to run pddl solver --- pddl/pddl_planner/src/pddl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pddl/pddl_planner/src/pddl.py b/pddl/pddl_planner/src/pddl.py index f73b5366..1002964d 100755 --- a/pddl/pddl_planner/src/pddl.py +++ b/pddl/pddl_planner/src/pddl.py @@ -147,7 +147,7 @@ def exec_process(self, command, max_planning_time): if max_planning_time > 0.0: command = ["timeout", str(max_planning_time)] + command rospy.loginfo("Command: %s" % " ".join(command)) - proc = sp.Popen(command, stdout=sp.PIPE, stderr=sp.PIPE) + proc = sp.Popen(" ".join(command), stdout=sp.PIPE, stderr=sp.PIPE, shell=True) try: output, error = str(), str() r = rospy.Rate(10.0) From dfd733cf401e1c9f9af8c664693f5fefad8045ec Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 19:47:11 +0900 Subject: [PATCH 12/46] add pddlresulttest --- pddl/pddl_planner/test/pddlresulttest | 174 ++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100755 pddl/pddl_planner/test/pddlresulttest diff --git a/pddl/pddl_planner/test/pddlresulttest b/pddl/pddl_planner/test/pddlresulttest new file mode 100755 index 00000000..04c53fe4 --- /dev/null +++ b/pddl/pddl_planner/test/pddlresulttest @@ -0,0 +1,174 @@ +#!/usr/bin/env python +############################################################################### +# Software License Agreement (BSD License) +# +# Copyright (c) 2016, Kentaro Wada. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Willow Garage, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +############################################################################### + +""" +Integration test node that subscribes to +topic (/pddl_ner/result) and verifies it's contents + +below parameters must be set: + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] + + + +Author: Kentaro Wada +Modified for PddlResultTest by +""" +from __future__ import print_function + +import sys +import time +import unittest + +import rospy +import rostopic + +from pddl_msgs.msg import PDDLPlannerActionResult +from pddl_msgs.msg import PDDLPlannerResult +from pddl_msgs.msg import PDDLStep + +PKG = 'pddl_planner' +NAME = 'pddlresulttest' + + +class PddlResultChecker(object): + def __init__(self, topic_name, timeout, result): + self.topic_name = topic_name + self.deadline = rospy.Time.now() + rospy.Duration(timeout) + self.result = result + self.msg = None + rospy.loginfo("subscribing {}".format(topic_name)) + rospy.loginfo(" - use_durative_action: {}".format(result.use_durative_action)) + rospy.loginfo(" - sequence: {}".format(result.sequence)) + self.sub = rospy.Subscriber(topic_name, PDDLPlannerActionResult, self._callback) + + def _callback(self, msg): + message_matched = True + + rospy.loginfo("received msg") + if not self.result.use_durative_action == None: + rospy.loginfo(" - use_durative_action: {}".format(msg.result.use_durative_action)) + if not msg.result.use_durative_action == self.result.use_durative_action: + rospy.loginfo(" expecting: {}".format(self.result.use_durative_action)) + message_matched = False + if not self.result.sequence == None: + rospy.loginfo(" - sequence: {}".format(msg.result.sequence)) + if not msg.result.sequence == self.result.sequence: + rospy.loginfo(" expecting : {}".format(self.result.sequence)) + message_matched = False + + if message_matched: + self.msg = msg + + def assert_published(self): + if self.msg: + return True + if rospy.Time.now() > self.deadline: + return False + return None + + +class PddlResultTest(unittest.TestCase): + def __init__(self, *args): + super(self.__class__, self).__init__(*args) + rospy.init_node(NAME) + # scrape rosparam + self.topics = [] + params = rospy.get_param('~topics', []) + for param in params: + if 'name' not in param: + self.fail("'name' field in rosparam is required but not specified.") + topic = {'timeout': 10, 'use_durative_action': False, 'sequence_action': [], 'sequence_start_time': [], 'sequence_duration': []} + topic.update(param) + self.topics.append(topic) + # check if there is at least one topic + if not self.topics: + self.fail('No topic is specified in rosparam.') + + def test_publish(self): + """Test topics are published and messages come""" + use_sim_time = rospy.get_param('/use_sim_time', False) + t_start = time.time() + while not rospy.is_shutdown() and \ + use_sim_time and (rospy.Time.now() == rospy.Time(0)): + rospy.logwarn_throttle( + 1, '/use_sim_time is specified and rostime is 0, /clock is published?') + if time.time() - t_start > 10: + self.fail('Timed out (10s) of /clock publication.') + # must use time.sleep because /clock isn't yet published, so rospy.sleep hangs. + time.sleep(0.1) + # subscribe topics + checkers = [] + for topic in self.topics: + topic_name = topic['name'] + timeout = topic['timeout'] + result = PDDLPlannerResult() + result.use_durative_action = topic['use_durative_action'] + result.sequence = map(lambda a, s, d: PDDLStep(action = a.split()[0], + args = a.split()[1:], + start_time = s or '', + action_duration = d or ''), + topic['sequence_action'], + topic['sequence_start_time'], + topic['sequence_duration']) + + checkers.append(PddlResultChecker(topic_name, timeout, result)) + deadline = max(checker.deadline for checker in checkers) + # assert + finished_topics = [] + while not rospy.is_shutdown(): + if len(self.topics) == len(finished_topics): + break + for checker in checkers: + if checker.topic_name in finished_topics: + continue # skip topic testing has finished + ret = checker.assert_published() + if ret is None: + continue # skip if there is no test result + finished_topics.append(checker.topic_name) + assert ret, 'Topic [%s] is not published' % (checker.topic_name) + rospy.sleep(0.01) + + +if __name__ == '__main__': + import rostest + rostest.run(PKG, NAME, PddlResultTest, sys.argv) From 26ac6dc7828dd1d0c4d7c5634952fc8169757588 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 19:47:35 +0900 Subject: [PATCH 13/46] use display_graph argument for launch file to skip gnome-open pdf demos/2008_okada_ias/demo_pour_tea.launch demos/2011_kakiuchi/demo_cleanup_table.launch demos/2011_saito/demo-knock-door.launch demos/2011_saito/demo-simple-task.launch demos/2011_saito/demo-taking-elevator.launch demos/simple_failure_torelant/demo_simple_failure_torelant.launch demos/2013_fridge_demo/demo_bring_can.launch demos/hanoi/demo_hanoi.launch --- pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch | 3 ++- .../pddl_planner/demos/2011_kakiuchi/demo_cleanup_table.launch | 3 ++- pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch | 3 ++- pddl/pddl_planner/demos/2011_saito/demo-simple-task.launch | 3 ++- pddl/pddl_planner/demos/2011_saito/demo-taking-elevator.launch | 3 ++- pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch | 3 ++- pddl/pddl_planner/demos/hanoi/demo_hanoi.launch | 3 ++- .../demo_simple_failure_torelant.launch | 2 ++ 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch b/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch index bb7c515a..a72a9999 100644 --- a/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch +++ b/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch @@ -1,7 +1,8 @@ + - + diff --git a/pddl/pddl_planner/demos/2011_kakiuchi/demo_cleanup_table.launch b/pddl/pddl_planner/demos/2011_kakiuchi/demo_cleanup_table.launch index da130594..6b49647b 100644 --- a/pddl/pddl_planner/demos/2011_kakiuchi/demo_cleanup_table.launch +++ b/pddl/pddl_planner/demos/2011_kakiuchi/demo_cleanup_table.launch @@ -1,7 +1,8 @@ + - + diff --git a/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch b/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch index f24d4dc4..fe5191ac 100644 --- a/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch +++ b/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch @@ -1,8 +1,9 @@ + - + diff --git a/pddl/pddl_planner/demos/2011_saito/demo-simple-task.launch b/pddl/pddl_planner/demos/2011_saito/demo-simple-task.launch index 4fdb2e45..f93bbc2c 100644 --- a/pddl/pddl_planner/demos/2011_saito/demo-simple-task.launch +++ b/pddl/pddl_planner/demos/2011_saito/demo-simple-task.launch @@ -1,8 +1,9 @@ + - + diff --git a/pddl/pddl_planner/demos/2011_saito/demo-taking-elevator.launch b/pddl/pddl_planner/demos/2011_saito/demo-taking-elevator.launch index 5ec98491..bbd14222 100644 --- a/pddl/pddl_planner/demos/2011_saito/demo-taking-elevator.launch +++ b/pddl/pddl_planner/demos/2011_saito/demo-taking-elevator.launch @@ -1,7 +1,8 @@ + - + diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch b/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch index a2c4e031..3f61b35c 100644 --- a/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch +++ b/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch @@ -1,8 +1,9 @@ + - + diff --git a/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch b/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch index add26b40..8a874bed 100644 --- a/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch +++ b/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch @@ -1,7 +1,8 @@ + - + diff --git a/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch b/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch index 3f1de12d..543ae072 100644 --- a/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch +++ b/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch @@ -1,9 +1,11 @@ + + From fc73738e9e8a28d456a4b68981f4f0eb6b04708f Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 21:55:00 +0900 Subject: [PATCH 14/46] gnome-open .pdf only when ~display_graph is set --- pddl/pddl_planner/demos/2011_saito/solve-knock-door.l | 6 +++--- .../demos/2013_fridge_demo/solve-bring-can.l | 3 ++- pddl/pddl_planner/demos/2016_kamada_durative/tools.l | 11 ++++++----- .../solve-simple-failure-torelant.l | 7 +++++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l index b0787b68..d2581a73 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l @@ -184,9 +184,9 @@ (send *graph* :name (send *domain* :name)) -;(send *graph* :write-to-pdf "knock_demo.pdf") -;(when (ros::get-param "~display_graph") -; (piped-fork "xdg-open knock_demo.pdf")) +(send *graph* :write-to-pdf "knock_demo.pdf") +(when (ros::get-param "~display_graph") + (piped-fork "xdg-open knock_demo.pdf")) ;; action definition ;; domain -> package diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l index e162abf7..45df94ed 100755 --- a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l +++ b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l @@ -151,7 +151,8 @@ (when (and (ros::has-param "~display_graph") (ros::get-param "~display_graph")) - ;;(piped-fork "xdg-open debug.pdf") + + (piped-fork "xdg-open debug.pdf") (load "package://roseus_smach/src/pddl2smach.l") (load "package://roseus_smach/src/state-machine-ros.l") diff --git a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l index fe8a5275..29a23437 100644 --- a/pddl/pddl_planner/demos/2016_kamada_durative/tools.l +++ b/pddl/pddl_planner/demos/2016_kamada_durative/tools.l @@ -160,10 +160,11 @@ (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose.dot" ".verbose.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".verbose_separated.dot" ".verbose_separated.pdf")) (unix:system (format nil "dot ~A -Tpdf -o ~A" ".inter_robot_relationship.dot" ".inter_robot_relationship.pdf")) - (piped-fork "xdg-open .normal.pdf") - (piped-fork "xdg-open .normal_separated.pdf") - (piped-fork "xdg-open .verbose.pdf") - (piped-fork "xdg-open .verbose_separated.pdf") - (piped-fork "xdg-open .inter_robot_relationship.pdf") + (when (ros::get-param "~display_graph") + (piped-fork "xdg-open .normal.pdf") + (piped-fork "xdg-open .normal_separated.pdf") + (piped-fork "xdg-open .verbose.pdf") + (piped-fork "xdg-open .verbose_separated.pdf") + (piped-fork "xdg-open .inter_robot_relationship.pdf") )) ) diff --git a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l index fa00aa86..ae10c75f 100755 --- a/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l +++ b/pddl/pddl_planner/demos/simple_failure_torelant/solve-simple-failure-torelant.l @@ -71,8 +71,11 @@ (require :pddl-result-graph "package://pddl_planner/src/pddl-result-graph.l") (setq *graph* (pddl-plan-to-graph nil :domain *domain* :problem *problem* :failed-nodes *failed-nodes* :debug t)) - (send *graph* :write-to-pdf "/tmp/graph.pdf" nil "simple_failure_torelant") - (piped-fork "xdg-open /tmp/graph.pdf") + (when (and (ros::has-param "~display_graph") + (ros::get-param "~display_graph")) + (send *graph* :write-to-pdf "/tmp/graph.pdf" nil "simple_failure_torelant") + (piped-fork "xdg-open /tmp/graph.pdf") + ) (require :pddl2smach "package://roseus_smach/src/pddl2smach.l") (require :state-machine-ros "package://roseus_smach/src/state-machine-ros.l") From 116e89431073fcebf8cc135473d43f4b3fd55de3 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 21:56:06 +0900 Subject: [PATCH 15/46] 2016_kamada_durative: demo.launch,example.launch starts euslisp file too, for complete example --- pddl/pddl_planner/demos/2016_kamada_durative/demo.launch | 6 ++++++ .../pddl_planner/demos/2016_kamada_durative/example.launch | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/pddl/pddl_planner/demos/2016_kamada_durative/demo.launch b/pddl/pddl_planner/demos/2016_kamada_durative/demo.launch index 9ae2b95f..eb109e03 100644 --- a/pddl/pddl_planner/demos/2016_kamada_durative/demo.launch +++ b/pddl/pddl_planner/demos/2016_kamada_durative/demo.launch @@ -1,4 +1,5 @@ + + + + diff --git a/pddl/pddl_planner/demos/2016_kamada_durative/example.launch b/pddl/pddl_planner/demos/2016_kamada_durative/example.launch index 5ff24fa5..ed8e4293 100644 --- a/pddl/pddl_planner/demos/2016_kamada_durative/example.launch +++ b/pddl/pddl_planner/demos/2016_kamada_durative/example.launch @@ -1,4 +1,6 @@ + + + + + From 6244f43126c70bdf6e70a4caebd637fbec8d32b4 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 21:58:05 +0900 Subject: [PATCH 16/46] add simple_metric/simple_metric.launch --- .../demos/simple_metric/simple_metric.launch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pddl/pddl_planner/demos/simple_metric/simple_metric.launch diff --git a/pddl/pddl_planner/demos/simple_metric/simple_metric.launch b/pddl/pddl_planner/demos/simple_metric/simple_metric.launch new file mode 100644 index 00000000..09ed0b11 --- /dev/null +++ b/pddl/pddl_planner/demos/simple_metric/simple_metric.launch @@ -0,0 +1,14 @@ + + + + + + + + + + + From 1c0621cd1491d28d2ff35d655e4f6450e5dbe335 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 21:59:51 +0900 Subject: [PATCH 17/46] add pddl result test for demo --- pddl/pddl_planner/test/2008_okada_ias.test | 26 +++++++++ pddl/pddl_planner/test/2011_kakiuchi.test | 46 +++++++++++++++ .../test/2011_saito_knock_door.test | 46 +++++++++++++++ pddl/pddl_planner/test/2011_saito_simple.test | 16 ++++++ pddl/pddl_planner/test/2013_fridge_demo.test | 56 +++++++++++++++++++ .../test/2016_kamada_durative.test | 34 +++++++++++ pddl/pddl_planner/test/demos_hanoi.test | 16 ++++++ .../test/simple_failure_torelant.test | 26 +++++++++ pddl/pddl_planner/test/simple_metric.test | 16 ++++++ 9 files changed, 282 insertions(+) create mode 100644 pddl/pddl_planner/test/2008_okada_ias.test create mode 100644 pddl/pddl_planner/test/2011_kakiuchi.test create mode 100644 pddl/pddl_planner/test/2011_saito_knock_door.test create mode 100644 pddl/pddl_planner/test/2011_saito_simple.test create mode 100644 pddl/pddl_planner/test/2013_fridge_demo.test create mode 100644 pddl/pddl_planner/test/2016_kamada_durative.test create mode 100644 pddl/pddl_planner/test/demos_hanoi.test create mode 100644 pddl/pddl_planner/test/simple_failure_torelant.test create mode 100644 pddl/pddl_planner/test/simple_metric.test diff --git a/pddl/pddl_planner/test/2008_okada_ias.test b/pddl/pddl_planner/test/2008_okada_ias.test new file mode 100644 index 00000000..fe80df27 --- /dev/null +++ b/pddl/pddl_planner/test/2008_okada_ias.test @@ -0,0 +1,26 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] + + + diff --git a/pddl/pddl_planner/test/2011_kakiuchi.test b/pddl/pddl_planner/test/2011_kakiuchi.test new file mode 100644 index 00000000..5f5cbbc1 --- /dev/null +++ b/pddl/pddl_planner/test/2011_kakiuchi.test @@ -0,0 +1,46 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(SEARCH)', '(MOVE START TABLE)', '(CHECKCLEAR)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(SEARCH)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(SEARCH)', '(MOVE TABLE TRASHBOX)', '(DISPOSE)', '(CONFIRM TABLE)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(PICK TRASH TABLE)', '(CONFIRM TRASHBOX)', '(MOVE TABLE TRASHBOX)', '(DISPOSE)', '(CONFIRM TABLE)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] + + + diff --git a/pddl/pddl_planner/test/2011_saito_knock_door.test b/pddl/pddl_planner/test/2011_saito_knock_door.test new file mode 100644 index 00000000..8894701b --- /dev/null +++ b/pddl/pddl_planner/test/2011_saito_knock_door.test @@ -0,0 +1,46 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(WIPE SAITO-TABLE)', '(MOVE RM73A3-CENTER SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(PUT SANDWITCH SAITO-TABLE)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE RM73B2-DOORFRONT SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(WIPE SAITO-TABLE)', '(PUT SANDWITCH SAITO-TABLE)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(WIPE RM73B2-TABLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER TRASHBOXFRONT)', '(PUT PLASTIC-BOTTLE TRASHBOX)', '(MOVE TRASHBOXFRONT RM73A3-CENTER)'] + + + diff --git a/pddl/pddl_planner/test/2011_saito_simple.test b/pddl/pddl_planner/test/2011_saito_simple.test new file mode 100644 index 00000000..c8890015 --- /dev/null +++ b/pddl/pddl_planner/test/2011_saito_simple.test @@ -0,0 +1,16 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(KNOCK DOOR)', '(MOVE ROOM-FRONT ROOM-INSIDE)', '(WIPE DESK)'] + + + diff --git a/pddl/pddl_planner/test/2013_fridge_demo.test b/pddl/pddl_planner/test/2013_fridge_demo.test new file mode 100644 index 00000000..f9ad4667 --- /dev/null +++ b/pddl/pddl_planner/test/2013_fridge_demo.test @@ -0,0 +1,56 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE-TO START FRONTFRIDGE)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START SOMEWHERE)', '(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] + + + diff --git a/pddl/pddl_planner/test/2016_kamada_durative.test b/pddl/pddl_planner/test/2016_kamada_durative.test new file mode 100644 index 00000000..639a9100 --- /dev/null +++ b/pddl/pddl_planner/test/2016_kamada_durative.test @@ -0,0 +1,34 @@ + + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 30 + negative: False + + + + diff --git a/pddl/pddl_planner/test/demos_hanoi.test b/pddl/pddl_planner/test/demos_hanoi.test new file mode 100644 index 00000000..5181f5fc --- /dev/null +++ b/pddl/pddl_planner/test/demos_hanoi.test @@ -0,0 +1,16 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(MOVE DISK0 DISK1 POLE2)', '(MOVE DISK1 DISK2 POLE1)', '(MOVE DISK0 POLE2 DISK1)', '(MOVE DISK2 POLE0 POLE2)', '(MOVE DISK0 DISK1 POLE0)', '(MOVE DISK1 POLE1 DISK2)', '(MOVE DISK0 POLE0 DISK1)'] + + + diff --git a/pddl/pddl_planner/test/simple_failure_torelant.test b/pddl/pddl_planner/test/simple_failure_torelant.test new file mode 100644 index 00000000..484b175e --- /dev/null +++ b/pddl/pddl_planner/test/simple_failure_torelant.test @@ -0,0 +1,26 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(look elevator-button)', '(push-button elevator-button)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(move-to elevator)', '(look elevator-button)', '(push-button elevator-button)'] + + + diff --git a/pddl/pddl_planner/test/simple_metric.test b/pddl/pddl_planner/test/simple_metric.test new file mode 100644 index 00000000..45ff96a2 --- /dev/null +++ b/pddl/pddl_planner/test/simple_metric.test @@ -0,0 +1,16 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(ACT1 OBJ1)', '(ACT2 OBJ1)'] + + + From cd0fedb4101c1591df94254366bd066c68cb9f2a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 22:01:33 +0900 Subject: [PATCH 18/46] add_rostest for test directory --- pddl/pddl_planner/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pddl/pddl_planner/CMakeLists.txt b/pddl/pddl_planner/CMakeLists.txt index 1f16513d..367333e5 100644 --- a/pddl/pddl_planner/CMakeLists.txt +++ b/pddl/pddl_planner/CMakeLists.txt @@ -14,4 +14,13 @@ if(CATKIN_ENABLE_TESTING) add_rostest(test/test-simple-failure-torelant.test) add_rostest(test/test-sample-pddl.test) add_rostest(test/test-durative-two-robot-tablecloth.test) + add_rostest(test/2008_okada_ias.test) + add_rostest(test/2011_kakiuchi.test) + add_rostest(test/2011_saito_knock_door.test) + add_rostest(test/2011_saito_simple.test) + add_rostest(test/2013_fridge_demo.test) + ## add_rostest(test/2016_kamada_durative.test) ## this requries lpg_planner, which is needs source install + add_rostest(test/demos_hanoi.test) + add_rostest(test/simple_failure_torelant.test) + add_rostest(test/simple_metric.test) endif() From 6013b33acd32cd92b567ee44610da3e6cd942c46 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Fri, 19 Jun 2020 16:11:13 +0900 Subject: [PATCH 19/46] [pddl_planner/demos/search_object] fix bug, and add launch file --- .../demos/search_object/demo_search_object.launch | 12 ++++++++++++ .../demos/search_object/solve-search-object.l | 6 ++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 pddl/pddl_planner/demos/search_object/demo_search_object.launch diff --git a/pddl/pddl_planner/demos/search_object/demo_search_object.launch b/pddl/pddl_planner/demos/search_object/demo_search_object.launch new file mode 100644 index 00000000..024b2261 --- /dev/null +++ b/pddl/pddl_planner/demos/search_object/demo_search_object.launch @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/pddl/pddl_planner/demos/search_object/solve-search-object.l b/pddl/pddl_planner/demos/search_object/solve-search-object.l index c736487b..64a7d630 100755 --- a/pddl/pddl_planner/demos/search_object/solve-search-object.l +++ b/pddl/pddl_planner/demos/search_object/solve-search-object.l @@ -125,14 +125,12 @@ ;; ;; normal plan -(pprint (setq *result* (solve-pddl-planning *domain* *problem* :debug nil))) +(setq *graph* (pddl-plan-to-graph nil :domain *domain* :problem *problem* :failed-nodes (list 'detect :debug nil))) ;; there is no target object in environment (pprint (setq *result-fail-end* (solve-pddl-planning *domain* *problem-fail-end* :debug nil))) -;; at first, make graph from failed plan (because failed plan does not contain success detection) -(setq *graph* (make-graph-from-pddl-results (list *result-fail-end*) :node-name :pprint)) ;; merge 2 results and adding failure -(setq *graph* (add-failed-nodes *result* (list 'detect) :graph *graph*)) +(setq *graph* (make-graph-from-pddl-results (list *result-fail-end*) :node-name :pprint :graph *graph*)) (make-readable-graph *graph* :copy nil) From e027b64850d5437bd965f3f373132838150eaee5 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 3 Mar 2021 22:12:12 +0900 Subject: [PATCH 20/46] demos/search_object: use display_graph to gnome-open pdf --- .../demos/search_object/demo_search_object.launch | 3 ++- pddl/pddl_planner/demos/search_object/solve-search-object.l | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pddl/pddl_planner/demos/search_object/demo_search_object.launch b/pddl/pddl_planner/demos/search_object/demo_search_object.launch index 024b2261..3ab39f37 100644 --- a/pddl/pddl_planner/demos/search_object/demo_search_object.launch +++ b/pddl/pddl_planner/demos/search_object/demo_search_object.launch @@ -1,10 +1,11 @@ + - + Date: Wed, 3 Mar 2021 22:16:52 +0900 Subject: [PATCH 21/46] add add_rostest(test/search_object.test) --- pddl/pddl_planner/CMakeLists.txt | 1 + pddl/pddl_planner/test/search_object.test | 46 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pddl/pddl_planner/test/search_object.test diff --git a/pddl/pddl_planner/CMakeLists.txt b/pddl/pddl_planner/CMakeLists.txt index 367333e5..f0249f15 100644 --- a/pddl/pddl_planner/CMakeLists.txt +++ b/pddl/pddl_planner/CMakeLists.txt @@ -21,6 +21,7 @@ if(CATKIN_ENABLE_TESTING) add_rostest(test/2013_fridge_demo.test) ## add_rostest(test/2016_kamada_durative.test) ## this requries lpg_planner, which is needs source install add_rostest(test/demos_hanoi.test) + add_rostest(test/search_object.test) add_rostest(test/simple_failure_torelant.test) add_rostest(test/simple_metric.test) endif() diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test new file mode 100644 index 00000000..a4833b5e --- /dev/null +++ b/pddl/pddl_planner/test/search_object.test @@ -0,0 +1,46 @@ + + + + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect boxa)', '(grasp boxa)', '(close-box boxa)', '(move-to end)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect boxb)', '(grasp boxb)', '(close-box boxb)', '(move-to end)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect boxc)', '(grasp boxc)', '(close-box boxc)', '(move-to end)'] + + + + + topics: + - name: /pddl_planner/result + timeout: 10 + sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect_f boxa)', '(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect_f boxb)', '(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect_f boxc)', '(close-box boxc)', '(move-to end)'] + + + From 8ddada05783394dc142f3c86b6f3efb35825e3b3 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 5 Mar 2021 05:53:34 +0000 Subject: [PATCH 22/46] pddlresulttest: support multiple sequence at once --- pddl/pddl_planner/test/pddlresulttest | 78 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/pddl/pddl_planner/test/pddlresulttest b/pddl/pddl_planner/test/pddlresulttest index 04c53fe4..d9dfd41c 100755 --- a/pddl/pddl_planner/test/pddlresulttest +++ b/pddl/pddl_planner/test/pddlresulttest @@ -69,38 +69,63 @@ from pddl_msgs.msg import PDDLStep PKG = 'pddl_planner' NAME = 'pddlresulttest' - class PddlResultChecker(object): def __init__(self, topic_name, timeout, result): self.topic_name = topic_name - self.deadline = rospy.Time.now() + rospy.Duration(timeout) - self.result = result - self.msg = None rospy.loginfo("subscribing {}".format(topic_name)) - rospy.loginfo(" - use_durative_action: {}".format(result.use_durative_action)) - rospy.loginfo(" - sequence: {}".format(result.sequence)) + self.targets = [] + self.deadline = None + self.add_callback(timeout, result) self.sub = rospy.Subscriber(topic_name, PDDLPlannerActionResult, self._callback) def _callback(self, msg): - message_matched = True rospy.loginfo("received msg") - if not self.result.use_durative_action == None: - rospy.loginfo(" - use_durative_action: {}".format(msg.result.use_durative_action)) - if not msg.result.use_durative_action == self.result.use_durative_action: - rospy.loginfo(" expecting: {}".format(self.result.use_durative_action)) - message_matched = False - if not self.result.sequence == None: - rospy.loginfo(" - sequence: {}".format(msg.result.sequence)) - if not msg.result.sequence == self.result.sequence: - rospy.loginfo(" expecting : {}".format(self.result.sequence)) - message_matched = False - - if message_matched: - self.msg = msg + rospy.loginfo(" - use_durative_action: {}".format(msg.result.use_durative_action)) + rospy.loginfo(" - sequence: {}".format(map(lambda x: x.action + " ".join(x.args), msg.result.sequence))) + rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, msg.result.sequence), + map(lambda x: x.action_duration, msg.result.sequence))) + for target in self.targets: + message_matched = True + result = target['result'] + + if target['msg_matched']: + rospy.loginfo(" msg already passed {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) + continue + + + if not result.use_durative_action == None: + if not msg.result.use_durative_action == result.use_durative_action: + rospy.loginfo(" expecting: {}".format(result.use_durative_action)) + message_matched = False + if not result.sequence == None: + if not msg.result.sequence == result.sequence: + rospy.loginfo(" expecting : {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) + rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), + map(lambda x: x.action_duration, result.sequence))) + message_matched = False + + if message_matched: + target['msg_matched'] = msg + rospy.loginfo("message matched to {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) + rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), + map(lambda x: x.action_duration, result.sequence))) + + def add_callback(self, timeout, result): + rospy.loginfo("register to check {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) + rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), + map(lambda x: x.action_duration, result.sequence))) + rospy.loginfo(" within {} sec".format(timeout)) + + deadline_ = rospy.Time.now() + rospy.Duration(timeout) + self.targets.append({'deadline': deadline_ , 'result': result, 'msg_matched': None}) + if self.deadline: + self.deadline = max(self.deadline, deadline_) + else: + self.deadline = deadline_ def assert_published(self): - if self.msg: + if all(target['msg_matched'] for target in self.targets): return True if rospy.Time.now() > self.deadline: return False @@ -151,12 +176,19 @@ class PddlResultTest(unittest.TestCase): topic['sequence_start_time'], topic['sequence_duration']) - checkers.append(PddlResultChecker(topic_name, timeout, result)) + # check if already subscribe topic + checker = next((x for x in checkers if x.topic_name == topic_name), None) + if checker == None: + checkers.append(PddlResultChecker(topic_name, timeout, result)) + else: + checker.add_callback(timeout, result) + deadline = max(checker.deadline for checker in checkers) # assert finished_topics = [] while not rospy.is_shutdown(): - if len(self.topics) == len(finished_topics): + if len(set([topic['name'] for topic in self.topics])) == len(finished_topics): + assert True, 'Check all topics [%s] successfully' % (fnished_topics) break for checker in checkers: if checker.topic_name in finished_topics: From f9c21181cbe30fa5bb39ee63388c50769e25cb72 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Fri, 5 Mar 2021 05:58:10 +0000 Subject: [PATCH 23/46] test multiple sequence_action at once --- pddl/pddl_planner/test/2008_okada_ias.test | 9 +----- pddl/pddl_planner/test/2011_kakiuchi.test | 21 -------------- .../test/2011_saito_knock_door.test | 21 -------------- pddl/pddl_planner/test/2013_fridge_demo.test | 28 ------------------- pddl/pddl_planner/test/search_object.test | 21 -------------- .../test/simple_failure_torelant.test | 7 ----- 6 files changed, 1 insertion(+), 106 deletions(-) diff --git a/pddl/pddl_planner/test/2008_okada_ias.test b/pddl/pddl_planner/test/2008_okada_ias.test index fe80df27..599b2b10 100644 --- a/pddl/pddl_planner/test/2008_okada_ias.test +++ b/pddl/pddl_planner/test/2008_okada_ias.test @@ -11,16 +11,9 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 - sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] + sequence_action: ['(HOLD CUP LARM BAR)', '(HOLD BOTTLE RARM BAR)', '(POUR-TEA)', '(PLACE CUP LARM BAR)', '(PLACE BOTTLE RARM BAR)'] diff --git a/pddl/pddl_planner/test/2011_kakiuchi.test b/pddl/pddl_planner/test/2011_kakiuchi.test index 5f5cbbc1..bc02e162 100644 --- a/pddl/pddl_planner/test/2011_kakiuchi.test +++ b/pddl/pddl_planner/test/2011_kakiuchi.test @@ -11,33 +11,12 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(SEARCH)', '(MOVE START TABLE)', '(CHECKCLEAR)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(SEARCH)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(SEARCH)', '(MOVE TABLE TRASHBOX)', '(DISPOSE)', '(CONFIRM TABLE)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(PICK TRASH TABLE)', '(CONFIRM TRASHBOX)', '(MOVE TABLE TRASHBOX)', '(DISPOSE)', '(CONFIRM TABLE)', '(MOVE TRASHBOX TABLE)', '(CHECKCLEAR)'] diff --git a/pddl/pddl_planner/test/2011_saito_knock_door.test b/pddl/pddl_planner/test/2011_saito_knock_door.test index 8894701b..100eac86 100644 --- a/pddl/pddl_planner/test/2011_saito_knock_door.test +++ b/pddl/pddl_planner/test/2011_saito_knock_door.test @@ -11,33 +11,12 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(WIPE SAITO-TABLE)', '(MOVE RM73A3-CENTER SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(PUT SANDWITCH SAITO-TABLE)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE RM73B2-DOORFRONT SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(WIPE SAITO-TABLE)', '(PUT SANDWITCH SAITO-TABLE)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(WIPE RM73B2-TABLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER TRASHBOXFRONT)', '(PUT PLASTIC-BOTTLE TRASHBOX)', '(MOVE TRASHBOXFRONT RM73A3-CENTER)'] diff --git a/pddl/pddl_planner/test/2013_fridge_demo.test b/pddl/pddl_planner/test/2013_fridge_demo.test index f9ad4667..e7c7ba91 100644 --- a/pddl/pddl_planner/test/2013_fridge_demo.test +++ b/pddl/pddl_planner/test/2013_fridge_demo.test @@ -11,43 +11,15 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(MOVE-TO START FRONTFRIDGE)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START SOMEWHERE)', '(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test index a4833b5e..3d64a123 100644 --- a/pddl/pddl_planner/test/search_object.test +++ b/pddl/pddl_planner/test/search_object.test @@ -11,33 +11,12 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect boxa)', '(grasp boxa)', '(close-box boxa)', '(move-to end)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect boxb)', '(grasp boxb)', '(close-box boxb)', '(move-to end)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect boxc)', '(grasp boxc)', '(close-box boxc)', '(move-to end)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect_f boxa)', '(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect_f boxb)', '(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect_f boxc)', '(close-box boxc)', '(move-to end)'] diff --git a/pddl/pddl_planner/test/simple_failure_torelant.test b/pddl/pddl_planner/test/simple_failure_torelant.test index 484b175e..af245c04 100644 --- a/pddl/pddl_planner/test/simple_failure_torelant.test +++ b/pddl/pddl_planner/test/simple_failure_torelant.test @@ -11,13 +11,6 @@ - name: /pddl_planner/result timeout: 10 sequence_action: ['(look elevator-button)', '(push-button elevator-button)'] - - - - - topics: - name: /pddl_planner/result timeout: 10 sequence_action: ['(move-to elevator)', '(look elevator-button)', '(push-button elevator-button)'] From 88f2809fb3926254b05d0f016fc1c41843454a0a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 6 Mar 2021 16:21:00 +0900 Subject: [PATCH 24/46] use proc.returncode instead of proc.poll() --- pddl/pddl_planner/src/pddl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pddl/pddl_planner/src/pddl.py b/pddl/pddl_planner/src/pddl.py index f73b5366..5dbb90c5 100755 --- a/pddl/pddl_planner/src/pddl.py +++ b/pddl/pddl_planner/src/pddl.py @@ -168,7 +168,7 @@ def exec_process(self, command, max_planning_time): output += data[0] error += data[1] - if proc.poll() not in [0, 124]: + if proc.returncode not in [0, 124]: # 0: normal exit # 124: exited with timeout command # others: process exited abnormally From 3c671eeb16f38ed540f084936f9f037545ec39dc Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 6 Mar 2021 16:21:24 +0900 Subject: [PATCH 25/46] use unique test-name --- pddl/pddl_planner/test/2008_okada_ias.test | 4 ++-- pddl/pddl_planner/test/2011_kakiuchi.test | 4 ++-- pddl/pddl_planner/test/2011_saito_knock_door.test | 4 ++-- pddl/pddl_planner/test/2011_saito_simple.test | 2 +- pddl/pddl_planner/test/2013_fridge_demo.test | 4 ++-- pddl/pddl_planner/test/2016_kamada_durative.test | 2 +- pddl/pddl_planner/test/demos_hanoi.test | 2 +- pddl/pddl_planner/test/search_object.test | 4 ++-- pddl/pddl_planner/test/simple_failure_torelant.test | 4 ++-- pddl/pddl_planner/test/simple_metric.test | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pddl/pddl_planner/test/2008_okada_ias.test b/pddl/pddl_planner/test/2008_okada_ias.test index 599b2b10..8211d97b 100644 --- a/pddl/pddl_planner/test/2008_okada_ias.test +++ b/pddl/pddl_planner/test/2008_okada_ias.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/2011_kakiuchi.test b/pddl/pddl_planner/test/2011_kakiuchi.test index bc02e162..f3c95476 100644 --- a/pddl/pddl_planner/test/2011_kakiuchi.test +++ b/pddl/pddl_planner/test/2011_kakiuchi.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/2011_saito_knock_door.test b/pddl/pddl_planner/test/2011_saito_knock_door.test index 100eac86..48196604 100644 --- a/pddl/pddl_planner/test/2011_saito_knock_door.test +++ b/pddl/pddl_planner/test/2011_saito_knock_door.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/2011_saito_simple.test b/pddl/pddl_planner/test/2011_saito_simple.test index c8890015..e95771c8 100644 --- a/pddl/pddl_planner/test/2011_saito_simple.test +++ b/pddl/pddl_planner/test/2011_saito_simple.test @@ -4,7 +4,7 @@ topics: diff --git a/pddl/pddl_planner/test/2013_fridge_demo.test b/pddl/pddl_planner/test/2013_fridge_demo.test index e7c7ba91..6adafb8a 100644 --- a/pddl/pddl_planner/test/2013_fridge_demo.test +++ b/pddl/pddl_planner/test/2013_fridge_demo.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/2016_kamada_durative.test b/pddl/pddl_planner/test/2016_kamada_durative.test index 639a9100..52b7533b 100644 --- a/pddl/pddl_planner/test/2016_kamada_durative.test +++ b/pddl/pddl_planner/test/2016_kamada_durative.test @@ -5,7 +5,7 @@ topics: diff --git a/pddl/pddl_planner/test/demos_hanoi.test b/pddl/pddl_planner/test/demos_hanoi.test index 5181f5fc..a786baad 100644 --- a/pddl/pddl_planner/test/demos_hanoi.test +++ b/pddl/pddl_planner/test/demos_hanoi.test @@ -4,7 +4,7 @@ topics: diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test index 3d64a123..7a4621ef 100644 --- a/pddl/pddl_planner/test/search_object.test +++ b/pddl/pddl_planner/test/search_object.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/simple_failure_torelant.test b/pddl/pddl_planner/test/simple_failure_torelant.test index af245c04..9098b700 100644 --- a/pddl/pddl_planner/test/simple_failure_torelant.test +++ b/pddl/pddl_planner/test/simple_failure_torelant.test @@ -3,8 +3,8 @@ - topics: diff --git a/pddl/pddl_planner/test/simple_metric.test b/pddl/pddl_planner/test/simple_metric.test index 45ff96a2..20b3bd95 100644 --- a/pddl/pddl_planner/test/simple_metric.test +++ b/pddl/pddl_planner/test/simple_metric.test @@ -3,8 +3,8 @@ - topics: From 066975ae22a802f6a102faa5696de0dff4bd55b0 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 6 Mar 2021 18:16:00 +0900 Subject: [PATCH 26/46] search_object/simple_failure_torelant : run euslisp planning script with repeat.sh --- .../demos/search_object/demo_search_object.launch | 2 ++ .../demo_simple_failure_torelant.launch | 2 ++ pddl/pddl_planner/test/repeat.sh | 10 ++++++++++ pddl/pddl_planner/test/search_object.test | 1 + pddl/pddl_planner/test/simple_failure_torelant.test | 1 + 5 files changed, 16 insertions(+) create mode 100755 pddl/pddl_planner/test/repeat.sh diff --git a/pddl/pddl_planner/demos/search_object/demo_search_object.launch b/pddl/pddl_planner/demos/search_object/demo_search_object.launch index 3ab39f37..4e138bb1 100644 --- a/pddl/pddl_planner/demos/search_object/demo_search_object.launch +++ b/pddl/pddl_planner/demos/search_object/demo_search_object.launch @@ -1,9 +1,11 @@ + diff --git a/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch b/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch index 543ae072..7a438f29 100644 --- a/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch +++ b/pddl/pddl_planner/demos/simple_failure_torelant/demo_simple_failure_torelant.launch @@ -1,9 +1,11 @@ + diff --git a/pddl/pddl_planner/test/repeat.sh b/pddl/pddl_planner/test/repeat.sh new file mode 100755 index 00000000..9f8fe086 --- /dev/null +++ b/pddl/pddl_planner/test/repeat.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +function repeat(){ + for ((i=0;i<$1;i++)); do + eval ${*:2} + done +} + +repeat $@ + diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test index 7a4621ef..eb436e12 100644 --- a/pddl/pddl_planner/test/search_object.test +++ b/pddl/pddl_planner/test/search_object.test @@ -1,6 +1,7 @@ + + Date: Sat, 6 Mar 2021 23:36:04 +0900 Subject: [PATCH 27/46] search_object.test: increase timeout --- pddl/pddl_planner/test/search_object.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test index eb436e12..9b7e4982 100644 --- a/pddl/pddl_planner/test/search_object.test +++ b/pddl/pddl_planner/test/search_object.test @@ -10,16 +10,16 @@ topics: - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect boxa)', '(grasp boxa)', '(close-box boxa)', '(move-to end)'] - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect boxb)', '(grasp boxb)', '(close-box boxb)', '(move-to end)'] - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect boxc)', '(grasp boxc)', '(close-box boxc)', '(move-to end)'] - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect_f boxa)', '(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect_f boxb)', '(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect_f boxc)', '(close-box boxc)', '(move-to end)'] From e85cce105ee124591c21e5a1f6b2902d323f52a1 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 9 Mar 2021 13:11:38 +0900 Subject: [PATCH 28/46] update jsk_travis to 0.5.19 --- .travis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis b/.travis index 92c11b11..96cae291 160000 --- a/.travis +++ b/.travis @@ -1 +1 @@ -Subproject commit 92c11b11bd185418f12af29c88c04793d1f761b9 +Subproject commit 96cae291c7132a5220b69055d4fe77a0a6484a54 From fdec30de3d67a74b266bbc4c4dfa32068d378e1b Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Sat, 14 Aug 2021 16:21:25 +0900 Subject: [PATCH 29/46] use xdg-open instead of gnome-open --- task_compiler/euslisp/execute-pddl-core.l | 2 +- task_compiler/samples/clean_planning/si11_pddl.l | 4 ++-- .../failure-recovery-sample/solve-failure-recovery-task.l | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/task_compiler/euslisp/execute-pddl-core.l b/task_compiler/euslisp/execute-pddl-core.l index 43b25213..760f55ab 100755 --- a/task_compiler/euslisp/execute-pddl-core.l +++ b/task_compiler/euslisp/execute-pddl-core.l @@ -47,7 +47,7 @@ (ros::ros-info "output result to /tmp/action_graph.pdf") (when display-graph - (piped-fork "gnome-open /tmp/action_graph.pdf")) + (piped-fork "xdg-open /tmp/action_graph.pdf")) (setq *sm* (convert-smach graph :return-success return-success :return-fail return-fail diff --git a/task_compiler/samples/clean_planning/si11_pddl.l b/task_compiler/samples/clean_planning/si11_pddl.l index e81c67f6..7d5deada 100755 --- a/task_compiler/samples/clean_planning/si11_pddl.l +++ b/task_compiler/samples/clean_planning/si11_pddl.l @@ -176,7 +176,7 @@ (send (make-readable-graph *graph*) :write-to-pdf "knock_demo.pdf") ;(when (ros::get-param "~display_graph") - (piped-fork "gnome-open knock_demo.pdf") + (piped-fork "xdg-open knock_demo.pdf") ;) ;; action definition @@ -202,4 +202,4 @@ ;(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) ; (ros::exit)) -) \ No newline at end of file +) diff --git a/task_compiler/samples/failure-recovery-sample/solve-failure-recovery-task.l b/task_compiler/samples/failure-recovery-sample/solve-failure-recovery-task.l index 285610fa..6e72a76f 100755 --- a/task_compiler/samples/failure-recovery-sample/solve-failure-recovery-task.l +++ b/task_compiler/samples/failure-recovery-sample/solve-failure-recovery-task.l @@ -118,7 +118,7 @@ (setq *graph* (make-readable-graph *graph*)) (send *graph* :write-to-pdf "action_graph.pdf") (when (ros::get-param "~display_graph") - (piped-fork "gnome-open action_graph.pdf")) + (piped-fork "xdg-open action_graph.pdf")) ;; action definition ;; domain -> package From 6b28fa9ebd0f414fcbd730c8a0eb1be15cbeb106 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 2 Nov 2021 22:27:44 +0900 Subject: [PATCH 30/46] add test to check #92 cannot run graph-solver for pddl-graph see #92 for detail --- pddl/pddl_planner/test/solve-graph-search.l | 110 +++++++++++++++++++ pddl/pddl_planner/test/test-sample-pddl.test | 5 + 2 files changed, 115 insertions(+) create mode 100755 pddl/pddl_planner/test/solve-graph-search.l diff --git a/pddl/pddl_planner/test/solve-graph-search.l b/pddl/pddl_planner/test/solve-graph-search.l new file mode 100755 index 00000000..2193bd1c --- /dev/null +++ b/pddl/pddl_planner/test/solve-graph-search.l @@ -0,0 +1,110 @@ +#!/usr/bin/env roseus +;; simplified version of pddl_planner/demos/hanoi/solve-hanoi.l + +(load "package://pddl_planner/src/pddl-result-graph.l") +(load "package://pddl_planner/src/eus-pddl-client.l") + +(setq *action-client* + (instance ros::simple-action-client :init + "pddl_planner" pddl_msgs::PDDLPlannerAction)) +;; +;; problem +;; +;;hanoi tower +(setq *problem* (instance pddl-problem :init :name 'hanoi :domain 'manip)) + +;;使用する変数の宣言 +(send *problem* :objects + '((disk0 . object) + (disk1 . object) + (disk2 . object) + (pole0 . object) + (pole1 . object) + (pole2 . object)) ; 簡単のため使う型は一つのみに + ) ; disk0,1,2 pole0,1,2すべてobject型 + +;;初期条件 +;; disk0 disk1 disk2 +;; pole0 pole1 pole2 +(send *problem* :initial-condition + '((on disk0 pole0) + (on disk1 pole1) + (on disk2 pole2) + (can-be-on disk0 disk1) + (can-be-on disk1 disk2) + (clear disk0) + (clear disk1) + (clear disk2))) + +;;初期条件の追加 +(dolist (dd '(disk0 disk1 disk2)) + (dolist (pp '(pole0 pole1 pole2)) + (send *problem* :add :initial-condition + (list 'can-be-on dd pp)))) + +;;終了条件 +;; +;; disk0 +;; disk1 +;; disk2 +;; pole0 pole1 pole2 +(send *problem* :goal-condition + '((on disk0 disk1) + (on disk1 disk2) + (on disk2 pole2) + (clear pole0) + (clear pole1) + (clear disk0) + )) + +;; +;; domain +;; +(setq *domain* (instance pddl-domain :init :name 'manip)) +(send *domain* :requirements '(:typing)) +(send *domain* :types '(object)) +(send *domain* :predicates '((on ?obj0 ?obj1 - object) + (clear ?obj - object) + (can-be-on ?obj0 ?obj1 - object))) +;;making action +(setq *move* (instance pddl-action :init + :name "move" + :parameters '((?obj ?from ?to object)) + :precondition '((clear ?obj) + (clear ?to) + (on ?obj ?from) + (can-be-on ?obj ?to)) + :effect '((on ?obj ?to) + (not (on ?obj ?from)) + (not (clear ?to)) + (clear ?from)))) +;;add action to domain +(send *domain* :add :action *move*) + + +;; +;; solve planning +;; +(pprint (setq *result* (solve-pddl-planning *domain* *problem*))) +(setq *gr* (make-graph-from-pddl-results (list *result*) :node-name :pprint)) + +(require :unittest "lib/llib/unittest.l") +(init-unit-test) + +(deftest test-graph-solve () + (let (solver path result-path solved-path) + ;; solve graph search + (send *gr* :start-state (elt (send *gr* :nodes) 2)) + (send *gr* :goal-state (elt (send *gr* :nodes) 0)) + (setq solver (instance breadth-first-graph-search-solver :init)) + (setq path (send solver :solve *gr* :verbose nil)) + + (setq result-path (cdr (assoc :plan *result*))) + (setq solved-path (mapcar #'read-from-string (cdr (send-all (send-all path :action) :name)))) + (format *error-output* "result-path ~A~%" result-path) + (format *error-output* "solved-path ~A~%" solved-path) + (assert (equal solved-path result-path)) + )) + +(run-all-tests) +(exit) diff --git a/pddl/pddl_planner/test/test-sample-pddl.test b/pddl/pddl_planner/test/test-sample-pddl.test index a217b74b..bc541fa8 100644 --- a/pddl/pddl_planner/test/test-sample-pddl.test +++ b/pddl/pddl_planner/test/test-sample-pddl.test @@ -23,4 +23,9 @@ + + From 298dfcbd17d45ab009f2f455bed4dc58a0cc2907 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 2 Nov 2021 22:30:40 +0900 Subject: [PATCH 31/46] :add-neighbor is obsolated methods, use :add-arc-from-to https://github.com/euslisp/jskeus/blob/689b015f0c727616e2745652423f2918d1e52252/irteus/irtgraph.l#L379 --- pddl/pddl_planner/src/pddl-result-graph.l | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pddl/pddl_planner/src/pddl-result-graph.l b/pddl/pddl_planner/src/pddl-result-graph.l index e3f8fbe2..72f3be0c 100644 --- a/pddl/pddl_planner/src/pddl-result-graph.l +++ b/pddl/pddl_planner/src/pddl-result-graph.l @@ -47,7 +47,9 @@ (string-equal (car x) name))) (send from :neighbor-action-alist)) (warn ";; same arc found ~A~%" name) - (send from :add-neighbor to name))) + (let ((a (send-super :add-arc-from-to from to))) + (send a :name name) + (send from :neighbors)))) (:write-to-dot ;; redefine for adding arc name (fname &optional result-path (title "output")) (let ((node-alist ; ((node . symbol) (node . symbol) ...) From 89af55dcb36ee517b3e879b016e584462d0aae7b Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 8 Nov 2021 15:50:49 +0900 Subject: [PATCH 32/46] add time-limit to test_task_compiler --- task_compiler/test/test_task_compiler.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/task_compiler/test/test_task_compiler.test b/task_compiler/test/test_task_compiler.test index 84ea586d..9d5a43b1 100644 --- a/task_compiler/test/test_task_compiler.test +++ b/task_compiler/test/test_task_compiler.test @@ -12,5 +12,6 @@ + args="$(find task_compiler)/test/test-task-compiler.l" + time-limit="180" /> From 578d237550d2f3450c412070b1e24c2c3d0ba917 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Dec 2021 17:04:52 +0900 Subject: [PATCH 33/46] add CHECK_PYTHON2_COMPILE, CHECK_PYTHON3_COMPILE --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2d081e5..7ad90fc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,18 @@ notifications: on_success: always on_failure: always slack: jsk-robotics:Av7tc8wj3IWkLYvlTzHE7x2g +addons: + apt: + packages: + - 2to3 services: - docker env: global: - USE_DOCKER=true matrix: + - CHECK_PYTHON3_COMPILE=true + - CHECK_PYTHON2_COMPILE=true - ROS_DISTRO=hydro USE_DEB=false - ROS_DISTRO=indigo USE_DEB=true - ROS_DISTRO=jade USE_DEB=true @@ -21,4 +27,7 @@ matrix: - env: ROS_DISTRO=hydro USE_DEB=false - env: ROS_DISTRO=indigo USE_DEB=true - env: ROS_DISTRO=jade USE_DEB=true -script: source .travis/travis.sh +script: + - if [ "${CHECK_PYTHON2_COMPILE}" == "true" ]; then python2 -m compileall .; exit $?; fi + - if [ "${CHECK_PYTHON3_COMPILE}" == "true" ]; then bash -c "ret=0; trap 'ret=1' ERR; python3 -m compileall .; 2to3 -w -f except -f execfile -f has_key -f import -f raw_input -f zip .; git diff --exit-code . :^.travis > /dev/null; echo Exitting with \$ret; exit \$ret"; exit $?; fi + - source .travis/travis.sh From 466077fd4a76d20ac9c4f09aee3d237508475502 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Dec 2021 17:08:43 +0900 Subject: [PATCH 34/46] .travis.yml: use bionic --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7ad90fc0..978283a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: true +dist: bionic language: generic notifications: email: From 966c209ed3ce4f9db0dbafad99eb2a2f7f373965 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Dec 2021 17:42:02 +0900 Subject: [PATCH 35/46] 2to3 -w -f print * --- pddl/pddl_planner/demos/hanoi/solve-hanoi.py | 4 ++-- pddl/pddl_planner/samples/agentsystem.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pddl/pddl_planner/demos/hanoi/solve-hanoi.py b/pddl/pddl_planner/demos/hanoi/solve-hanoi.py index d10c806b..e899aae0 100755 --- a/pddl/pddl_planner/demos/hanoi/solve-hanoi.py +++ b/pddl/pddl_planner/demos/hanoi/solve-hanoi.py @@ -79,7 +79,7 @@ "(clear c)", "(handempty)"] goal.problem.goal = "(and (on a b) (on b c))" - print goal + print(goal) client.send_goal(goal) client.wait_for_result() - print client.get_result() + print(client.get_result()) diff --git a/pddl/pddl_planner/samples/agentsystem.py b/pddl/pddl_planner/samples/agentsystem.py index c5b604a5..6429f9a6 100755 --- a/pddl/pddl_planner/samples/agentsystem.py +++ b/pddl/pddl_planner/samples/agentsystem.py @@ -75,7 +75,7 @@ "(clear c)", "(handempty)"] goal.problem.goal = "(and (on a b) (on b c))" - print goal + print(goal) client.send_goal(goal) client.wait_for_result() - print client.get_result() + print(client.get_result()) From cfd80decc80fb16caee7328c81deb00e92bc3579 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sat, 11 Dec 2021 17:42:48 +0900 Subject: [PATCH 36/46] 2to3 -w -f has_key * --- pddl/pddl_planner/src/pddl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pddl/pddl_planner/src/pddl.py b/pddl/pddl_planner/src/pddl.py index 5dbb90c5..daf696b0 100755 --- a/pddl/pddl_planner/src/pddl.py +++ b/pddl/pddl_planner/src/pddl.py @@ -264,7 +264,7 @@ def gen_problem_objects_strings(self, objects): for o in objects: object_name = o.name # find same object_type in grouped_objects - if grouped_objects.has_key(o.type): + if o.type in grouped_objects: grouped_objects[o.type].append(o.name) else: grouped_objects[o.type] = [o.name] From 8a7fb1c7f8fa6091b7e9f8045778e15c80607983 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 21 Feb 2022 20:19:21 +0900 Subject: [PATCH 37/46] update LPG download link --- pddl/pddl_planner/demos/temporal/README | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pddl/pddl_planner/demos/temporal/README b/pddl/pddl_planner/demos/temporal/README index 2e284fcb..49657c7f 100644 --- a/pddl/pddl_planner/demos/temporal/README +++ b/pddl/pddl_planner/demos/temporal/README @@ -1,9 +1,8 @@ -# download LPG planner from http://zeus.ing.unibs.it/lpg/ -# -# it work both on lpg-1.2 or lpg-2.0 +# download LPG planner (http://lpg.unibs.it/lpg/lpgtd-1_4-linux.tar.gz) from https://lpg.unibs.it/lpg/register-lpg-td.php +# + +./LPG-td-1.4/lpg-td -o block-domain.pddl -f block-problem.pddl -n 1 +./LPG-td-1.4/lpg-td -o coe-domain.pddl -f coe-problem.pddl -n 1 -./LPG-1.2-linux/lpg-1.2 -o block-domain.pddl -f block-problem.pddl -n 1 -./LPG-1.2-linux/lpg-1.2 -o coe-domain.pddl -f coe-problem.pddl -n 1 - From e40535d85cb81f7313d9823bca1a10991f9a75a8 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Mon, 12 Sep 2022 16:18:05 +0900 Subject: [PATCH 38/46] update .travis to 0.5.25 --- .travis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis b/.travis index 96cae291..a568fe2f 160000 --- a/.travis +++ b/.travis @@ -1 +1 @@ -Subproject commit 96cae291c7132a5220b69055d4fe77a0a6484a54 +Subproject commit a568fe2f83eb54f620e7d455c5e60960f8fc8dc5 From 5d34c8d59d7ccac7a5f2b49201157a46e40013d3 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 19 Oct 2022 17:10:20 +0900 Subject: [PATCH 39/46] add .github/workflows --- .github/workflows/config.yml | 80 +++++++++++++++++++++++++++++++++++ .github/workflows/python2.yml | 18 ++++++++ .github/workflows/python3.yml | 22 ++++++++++ 3 files changed, 120 insertions(+) create mode 100644 .github/workflows/config.yml create mode 100644 .github/workflows/python2.yml create mode 100644 .github/workflows/python3.yml diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 00000000..fb71ed2c --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,80 @@ +on: + push: + branches: + - master + pull_request: + +env: + DISPLAY: ':0.0' + +jobs: + ros: + runs-on: ubuntu-latest + continue-on-error: false + strategy: + fail-fast: false + matrix: + include: + - ROS_DISTRO: indigo + CONTAINER: jskrobotics/ros-ubuntu:14.04 + - ROS_DISTRO: kinetic + CONTAINER: jskrobotics/ros-ubuntu:16.04 + - ROS_DISTRO: melodic + CONTAINER: jskrobotics/ros-ubuntu:18.04 + - ROS_DISTRO: noetic + CONTAINER: jskrobotics/ros-ubuntu:20.04 + + container: ${{ matrix.CONTAINER }} + steps: + - name: Install latest git ( use sudo for ros-ubuntu ) + run: | + [ -e /etc/apt/sources.list.d/ubuntu-esm-infra-$(lsb_release -cs).list ] && sudo rm /etc/apt/sources.list.d/ubuntu-esm-infra-$(lsb_release -cs).list ## fix Err https://esm.ubuntu.com trusty-infra-security/main amd64 Packages, gnutls_handshake() failed: Handshake failed + (apt-get update && apt-get install -y sudo) || echo "OK" + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo apt-get update + sudo -E add-apt-repository -y ppa:git-core/ppa + sudo apt-get update + sudo apt-get install -y git + + - name: work around permission issue # https://github.com/actions/checkout/issues/760#issuecomment-1097501613 + run: | + set -x + export USER=$(whoami) + sudo chown -R $USER $GITHUB_WORKSPACE + git config --global --add safe.directory $GITHUB_WORKSPACE || echo "OK" # Show 'could not lock config file /github/home/.gitconfig: Permission denied', but it is ok + sudo mkdir -p /__w/ + sudo chmod 777 -R /__w/ + sudo chown -R $USER $HOME + # sudo mkdir -p /home/runner/work/_temp/_github_workflow/ + # sudo chown -R $USER $HOME /home/runner/work/_temp/_github_workflow/ + # ls -al /home/runner/work/_temp/_github_workflow/ + + - name: Chcekout + uses: actions/checkout@v3.0.2 + + - name: Start X server + run: | + if [[ "${{ matrix.CONTAINER }}" =~ "jskrobotics/ros-ubuntu:14.04" ]]; then exit 0; fi + echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections || echo "failing on ros-ubuntu is OK" # set non interactive tzdata https://stackoverflow.com/questions/8671308/non-interactive-method-for-dpkg-reconfigure-tzdata + sudo apt-get -y -qq install mesa-utils x11-xserver-utils xserver-xorg-video-dummy wget + export DISPLAY=:0 + wget https://raw.githubusercontent.com/jsk-ros-pkg/jsk_travis/master/dummy.xorg.conf -O /tmp/dummy.xorg.conf + sudo Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile /tmp/xorg.log -config /tmp/dummy.xorg.conf $DISPLAY & + sleep 3 # wait x server up + export QT_X11_NO_MITSHM=1 # http://wiki.ros.org/docker/Tutorials/GUI + xhost +local:root + shell: bash + + - name: Run jsk_travis + uses: jsk-ros-pkg/jsk_travis@master + with: + ROS_PARALLEL_JOBS : "-j8" + CATKIN_PARALLEL_JOBS : "-p8" + ROS_PARALLEL_TEST_JOBS : "-j1" + CATKIN_PARALLEL_TEST_JOBS : "-p1" + ROS_DISTRO : ${{ matrix.ROS_DISTRO }} + USE_DEB : ${{ matrix.USE_DEB }} + NOT_TEST_INSTALL : ${{ matrix.NOT_TEST_INSTALL }} + TEST_PKGS : ${{ matrix.TEST_PKGS }} + EXTRA_DEB : ${{ matrix.EXTRA_DEB }} diff --git a/.github/workflows/python2.yml b/.github/workflows/python2.yml new file mode 100644 index 00000000..72f28a32 --- /dev/null +++ b/.github/workflows/python2.yml @@ -0,0 +1,18 @@ +# generated by `./generate_action_config.py noetic` +# jsk_travis +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + name: check_python2 + + container: ubuntu:20.04 + + steps: + - name: Chcekout + uses: actions/checkout@v2 + - name: Check Python2 + run: | + apt update -q && apt install -y -q python2 + python2 -m compileall . diff --git a/.github/workflows/python3.yml b/.github/workflows/python3.yml new file mode 100644 index 00000000..2e6dc49d --- /dev/null +++ b/.github/workflows/python3.yml @@ -0,0 +1,22 @@ +# generated by `./generate_action_config.py noetic` +# jsk_travis +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + name: check_python3 + + container: ubuntu:20.04 + + steps: + - name: Install latest git to download .git directory in actions/checkout@v2 ( use sudo for ros-ubuntu ) + run: apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git + - name: work around permission issue # https://github.com/actions/checkout/issues/760#issuecomment-1097501613 + run: git config --global --add safe.directory $GITHUB_WORKSPACE + - name: Chcekout + uses: actions/checkout@v2 + - name: Check Python3 + run: | + apt update -q && apt install -y -q python3 git 2to3 + bash -c "ret=0; trap 'ret=1' ERR; python3 -m compileall .; 2to3 -w -f except -f execfile -f has_key -f import -f raw_input -f zip .; git diff --exit-code . > /dev/null; echo Exitting with \$ret; exit \$ret" From 745945c1cee0d25c8079d4e9d4f81eb0fb63bf7c Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 19 Oct 2022 18:55:56 +0900 Subject: [PATCH 40/46] run assertTrue at end of test --- pddl/pddl_planner/test/pddlresulttest | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pddl/pddl_planner/test/pddlresulttest b/pddl/pddl_planner/test/pddlresulttest index d9dfd41c..4c39614e 100755 --- a/pddl/pddl_planner/test/pddlresulttest +++ b/pddl/pddl_planner/test/pddlresulttest @@ -199,8 +199,13 @@ class PddlResultTest(unittest.TestCase): finished_topics.append(checker.topic_name) assert ret, 'Topic [%s] is not published' % (checker.topic_name) rospy.sleep(0.01) + self.assertTrue(True) if __name__ == '__main__': import rostest - rostest.run(PKG, NAME, PddlResultTest, sys.argv) + try: + rostest.run(PKG, NAME, PddlResultTest, sys.argv) + except KeyboardInterrupt: + pass + print("{} exiting".format(PKG)) From d40685bec0f48094f39347691545c0fd22be872a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 19 Oct 2022 20:38:17 +0900 Subject: [PATCH 41/46] increase time-limit --- pddl/pddl_planner/test/2011_saito_knock_door.test | 8 ++++---- pddl/pddl_planner/test/2013_fridge_demo.test | 13 +++++++------ pddl/pddl_planner/test/search_object.test | 11 ++++++----- pddl/pddl_planner/test/simple_metric.test | 5 +++-- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pddl/pddl_planner/test/2011_saito_knock_door.test b/pddl/pddl_planner/test/2011_saito_knock_door.test index 48196604..b972f07a 100644 --- a/pddl/pddl_planner/test/2011_saito_knock_door.test +++ b/pddl/pddl_planner/test/2011_saito_knock_door.test @@ -9,16 +9,16 @@ topics: - name: /pddl_planner/result - timeout: 10 + timeout: 30 sequence_action: ['(WIPE SAITO-TABLE)', '(MOVE RM73A3-CENTER SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(PUT SANDWITCH SAITO-TABLE)'] - name: /pddl_planner/result - timeout: 10 + timeout: 30 sequence_action: ['(MOVE RM73B2-DOORFRONT SHOPFRONT)', '(BUY SANDWITCH)', '(MOVE SHOPFRONT RM73A3-CENTER)', '(WIPE SAITO-TABLE)', '(PUT SANDWITCH SAITO-TABLE)'] - name: /pddl_planner/result - timeout: 10 + timeout: 30 sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(WIPE RM73B2-TABLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)'] - name: /pddl_planner/result - timeout: 10 + timeout: 30 sequence_action: ['(MOVE RM73A3-CENTER RM73B2-DOORFRONT)', '(OPEN RM73B2-DOOR)', '(CHECK_OPEN RM73B2-DOOR)', '(MOVE RM73B2-DOORFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER RM73B2-TABLEFRONT)', '(PICK PLASTIC-BOTTLE)', '(MOVE RM73B2-TABLEFRONT RM73A3-CENTER)', '(MOVE RM73A3-CENTER TRASHBOXFRONT)', '(PUT PLASTIC-BOTTLE TRASHBOX)', '(MOVE TRASHBOXFRONT RM73A3-CENTER)'] diff --git a/pddl/pddl_planner/test/2013_fridge_demo.test b/pddl/pddl_planner/test/2013_fridge_demo.test index 6adafb8a..1e0890be 100644 --- a/pddl/pddl_planner/test/2013_fridge_demo.test +++ b/pddl/pddl_planner/test/2013_fridge_demo.test @@ -5,23 +5,24 @@ + pkg="pddl_planner" type="pddlresulttest" + time-limit="120" > topics: - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(MOVE-RECOVERLY)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START PRECLOSE)', '(CLOSE-DOOR)', '(MOVE-TO PRECLOSE START)'] - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(MOVE-TO START FRONTFRIDGE)', '(OPEN-DOOR)', '(MOVE-TO FRONTFRIDGE PREGRASP)', '(GRASP-OBJECT CAN)', '(MOVE-TO PREGRASP START)', '(MOVE-TO START SOMEWHERE)', '(TRY-CLOSE)', '(MOVE-RECOVERLY)', '(MOVE-TO FRONTFRIDGE START)'] diff --git a/pddl/pddl_planner/test/search_object.test b/pddl/pddl_planner/test/search_object.test index 9b7e4982..2b88cc5b 100644 --- a/pddl/pddl_planner/test/search_object.test +++ b/pddl/pddl_planner/test/search_object.test @@ -6,20 +6,21 @@ + pkg="pddl_planner" type="pddlresulttest" + time-limit="120" > topics: - name: /pddl_planner/result - timeout: 60 + timeout: 120 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect boxa)', '(grasp boxa)', '(close-box boxa)', '(move-to end)'] - name: /pddl_planner/result - timeout: 60 + timeout: 120 sequence_action: ['(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect boxb)', '(grasp boxb)', '(close-box boxb)', '(move-to end)'] - name: /pddl_planner/result - timeout: 60 + timeout: 120 sequence_action: ['(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect boxc)', '(grasp boxc)', '(close-box boxc)', '(move-to end)'] - name: /pddl_planner/result - timeout: 60 + timeout: 120 sequence_action: ['(move-to boxa)', '(open-box boxa)', '(detect_f boxa)', '(close-box boxa)', '(move-to boxb)', '(open-box boxb)', '(detect_f boxb)', '(close-box boxb)', '(move-to boxc)', '(open-box boxc)', '(detect_f boxc)', '(close-box boxc)', '(move-to end)'] diff --git a/pddl/pddl_planner/test/simple_metric.test b/pddl/pddl_planner/test/simple_metric.test index 20b3bd95..9706455d 100644 --- a/pddl/pddl_planner/test/simple_metric.test +++ b/pddl/pddl_planner/test/simple_metric.test @@ -5,11 +5,12 @@ + pkg="pddl_planner" type="pddlresulttest" + time-limit="120" > topics: - name: /pddl_planner/result - timeout: 10 + timeout: 120 sequence_action: ['(ACT1 OBJ1)', '(ACT2 OBJ1)'] From cbc72e2ea95a4af5b694960e153fe538b20dd786 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Wed, 19 Oct 2022 21:08:00 +0900 Subject: [PATCH 42/46] exit when sovle.l was started from rostest --- pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l | 5 +++-- pddl/pddl_planner/demos/search_object/solve-search-object.l | 6 ++++-- pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l index 45df94ed..1c0584c5 100755 --- a/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l +++ b/pddl/pddl_planner/demos/2013_fridge_demo/solve-bring-can.l @@ -1,5 +1,7 @@ #!/usr/bin/env roseus +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (require :eus-pddl-client "package://pddl_planner/src/eus-pddl-client.l") (require :pddl-result-graph "package://pddl_planner/src/pddl-result-graph.l") @@ -162,5 +164,4 @@ (send *sm-inspect* :reset-state) ) -(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) - (ros::exit)) +(if *exit-on-end* (ros::exit)) diff --git a/pddl/pddl_planner/demos/search_object/solve-search-object.l b/pddl/pddl_planner/demos/search_object/solve-search-object.l index 30a157cd..116ca635 100755 --- a/pddl/pddl_planner/demos/search_object/solve-search-object.l +++ b/pddl/pddl_planner/demos/search_object/solve-search-object.l @@ -1,4 +1,7 @@ #!/usr/bin/env roseus + +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (require :eus-pddl-client "package://pddl_planner/src/eus-pddl-client.l") (require :pddl-result-graph "package://pddl_planner/src/pddl-result-graph.l") @@ -148,5 +151,4 @@ (send sm-inspect :reset-state) ) -(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) - (ros::exit)) +(if *exit-on-end* (ros::exit)) diff --git a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l index 1f4e686b..c577416e 100755 --- a/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l +++ b/pddl/pddl_planner/demos/simple_metric/simple_metric_plan.l @@ -1,5 +1,7 @@ #!/usr/bin/env roseus +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (ros::roseus "simple_metric_plan") (load "package://pddl_planner/src/eus-pddl-client.l") @@ -73,3 +75,5 @@ (setq *graph* (make-graph-from-pddl-results (list *result*) :node-name :pprint)) (send (make-readable-graph *graph*) :write-to-pdf "simple_metric_plan.pdf") (piped-fork "evince simple_metric_plan.pdf") + +(if *exit-on-end* (ros::exit)) From 024235d8620daccb33d8972d1b8345af989071d9 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 20 Oct 2022 00:39:43 +0900 Subject: [PATCH 43/46] add launch_prefix and repet 5 times --- pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch | 2 ++ pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l | 5 +++-- pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch | 2 ++ pddl/pddl_planner/demos/2011_saito/solve-knock-door.l | 5 +++-- .../demos/2013_fridge_demo/demo_bring_can.launch | 2 ++ pddl/pddl_planner/demos/hanoi/demo_hanoi.launch | 2 ++ pddl/pddl_planner/demos/hanoi/solve-hanoi.l | 5 +++-- pddl/pddl_planner/demos/simple_metric/simple_metric.launch | 2 ++ pddl/pddl_planner/test/2008_okada_ias.test | 5 +++-- pddl/pddl_planner/test/2011_saito_knock_door.test | 1 + pddl/pddl_planner/test/2013_fridge_demo.test | 1 + pddl/pddl_planner/test/demos_hanoi.test | 3 ++- pddl/pddl_planner/test/simple_metric.test | 1 + 13 files changed, 27 insertions(+), 9 deletions(-) diff --git a/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch b/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch index a72a9999..bb875313 100644 --- a/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch +++ b/pddl/pddl_planner/demos/2008_okada_ias/demo_pour_tea.launch @@ -1,7 +1,9 @@ + diff --git a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l index 9c446b5d..c79b9614 100755 --- a/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l +++ b/pddl/pddl_planner/demos/2008_okada_ias/solve-pour-tea.l @@ -1,5 +1,7 @@ #!/usr/bin/env roseus +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (load "package://pddl_planner/src/pddl-result-graph.l") (load "package://pddl_planner/src/eus-pddl-client.l") @@ -124,5 +126,4 @@ (when (ros::get-param "~display_graph" "true") (piped-fork "xdg-open okada_ias.pdf")) -(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) - (ros::exit)) +(if *exit-on-end* (ros::exit)) diff --git a/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch b/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch index fe5191ac..271992ef 100644 --- a/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch +++ b/pddl/pddl_planner/demos/2011_saito/demo-knock-door.launch @@ -1,8 +1,10 @@ + diff --git a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l index d2581a73..da7b8743 100755 --- a/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l +++ b/pddl/pddl_planner/demos/2011_saito/solve-knock-door.l @@ -1,5 +1,7 @@ #!/usr/bin/env roseus +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (load "package://pddl_planner/src/pddl-result-graph.l") (load "package://pddl_planner/src/eus-pddl-client.l") @@ -218,5 +220,4 @@ ;; global data is not used (nil) (exec-smach-with-spin (convert-smach *graph*) nil :hz 1.0) -(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) - (ros::exit)) +(if *exit-on-end* (ros::exit)) diff --git a/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch b/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch index 3f61b35c..728e4b38 100644 --- a/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch +++ b/pddl/pddl_planner/demos/2013_fridge_demo/demo_bring_can.launch @@ -1,7 +1,9 @@ + diff --git a/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch b/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch index 8a874bed..46962894 100644 --- a/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch +++ b/pddl/pddl_planner/demos/hanoi/demo_hanoi.launch @@ -1,7 +1,9 @@ + diff --git a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l index 22cbd0d3..a4249625 100755 --- a/pddl/pddl_planner/demos/hanoi/solve-hanoi.l +++ b/pddl/pddl_planner/demos/hanoi/solve-hanoi.l @@ -1,6 +1,8 @@ #!/usr/bin/env roseus ;; mostly same to demo-eus.l in pddl package under jsk subversion trunk +(setq *exit-on-end* (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7))) + (load "package://pddl_planner/src/pddl-result-graph.l") (load "package://pddl_planner/src/eus-pddl-client.l") @@ -83,5 +85,4 @@ (when (ros::get-param "~display_graph" "true") (piped-fork "xdg-open hanoi.pdf")) -(when (string= "__log:=" (subseq (car (last lisp::*eustop-argument*)) 0 7)) - (ros::exit)) +(if *exit-on-end* (ros::exit)) diff --git a/pddl/pddl_planner/demos/simple_metric/simple_metric.launch b/pddl/pddl_planner/demos/simple_metric/simple_metric.launch index 09ed0b11..b471cbae 100644 --- a/pddl/pddl_planner/demos/simple_metric/simple_metric.launch +++ b/pddl/pddl_planner/demos/simple_metric/simple_metric.launch @@ -1,9 +1,11 @@ + diff --git a/pddl/pddl_planner/test/2008_okada_ias.test b/pddl/pddl_planner/test/2008_okada_ias.test index 8211d97b..4fa8ad30 100644 --- a/pddl/pddl_planner/test/2008_okada_ias.test +++ b/pddl/pddl_planner/test/2008_okada_ias.test @@ -1,6 +1,7 @@ + topics: - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(HOLD CUP LARM BAR)', '(MOVE-TO BAR SINK)', '(OPEN-TAP)', '(WASH-CUP)', '(PLACE CUP LARM SINK)'] - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(HOLD CUP LARM BAR)', '(HOLD BOTTLE RARM BAR)', '(POUR-TEA)', '(PLACE CUP LARM BAR)', '(PLACE BOTTLE RARM BAR)'] diff --git a/pddl/pddl_planner/test/2011_saito_knock_door.test b/pddl/pddl_planner/test/2011_saito_knock_door.test index b972f07a..dbb5bafb 100644 --- a/pddl/pddl_planner/test/2011_saito_knock_door.test +++ b/pddl/pddl_planner/test/2011_saito_knock_door.test @@ -1,6 +1,7 @@ + + + topics: - name: /pddl_planner/result - timeout: 10 + timeout: 60 sequence_action: ['(MOVE DISK0 DISK1 POLE2)', '(MOVE DISK1 DISK2 POLE1)', '(MOVE DISK0 POLE2 DISK1)', '(MOVE DISK2 POLE0 POLE2)', '(MOVE DISK0 DISK1 POLE0)', '(MOVE DISK1 POLE1 DISK2)', '(MOVE DISK0 POLE0 DISK1)'] diff --git a/pddl/pddl_planner/test/simple_metric.test b/pddl/pddl_planner/test/simple_metric.test index 9706455d..d58edbc7 100644 --- a/pddl/pddl_planner/test/simple_metric.test +++ b/pddl/pddl_planner/test/simple_metric.test @@ -1,6 +1,7 @@ + Date: Thu, 20 Oct 2022 12:50:37 +0900 Subject: [PATCH 44/46] pddl.py : fix for python3, bytes vs str --- pddl/pddl_planner/src/pddl.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pddl/pddl_planner/src/pddl.py b/pddl/pddl_planner/src/pddl.py index daf696b0..03a0998f 100755 --- a/pddl/pddl_planner/src/pddl.py +++ b/pddl/pddl_planner/src/pddl.py @@ -28,7 +28,11 @@ def read_out(out, nonblock=True): fl = fcntl.fcntl(fd, fcntl.F_GETFL) fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) try: - return out.read() + ret = out.read() + if ret == None: + return str() + else: + return ret except: return str() @@ -159,14 +163,26 @@ def exec_process(self, command, max_planning_time): if proc.poll() is not None: break # non-blocking read to avoid dead-lock - output += read_out(proc.stdout) - error += read_out(proc.stderr) + data_out = read_out(proc.stdout) + data_err = read_out(proc.stderr) + if type(data_out) == bytes: + data_out = data_out.decode('utf-8') + if type(data_err) == bytes: + data_err = data_err.decode('utf-8') + output += data_out + error += data_err r.sleep() # flush output data = proc.communicate() - output += data[0] - error += data[1] + data_out = data[0] + data_err = data[1] + if type(data_out) == bytes: + data_out = data_out.decode('utf-8') + if type(data_err) == bytes: + data_err = data_err.decode('utf-8') + output += data_out + error += data_err if proc.returncode not in [0, 124]: # 0: normal exit From 293ac53f23932d876cd1b33b89bf05e225e15461 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 20 Oct 2022 12:51:14 +0900 Subject: [PATCH 45/46] pddlresulttest: fix for python3, use map and https://stackoverflow.com/questions/60532658/python-2-vs-python-3-difference-in-map-behavior-with-three-arguments --- pddl/pddl_planner/test/pddlresulttest | 52 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/pddl/pddl_planner/test/pddlresulttest b/pddl/pddl_planner/test/pddlresulttest index 4c39614e..952868d9 100755 --- a/pddl/pddl_planner/test/pddlresulttest +++ b/pddl/pddl_planner/test/pddlresulttest @@ -82,39 +82,38 @@ class PddlResultChecker(object): rospy.loginfo("received msg") rospy.loginfo(" - use_durative_action: {}".format(msg.result.use_durative_action)) - rospy.loginfo(" - sequence: {}".format(map(lambda x: x.action + " ".join(x.args), msg.result.sequence))) - rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, msg.result.sequence), - map(lambda x: x.action_duration, msg.result.sequence))) + rospy.loginfo(" - sequence: {}".format([x.action + " ".join(x.args) for x in msg.result.sequence])) + rospy.loginfo(" {} {}".format([x.start_time for x in msg.result.sequence], + [x.action_duration for x in msg.result.sequence])) for target in self.targets: message_matched = True result = target['result'] if target['msg_matched']: - rospy.loginfo(" msg already passed {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) + rospy.loginfo(" msg already passed {}".format([x.action + " ".join(x.args) for x in result.sequence])) continue - if not result.use_durative_action == None: if not msg.result.use_durative_action == result.use_durative_action: rospy.loginfo(" expecting: {}".format(result.use_durative_action)) message_matched = False if not result.sequence == None: if not msg.result.sequence == result.sequence: - rospy.loginfo(" expecting : {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) - rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), - map(lambda x: x.action_duration, result.sequence))) + rospy.loginfo(" expecting : {}".format([x.action + " ".join(x.args) for x in result.sequence])) + rospy.loginfo(" {} {}".format([x.start_time for x in result.sequence], + [x.action_duration for x in result.sequence])) message_matched = False if message_matched: target['msg_matched'] = msg - rospy.loginfo("message matched to {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) - rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), - map(lambda x: x.action_duration, result.sequence))) + rospy.loginfo("message matched to {}".format([x.action + " ".join(x.args) for x in result.sequence])) + rospy.loginfo(" {} {}".format([x.start_time for x in result.sequence], + [x.action_duration for x in result.sequence])) def add_callback(self, timeout, result): - rospy.loginfo("register to check {}".format(map(lambda x: x.action + " ".join(x.args), result.sequence))) - rospy.loginfo(" {} {}".format(map(lambda x: x.start_time, result.sequence), - map(lambda x: x.action_duration, result.sequence))) + rospy.loginfo("register to check {}".format([x.action + " ".join(x.args) for x in result.sequence])) + rospy.loginfo(" {} {}".format([x.start_time for x in result.sequence], + [x.action_duration for x in result.sequence])) rospy.loginfo(" within {} sec".format(timeout)) deadline_ = rospy.Time.now() + rospy.Duration(timeout) @@ -168,13 +167,24 @@ class PddlResultTest(unittest.TestCase): timeout = topic['timeout'] result = PDDLPlannerResult() result.use_durative_action = topic['use_durative_action'] - result.sequence = map(lambda a, s, d: PDDLStep(action = a.split()[0], - args = a.split()[1:], - start_time = s or '', - action_duration = d or ''), - topic['sequence_action'], - topic['sequence_start_time'], - topic['sequence_duration']) + # https://stackoverflow.com/questions/60532658/python-2-vs-python-3-difference-in-map-behavior-with-three-arguments + try: + from itertools import zip_longest + result.sequence = list(map(lambda x: PDDLStep(action = x[0].split()[0], + args = x[0].split()[1:], + start_time = x[1] or '', + action_duration = x[2] or ''), + zip_longest(topic['sequence_action'], + topic['sequence_start_time'], + topic['sequence_duration']))) + except: + result.sequence = map(lambda a, s, d: PDDLStep(action = a.split()[0], + args = a.split()[1:], + start_time = s or '', + action_duration = d or ''), + topic['sequence_action'], + topic['sequence_start_time'], + topic['sequence_duration']) # check if already subscribe topic checker = next((x for x in checkers if x.topic_name == topic_name), None) From 57f243f863375c059db84da55c0f76ac2dcfaed5 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Thu, 20 Oct 2022 16:57:49 +0900 Subject: [PATCH 46/46] set NOT_TEST_INSTALL for 14.04 --- .github/workflows/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index fb71ed2c..ecf0c992 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -17,6 +17,7 @@ jobs: include: - ROS_DISTRO: indigo CONTAINER: jskrobotics/ros-ubuntu:14.04 + NOT_TEST_INSTALL: true - ROS_DISTRO: kinetic CONTAINER: jskrobotics/ros-ubuntu:16.04 - ROS_DISTRO: melodic