Changes have been pushed for the repository "fawkes.git". (Fawkes Robotics Software Framework)
Clone: g...@git.fawkesrobotics.org:fawkes.git Gitweb: http://git.fawkesrobotics.org/fawkes.git Trac: http://trac.fawkesrobotics.org The branch, thofmann/pddl-planner-do-not-use-old-plans has been created at cfb219ab36fc8dcc1565bcaa1dc7f441d35252a0 (commit) http://git.fawkesrobotics.org/fawkes.git/thofmann/pddl-planner-do-not-use-old-plans - *Log* --------------------------------------------------------------- commit d46201cdad0c1885af55f8f0faa7a1fc0b8cc2a8 Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Fri Mar 9 13:07:03 2018 +0100 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Fri Mar 9 13:07:03 2018 +0100 pddl-planner: add interface field for planner success The planner does not always find a plan, so the interface field "final" does not suffice to determine whether the planner found a plan. Add a separate field "success" that is true iff the planner has found a plan. If the planner failed, "final" will be true, but "success" will be false. http://git.fawkesrobotics.org/fawkes.git/commit/d46201c http://trac.fawkesrobotics.org/changeset/d46201c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit cfb219ab36fc8dcc1565bcaa1dc7f441d35252a0 Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Fri Mar 9 13:31:42 2018 +0100 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Fri Mar 9 13:31:42 2018 +0100 clips-executive: set goal mode to FAILED if planner did not find a plan If the planner fails to compute a plan, fail properly instead of re-using an old, possibly invalid plan that is still in the database. http://git.fawkesrobotics.org/fawkes.git/commit/cfb219a http://trac.fawkesrobotics.org/changeset/cfb219a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- src/plugins/clips-executive/clips/pddl.clp | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) - *Diffs* ------------------------------------------------------------- - *commit* d46201cdad0c1885af55f8f0faa7a1fc0b8cc2a8 - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Fri Mar 9 13:07:03 2018 +0100 Subject: pddl-planner: add interface field for planner success src/libs/interfaces/PddlPlannerInterface.h | 6 +++ .../interfaces/PddlPlannerInterface.cpp | 38 +++++++++++++++++++- .../interfaces/PddlPlannerInterface.h_ext | 6 +++ .../interfaces/PddlPlannerInterface.tolua | 3 ++ .../interfaces/PddlPlannerInterface.xml | 3 ++ src/plugins/pddl-planner/pddl-planner_thread.cpp | 4 ++ 6 files changed, 59 insertions(+), 1 deletions(-) _Diff for modified files_: diff --git a/src/libs/interfaces/PddlPlannerInterface.h b/src/libs/interfaces/PddlPlannerInterface.h index 7fcc8fa..2bba677 100644 --- a/src/libs/interfaces/PddlPlannerInterface.h +++ b/src/libs/interfaces/PddlPlannerInterface.h @@ -49,6 +49,9 @@ class PddlPlannerInterface : public Interface bool final; /**< Is the planning finished? */ + bool success; /**< + True if the planner found a plan + */ char active_planner[30]; /**< Currently selected planner */ @@ -98,6 +101,9 @@ class PddlPlannerInterface : public Interface bool is_final() const; void set_final(const bool new_final); size_t maxlenof_final() const; + bool is_success() const; + void set_success(const bool new_success); + size_t maxlenof_success() const; char * active_planner() const; void set_active_planner(const char * new_active_planner); size_t maxlenof_active_planner() const; diff --git a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.cpp b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.cpp index 1fd3be9..b76fc81 100644 --- a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.cpp +++ b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.cpp @@ -52,9 +52,10 @@ PddlPlannerInterface::PddlPlannerInterface() : Interface() memset(data_ptr, 0, data_size); add_fieldinfo(IFT_UINT32, "msg_id", 1, &data->msg_id); add_fieldinfo(IFT_BOOL, "final", 1, &data->final); + add_fieldinfo(IFT_BOOL, "success", 1, &data->success); add_fieldinfo(IFT_STRING, "active_planner", 30, data->active_planner); add_messageinfo("PlanMessage"); - unsigned char tmp_hash[] = {0xcd, 0x44, 0x52, 0xa7, 0xfa, 0xb2, 0xaf, 0xfe, 0xe2, 0xc5, 0x4, 0x6b, 0xe0, 0x97, 0x2b, 0x69}; + unsigned char tmp_hash[] = {0x47, 0x74, 0xd7, 0xcf, 0x3d, 0xe5, 0x68, 0xa6, 0x44, 0xf1, 0x1f, 0x54, 0x5d, 0xc0, 0x4d, 0xd8}; set_hash(tmp_hash); } @@ -134,6 +135,41 @@ PddlPlannerInterface::set_final(const bool new_final) data_changed = true; } +/** Get success value. + * + True if the planner found a plan + + * @return success value + */ +bool +PddlPlannerInterface::is_success() const +{ + return data->success; +} + +/** Get maximum length of success value. + * @return length of success value, can be length of the array or number of + * maximum number of characters for a string + */ +size_t +PddlPlannerInterface::maxlenof_success() const +{ + return 1; +} + +/** Set success value. + * + True if the planner found a plan + + * @param new_success new success value + */ +void +PddlPlannerInterface::set_success(const bool new_success) +{ + data->success = new_success; + data_changed = true; +} + /** Get active_planner value. * Currently selected planner diff --git a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.h_ext b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.h_ext index 7fcc8fa..2bba677 100644 --- a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.h_ext +++ b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.h_ext @@ -49,6 +49,9 @@ class PddlPlannerInterface : public Interface bool final; /**< Is the planning finished? */ + bool success; /**< + True if the planner found a plan + */ char active_planner[30]; /**< Currently selected planner */ @@ -98,6 +101,9 @@ class PddlPlannerInterface : public Interface bool is_final() const; void set_final(const bool new_final); size_t maxlenof_final() const; + bool is_success() const; + void set_success(const bool new_success); + size_t maxlenof_success() const; char * active_planner() const; void set_active_planner(const char * new_active_planner); size_t maxlenof_active_planner() const; diff --git a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.tolua b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.tolua index b156da2..2d7f2ea 100644 --- a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.tolua +++ b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.tolua @@ -40,6 +40,9 @@ class PddlPlannerInterface : public Interface bool is_final(); void set_final(const bool new_final); int maxlenof_final() const; + bool is_success(); + void set_success(const bool new_success); + int maxlenof_success() const; char * active_planner(); void set_active_planner(const char * new_active_planner); int maxlenof_active_planner() const; diff --git a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.xml b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.xml index 8ea34b1..7343b34 100644 --- a/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.xml +++ b/src/plugins/pddl-planner/interfaces/PddlPlannerInterface.xml @@ -11,6 +11,9 @@ <field type="bool" name="final"> Is the planning finished? </field> + <field type="bool" name="success"> + True if the planner found a plan + </field> <field type="string" length="30" name="active_planner"> Currently selected planner </field> diff --git a/src/plugins/pddl-planner/pddl-planner_thread.cpp b/src/plugins/pddl-planner/pddl-planner_thread.cpp index a84bd2b..0da5bf3 100644 --- a/src/plugins/pddl-planner/pddl-planner_thread.cpp +++ b/src/plugins/pddl-planner/pddl-planner_thread.cpp @@ -78,6 +78,7 @@ PddlPlannerThread::init() plan_if_->set_active_planner(planner_string.c_str()); plan_if_->set_msg_id(0); plan_if_->set_final(false); + plan_if_->set_success(false); plan_if_->write(); //setup interface listener @@ -104,9 +105,11 @@ PddlPlannerThread::loop() BSONObj plan = BSONFromActionList(); robot_memory->update(fromjson("{plan:{$exists:true}}"), plan, cfg_collection_, true); print_action_list(); + plan_if_->set_success(true); } else { logger->log_error(name(),"Updating plan failed, action list empty!"); robot_memory->update(fromjson("{plan:{$exists:true}}"), fromjson("{plan:0}"), cfg_collection_, true); + plan_if_->set_success(false); } plan_if_->set_final(true); @@ -343,6 +346,7 @@ PddlPlannerThread::bb_interface_message_received(Interface *interface, fawkes::M if (message->is_of_type<PddlPlannerInterface::PlanMessage>()) { PddlPlannerInterface::PlanMessage* msg = (PddlPlannerInterface::PlanMessage*) message; plan_if_->set_msg_id(msg->id()); + plan_if_->set_success(false); plan_if_->set_final(false); plan_if_->write(); wakeup(); //activates loop where the generation is done - *commit* cfb219ab36fc8dcc1565bcaa1dc7f441d35252a0 - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Fri Mar 9 13:31:42 2018 +0100 Subject: clips-executive: set goal mode to FAILED if planner did not find a plan src/plugins/clips-executive/clips/pddl.clp | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) _Diff for modified files_: diff --git a/src/plugins/clips-executive/clips/pddl.clp b/src/plugins/clips-executive/clips/pddl.clp index a543fe4..9d86184 100644 --- a/src/plugins/clips-executive/clips/pddl.clp +++ b/src/plugins/clips-executive/clips/pddl.clp @@ -77,11 +77,24 @@ (defrule pddl-check-if-planner-finished "Check whether the planner finished planning." ?p <- (pddl-plan (status RUNNING) (plan-id ?plan-id)) - (PddlPlannerInterface (id "pddl-planner") (msg_id ?plan-id) (final TRUE)) + (PddlPlannerInterface (id "pddl-planner") (msg_id ?plan-id) (final TRUE) + (success TRUE)) => (modify ?p (status PLANNED)) ) +(defrule pddl-check-if-planner-failed + "Check whether the planner finished but has not found a plan." + ?g <- (goal (id ?goal-id)) + ?p <- (pddl-plan (status RUNNING) (goal-id ?goal-id) (plan-id ?plan-id)) + (PddlPlannerInterface (id "pddl-planner") (msg_id ?plan-id) (final TRUE) + (success FALSE)) + => + (printout error "Planning failed for goal " ?goal-id crlf) + (modify ?g (mode FAILED)) + (retract ?p) +) + (deffunction pddl-get-max-action-id () "Get the max ID of all current action" (bind ?i 0) -- Fawkes Robotics Framework http://www.fawkesrobotics.org _______________________________________________ fawkes-commits mailing list fawkes-commits@lists.kbsg.rwth-aachen.de https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits