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, timn/clips-executive-wm-robmem-sync has been updated to afd52c4457464958090d7198825ccf8bf0789501 (commit) via 3570aa47e01c4a1ed16cc0f06c77df2702e6d51e (commit) via d11c0d4bf9c8a0c025e925f24b6bc9b34d72de9d (commit) via b543f6488d88900cc38e5d44b979c4c750134637 (commit) via 9707f1e30027b8984281ccb086896154c0d8659c (commit) via 6cc2485eaa99b4f9dc415ea7fe518fbe566668a7 (commit) from bc228d1d61941105ab50c0c7a3c1254fded95941 (commit) http://git.fawkesrobotics.org/fawkes.git/timn/clips-executive-wm-robmem-sync Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - *Log* --------------------------------------------------------------- commit 6cc2485eaa99b4f9dc415ea7fe518fbe566668a7 Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 13:37:48 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 mongodb: provide managed replica set status in blackboard http://git.fawkesrobotics.org/fawkes.git/commit/6cc2485 http://trac.fawkesrobotics.org/changeset/6cc2485 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit 9707f1e30027b8984281ccb086896154c0d8659c Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 23:00:28 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 clips: report load errors, support path-batch load operation http://git.fawkesrobotics.org/fawkes.git/commit/9707f1e http://trac.fawkesrobotics.org/changeset/9707f1e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit b543f6488d88900cc38e5d44b979c4c750134637 Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 23:00:50 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 clips: add str-split utility method to std utils http://git.fawkesrobotics.org/fawkes.git/commit/b543f64 http://trac.fawkesrobotics.org/changeset/b543f64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit d11c0d4bf9c8a0c025e925f24b6bc9b34d72de9d Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 23:12:28 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 clips-executive: re-factor CX initialization The initialization is now fully controlled by the configuration. It is simplified and more generalized. There is no code specific to a particular feature (aside configuring debug information) anymore. This is all handled generically. We specify a number of stages, but the stages are fully controlled through the configuration giving maximum flexibility. http://git.fawkesrobotics.org/fawkes.git/commit/d11c0d4 http://trac.fawkesrobotics.org/changeset/d11c0d4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit 3570aa47e01c4a1ed16cc0f06c77df2702e6d51e Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 23:15:20 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 config: new initialization configuration for clips-executive http://git.fawkesrobotics.org/fawkes.git/commit/3570aa4 http://trac.fawkesrobotics.org/changeset/3570aa4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit afd52c4457464958090d7198825ccf8bf0789501 Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> AuthorDate: Mon Apr 23 23:16:28 2018 +0200 Commit: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> CommitDate: Mon Apr 23 23:25:13 2018 +0200 clips-executive: verify early init and do not assert (start) During init() we check if anything has failed (already). In that case, we can raise the red flag early and more obviously. Do not assert (start) anymore. This is now handled inside clips in initialization by asserting (executive-initialized). http://git.fawkesrobotics.org/fawkes.git/commit/afd52c4 http://trac.fawkesrobotics.org/changeset/afd52c4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- cfg/conf.d/clips-executive.yaml | 106 ++++-- src/libs/interfaces/.gitignore | 1 + src/plugins/clips-executive/clips/init.clp | 347 +++++++++++--------- src/plugins/clips-executive/clips/skills-init.clp | 31 -- src/plugins/clips-executive/clips/skills.clp | 11 + .../clips-executive/clips_executive_thread.cpp | 21 +- .../clips-executive/clips_executive_thread.h | 2 - src/plugins/clips/clips/path.clp | 73 +++- src/plugins/clips/clips/utils.clp | 18 + src/plugins/mongodb/Makefile | 5 +- src/plugins/mongodb/interfaces/.gitignore | 3 + .../{pantilt => mongodb}/interfaces/Makefile | 6 +- .../MongoDBManagedReplicaSetInterface.xml | 95 ++++++ src/plugins/mongodb/mongodb_replicaset_config.cpp | 102 ++++-- src/plugins/mongodb/mongodb_replicaset_config.h | 32 +- 15 files changed, 556 insertions(+), 297 deletions(-) delete mode 100644 src/plugins/clips-executive/clips/skills-init.clp create mode 100644 src/plugins/mongodb/interfaces/.gitignore copy src/plugins/{pantilt => mongodb}/interfaces/Makefile (81%) create mode 100644 src/plugins/mongodb/interfaces/MongoDBManagedReplicaSetInterface.xml - *Diffs* ------------------------------------------------------------- - *commit* 6cc2485eaa99b4f9dc415ea7fe518fbe566668a7 - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 13:37:48 2018 +0200 Subject: mongodb: provide managed replica set status in blackboard src/libs/interfaces/.gitignore | 1 + src/plugins/mongodb/Makefile | 5 +- src/plugins/mongodb/interfaces/.gitignore | 3 + .../{pantilt => mongodb}/interfaces/Makefile | 6 +- .../MongoDBManagedReplicaSetInterface.xml | 95 ++++++++++++++++++ src/plugins/mongodb/mongodb_replicaset_config.cpp | 102 +++++++++++++------- src/plugins/mongodb/mongodb_replicaset_config.h | 32 ++++--- 7 files changed, 191 insertions(+), 53 deletions(-) _Diff for modified files_: diff --git a/src/libs/interfaces/.gitignore b/src/libs/interfaces/.gitignore index 9d53718..92cd43d 100644 --- a/src/libs/interfaces/.gitignore +++ b/src/libs/interfaces/.gitignore @@ -6,6 +6,7 @@ LaserClusterInterface.h HumanSkeletonProjectionInterface.h KatanaInterface.h LaserLineInterface.h +MongoDBManagedReplicaSetInterface.h NaoJointPositionInterface.h NaoJointStiffnessInterface.h NaoSensorInterface.h diff --git a/src/plugins/mongodb/Makefile b/src/plugins/mongodb/Makefile index da7adc7..2ff1948 100644 --- a/src/plugins/mongodb/Makefile +++ b/src/plugins/mongodb/Makefile @@ -19,13 +19,14 @@ include $(BASEDIR)/etc/buildsys/config.mk include $(LIBSRCDIR)/utils/utils.mk include $(BUILDSYSDIR)/boost.mk -PRESUBDIRS = aspect +PRESUBDIRS = aspect interfaces INCDIRS += $(INCDIRS_MONGODB) MONGODB_REQ_BOOST_LIBS = system filesystem -LIBS_mongodb = fawkescore fawkesaspects fawkesmongodbaspect +LIBS_mongodb = fawkescore fawkesaspects fawkesmongodbaspect fawkesblackboard \ + MongoDBManagedReplicaSetInterface OBJS_mongodb = mongodb_plugin.o mongodb_thread.o \ mongodb_client_config.o \ mongodb_instance_config.o \ diff --git a/src/plugins/mongodb/mongodb_replicaset_config.cpp b/src/plugins/mongodb/mongodb_replicaset_config.cpp index e6bb339..846ce8d 100644 --- a/src/plugins/mongodb/mongodb_replicaset_config.cpp +++ b/src/plugins/mongodb/mongodb_replicaset_config.cpp @@ -3,7 +3,7 @@ * mongodb_replicaset_config.cpp - MongoDB replica set configuration * * Created: Thu Jul 13 10:25:19 2017 - * Copyright 2006-2017 Tim Niemueller [www.niemueller.de] + * Copyright 2006-2018 Tim Niemueller [www.niemueller.de] ****************************************************************************/ /* This program is free software; you can redistribute it and/or modify @@ -62,7 +62,10 @@ MongoDBReplicaSetConfig::MongoDBReplicaSetConfig(Configuration *config, set_name("MongoDBReplicaSet|%s", cfgname.c_str()); config_name_ = cfgname; is_leader_ = false; - last_status_ = ERROR; + last_status_ = ReplicaSetStatus{ + .member_status = MongoDBManagedReplicaSetInterface::ERROR, + .primary_status = MongoDBManagedReplicaSetInterface::PRIMARY_UNKNOWN + }; enabled_ = false; try { @@ -173,6 +176,8 @@ MongoDBReplicaSetConfig::init() logger->log_debug(name(), "Bootstrap Query: %s", leader_elec_query_.jsonString().c_str()); logger->log_debug(name(), "Bootstrap Update: %s", leader_elec_update_.jsonString().c_str()); + rs_status_if_ = blackboard->open_for_writing<MongoDBManagedReplicaSetInterface>(config_name_.c_str()); + timewait_ = new TimeWait(clock, (int)(loop_interval_ * 1000000.)); } @@ -180,6 +185,7 @@ void MongoDBReplicaSetConfig::finalize() { leader_resign(); + blackboard->close(rs_status_if_); delete timewait_; } @@ -189,31 +195,33 @@ MongoDBReplicaSetConfig::loop() { timewait_->mark_start(); mongo::BSONObj reply; - ReplicaSetNodeStatus status = rs_status(reply); - switch (status) { - case PRIMARY: - if (last_status_ != status) { - logger->log_info(name(), "Became PRIMARY, starting managing"); - } - leader_elect(/* force leaderhsip */ true); - rs_monitor(reply); - break; - case NO_PRIMARY: + ReplicaSetStatus status = rs_status(reply); + + if (status.primary_status == MongoDBManagedReplicaSetInterface::NO_PRIMARY) { logger->log_warn(name(), "No primary, triggering leader election"); if (leader_elect(/* force leadership */ false)) { logger->log_info(name(), "No primary, we became leader, managing"); rs_monitor(reply); } + } + + switch (status.member_status) { + case MongoDBManagedReplicaSetInterface::PRIMARY: + if (last_status_.member_status != status.member_status) { + logger->log_info(name(), "Became PRIMARY, starting managing"); + } + leader_elect(/* force leaderhsip */ true); + rs_monitor(reply); break; - case SECONDARY: - if (last_status_ != status) { + case MongoDBManagedReplicaSetInterface::SECONDARY: + if (last_status_.member_status != status.member_status) { logger->log_info(name(), "Became SECONDARY"); } break; - case ARBITER: + case MongoDBManagedReplicaSetInterface::ARBITER: //logger->log_info(name(), "Arbiter"); break; - case NOT_INITIALIZED: + case MongoDBManagedReplicaSetInterface::NOT_INITIALIZED: if (hosts_.size() == 1 || leader_elect()) { // we are alone or leader, initialize replica set if (hosts_.size() == 1) { @@ -224,7 +232,7 @@ MongoDBReplicaSetConfig::loop() rs_init(); } break; - case INVALID_CONFIG: + case MongoDBManagedReplicaSetInterface::INVALID_CONFIG: // we might later want to cover some typical cases logger->log_error(name(), "Invalid configuration, hands-on required\n%s", reply.jsonString().c_str()); @@ -232,14 +240,28 @@ MongoDBReplicaSetConfig::loop() default: break; } - last_status_ = status; + + if (last_status_ != status) { + rs_status_if_->set_member_status(status.member_status); + rs_status_if_->set_primary_status(status.primary_status); + rs_status_if_->set_error_msg(status.error_msg.c_str()); + rs_status_if_->write(); + + last_status_ = status; + } + timewait_->wait_systime(); } -MongoDBReplicaSetConfig::ReplicaSetNodeStatus +MongoDBReplicaSetConfig::ReplicaSetStatus MongoDBReplicaSetConfig::rs_status(mongo::BSONObj &reply) { + ReplicaSetStatus status = { + .member_status = MongoDBManagedReplicaSetInterface::ERROR, + .primary_status = MongoDBManagedReplicaSetInterface::PRIMARY_UNKNOWN + }; + mongo::BSONObj cmd(BSON("replSetGetStatus" << 1)); try { bool ok = local_client_->runCommand("admin", cmd, reply); @@ -247,18 +269,23 @@ MongoDBReplicaSetConfig::rs_status(mongo::BSONObj &reply) if (! ok) { if (reply["code"].numberInt() == mongo::ErrorCodes::NotYetInitialized) { logger->log_warn(name(), "Instance has not received replica set configuration, yet"); - return NOT_INITIALIZED; + status.member_status = MongoDBManagedReplicaSetInterface::NOT_INITIALIZED; + status.error_msg = "Instance has not received replica set configuration, yet"; } else if (reply["code"].numberInt() == mongo::ErrorCodes::InvalidReplicaSetConfig) { logger->log_error(name(), "Invalid replica set configuration: %s", reply.jsonString().c_str()); - return INVALID_CONFIG; + status.member_status = MongoDBManagedReplicaSetInterface::INVALID_CONFIG; + status.error_msg = "Invalid replica set configuration: " + reply.jsonString(); + } else { + status.error_msg = "Unknown error"; } - return ERROR; + return status; } else { //logger->log_warn(name(), "rs status reply: %s", reply.jsonString().c_str()); try { mongo::BSONObjIterator members(reply.getObjectField("members")); bool have_primary = false; - ReplicaSetNodeStatus self_status = REMOVED; + MongoDBManagedReplicaSetInterface::ReplicaSetMemberStatus self_status = + MongoDBManagedReplicaSetInterface::REMOVED; while(members.more()) { mongo::BSONObj m = members.next().Obj(); int state = m["state"].Int(); @@ -266,32 +293,37 @@ MongoDBReplicaSetConfig::rs_status(mongo::BSONObj &reply) if (m.hasField("self") && m["self"].boolean()) { switch (state) { - case 1: self_status = PRIMARY; break; - case 2: self_status = SECONDARY; break; + case 1: self_status = MongoDBManagedReplicaSetInterface::PRIMARY; break; + case 2: self_status = MongoDBManagedReplicaSetInterface::SECONDARY; break; case 3: // RECOVERING case 5: // STARTUP2 case 9: // ROLLBACK - self_status = INITIALIZING; break; + self_status = MongoDBManagedReplicaSetInterface::INITIALIZING; break; break; - case 7: self_status = ARBITER; break; - default: self_status = ERROR; break; + case 7: self_status = MongoDBManagedReplicaSetInterface::ARBITER; break; + default: self_status = MongoDBManagedReplicaSetInterface::ERROR; break; } } } - if (have_primary) { - return self_status; - } else { - return NO_PRIMARY; - } + status.primary_status = + have_primary ? MongoDBManagedReplicaSetInterface::HAVE_PRIMARY + : MongoDBManagedReplicaSetInterface::NO_PRIMARY; + status.member_status = self_status; + return status; } catch (mongo::DBException &e) { logger->log_warn(name(), "Failed to analyze member info: %s", e.what()); - return ERROR; + status.member_status = MongoDBManagedReplicaSetInterface::ERROR; + status.error_msg = std::string("Failed to analyze member info: ") + e.what(); + return status; } } } catch (mongo::DBException &e) { logger->log_warn(name(), "Failed to get RS status: %s", e.what()); - return ERROR; + status.member_status = MongoDBManagedReplicaSetInterface::ERROR; + status.error_msg = std::string("Failed to get RS status: ") + e.what(); + return status; } + return status; } diff --git a/src/plugins/mongodb/mongodb_replicaset_config.h b/src/plugins/mongodb/mongodb_replicaset_config.h index f026c92..4ff89e1 100644 --- a/src/plugins/mongodb/mongodb_replicaset_config.h +++ b/src/plugins/mongodb/mongodb_replicaset_config.h @@ -25,6 +25,9 @@ #include <core/threading/thread.h> #include <aspect/logging.h> #include <aspect/clock.h> +#include <aspect/blackboard.h> + +#include <interfaces/MongoDBManagedReplicaSetInterface.h> #include <string> #include <vector> @@ -45,7 +48,8 @@ namespace mongo { class MongoDBReplicaSetConfig : public fawkes::Thread, public fawkes::LoggingAspect, - public fawkes::ClockAspect + public fawkes::ClockAspect, + public fawkes::BlackBoardAspect { public: MongoDBReplicaSetConfig(fawkes::Configuration *config, @@ -66,19 +70,19 @@ class MongoDBReplicaSetConfig bool leader_elect(bool force = false); void leader_resign(); - enum ReplicaSetNodeStatus { - PRIMARY, - SECONDARY, - ARBITER, - NO_PRIMARY, - NOT_INITIALIZED, - INITIALIZING, - INVALID_CONFIG, - REMOVED, - ERROR + struct ReplicaSetStatus { + fawkes::MongoDBManagedReplicaSetInterface::ReplicaSetMemberStatus member_status; + fawkes::MongoDBManagedReplicaSetInterface::ReplicaSetPrimaryStatus primary_status; + std::string error_msg; + + bool operator!=(const ReplicaSetStatus& other) const { + return member_status != other.member_status || + primary_status != other.primary_status || + error_msg != other.error_msg; + } }; - ReplicaSetNodeStatus rs_status(mongo::BSONObj &reply); + ReplicaSetStatus rs_status(mongo::BSONObj &reply); void rs_init(); void rs_monitor(const mongo::BSONObj &reply); bool check_alive(const std::string &h); @@ -110,7 +114,9 @@ class MongoDBReplicaSetConfig int leader_expiration_; fawkes::TimeWait *timewait_; - ReplicaSetNodeStatus last_status_; + ReplicaSetStatus last_status_; + + fawkes::MongoDBManagedReplicaSetInterface* rs_status_if_; }; #endif - *commit* 9707f1e30027b8984281ccb086896154c0d8659c - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 23:00:28 2018 +0200 Subject: clips: report load errors, support path-batch load operation src/plugins/clips/clips/path.clp | 73 ++++++++++++++++++++++++++++--------- 1 files changed, 55 insertions(+), 18 deletions(-) _Diff for modified files_: diff --git a/src/plugins/clips/clips/path.clp b/src/plugins/clips/clips/path.clp index 3f336ae..465079e 100644 --- a/src/plugins/clips/clips/path.clp +++ b/src/plugins/clips/clips/path.clp @@ -18,6 +18,7 @@ (slot file (type STRING)) (slot path (type STRING)) (slot loaded (type SYMBOL) (allowed-values TRUE FALSE) (default FALSE)) + (slot error-msg (type STRING)) ) ; Completely reset path information. @@ -81,25 +82,61 @@ ) (deffunction path-load (?file) - (bind ?f (path-resolve ?file)) - (if ?f - then - (assert (path-info (loaded TRUE) (file ?file) (path ?f))) - (load ?f) - else - (printout error "Cannot load file " ?file " (file not found in " (path-string) ")" crlf) - (return ?f) - ) + (bind ?f (path-resolve ?file)) + (if ?f + then + (bind ?loaded (load ?f)) + (assert (path-info (loaded ?loaded) (file ?file) (path ?f))) + (return ?loaded) + else + (bind ?emsg (str-cat "Cannot load file " ?file " (file not found in " (path-string) ")")) + (printout error ?emsg crlf) + (assert (path-info (loaded FALSE) (file ?file) (error-msg ?emsg))) + (return FALSE) + ) ) (deffunction path-load* (?file) - (bind ?f (path-resolve ?file)) - (if ?f - then - (assert (path-info (loaded TRUE) (file ?file) (path ?f))) - (load* ?f) - else - (printout error "Cannot load file " ?file " (file not found in " (path-string) ")" crlf) - (return ?f) - ) + (bind ?f (path-resolve ?file)) + (if ?f + then + (bind ?loaded (load* ?f)) + (assert (path-info (loaded ?loaded) (file ?file) (path ?f))) + (return ?loaded) + else + (bind ?emsg (str-cat "Cannot load file " ?file " (file not found in " (path-string) ")")) + (printout error ?emsg crlf) + (assert (path-info (loaded FALSE) (file ?file) (error-msg ?emsg))) + (return FALSE) + ) +) + +(deffunction path-batch (?file) + (bind ?f (path-resolve ?file)) + (if ?f + then + (bind ?loaded (batch ?f)) + (assert (path-info (loaded ?loaded) (file ?file) (path ?f))) + (return ?loaded) + else + (bind ?emsg (str-cat "Cannot batch load file " ?file " (file not found in " (path-string) ")")) + (printout error ?emsg crlf) + (assert (path-info (loaded FALSE) (file ?file) (error-msg ?emsg))) + (return FALSE) + ) +) + +(deffunction path-batch* (?file) + (bind ?f (path-resolve ?file)) + (if ?f + then + (bind ?loaded (batch* ?f)) + (assert (path-info (loaded ?loaded) (file ?file) (path ?f))) + (return ?loaded) + else + (bind ?emsg (str-cat "Cannot batch load file " ?file " (file not found in " (path-string) ")")) + (printout error ?emsg crlf) + (assert (path-info (loaded FALSE) (file ?file) (error-msg ?emsg))) + (return FALSE) + ) ) - *commit* b543f6488d88900cc38e5d44b979c4c750134637 - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 23:00:50 2018 +0200 Subject: clips: add str-split utility method to std utils src/plugins/clips/clips/utils.clp | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) _Diff for modified files_: diff --git a/src/plugins/clips/clips/utils.clp b/src/plugins/clips/clips/utils.clp index be95cfd..b52c922 100644 --- a/src/plugins/clips/clips/utils.clp +++ b/src/plugins/clips/clips/utils.clp @@ -80,3 +80,21 @@ (if ?p then (return (= ?p 1))) (return FALSE) ) + +(deffunction str-split (?str ?sep) + "Split a string into symbols. + @param ?str string to split + @param ?sep separator of string + @return list of symbols of elements in ?str split by ?sep + " + (bind ?rv (create$)) + (bind ?idx (str-index ?sep ?str)) + (while ?idx do + (bind ?e (sub-string 1 (- ?idx 1) ?str)) + (if (> (str-length ?e) 0) then (bind ?rv (append$ ?rv ?e))) + (bind ?str (sub-string (+ ?idx 1) (str-length ?str) ?str)) + (bind ?idx (str-index ?sep ?str)) + ) + (if (> (str-length ?str) 0) then (bind ?rv (append$ ?rv ?str))) + (return ?rv) +) - *commit* d11c0d4bf9c8a0c025e925f24b6bc9b34d72de9d - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 23:12:28 2018 +0200 Subject: clips-executive: re-factor CX initialization src/plugins/clips-executive/clips/init.clp | 347 ++++++++++++--------- src/plugins/clips-executive/clips/skills-init.clp | 31 -- src/plugins/clips-executive/clips/skills.clp | 11 + 3 files changed, 204 insertions(+), 185 deletions(-) _Diff for modified files_: diff --git a/src/plugins/clips-executive/clips/init.clp b/src/plugins/clips-executive/clips/init.clp index 7f9a8e4..6876557 100644 --- a/src/plugins/clips-executive/clips/init.clp +++ b/src/plugins/clips-executive/clips/init.clp @@ -3,209 +3,248 @@ ; init.clp - CLIPS executive ; ; Created: Tue Sep 19 16:49:42 2017 -; Copyright 2012-2017 Tim Niemueller [www.niemueller.de] +; Copyright 2012-2018 Tim Niemueller [www.niemueller.de] ; Licensed under GPLv2+ license, cf. LICENSE file ;--------------------------------------------------------------------------- (defglobal ?*CONFIG_PREFIX* = "/clips-executive" + ?*INIT-STAGES* = (create$ STAGE-1 STAGE-2 STAGE-3) + ?*CX-FILES* = (create$ "plan.clp" "domain.clp" "worldmodel.clp" "wm-domain-sync.clp" + "wm-config.clp" "blackboard-init.clp" "BATCH|skills.clp") +) + +(deftemplate executive-init-request + (slot stage (type SYMBOL)) + (slot order (type INTEGER)) + (slot name) + (slot feature) + (multislot files (type STRING)) + (slot state (type SYMBOL) (allowed-values PENDING FEATURE-REQUESTED FEATURE-DONE COMPLETED ERROR)) + (multislot error-msgs (type STRING)) ) (defrule executive-load-config + (declare (salience ?*SALIENCE-INIT*)) (executive-init) => (config-load ?*CONFIG_PREFIX*) ) -; (defrule executive-load-executive -; (executive-init) -; (confval (path "/clips-executive/spec") (type STRING) (value ?v)) -; => -; (printout t "Loading executive spec '" ?v "'" crlf) -; (bind ?executive-file (path-resolve (str-cat ?v ".clp"))) -; (if ?executive-file -; then (batch* ?executive-file) -; else (printout logerror "Cannot find executive spec " ?v crlf)) -; ) +(deffunction cx-debug-unwatch-facts ($?templates) + (bind ?deftemplates (get-deftemplate-list)) + (printout debug "Unwatching fact templates " ?templates crlf) + (foreach ?v ?templates + (bind ?v-sym (sym-cat ?v)) + (if (member$ ?v-sym ?deftemplates) + then (unwatch facts ?v-sym) + else (printout warn "Cannot unwatch " ?v " (deftemplate not defined)" crlf) + ) + ) +) + +(deffunction cx-debug-unwatch-rules ($?rules) + (bind ?defrules (get-defrule-list)) + (printout debug "Unwatching rules " ?rules crlf) + (foreach ?v ?rules + (bind ?v-sym (sym-cat ?v)) + (if (member$ ?v-sym ?defrules) + then (unwatch rules ?v-sym) + else (printout warn "Cannot unwatch " ?v " (defrule not defined)" crlf) + ) + ) +) (defrule executive-enable-debug (declare (salience ?*SALIENCE-INIT*)) (executive-init) - (confval (path "/clips-executive/clips-debug") (type BOOL) (value TRUE)) + (confval (path "/clips-executive/debug/enable") (type BOOL) (value TRUE)) + (confval (path "/clips-executive/spec") (type STRING) (value ?spec)) => (printout t "CLIPS debugging enabled, watching facts and rules" crlf) (watch facts) (watch rules) ;(dribble-on "trace.txt") -) - -(defrule executive-debug-level - (declare (salience ?*SALIENCE-INIT*)) - (executive-init) - (confval (path "/clips-executive/debug-level") (type UINT) (value ?v)) - => - (printout t "Setting debug level to " ?v " (was " ?*DEBUG* ")" crlf) - (debug-set-level ?v) -) + (do-for-fact ((?c confval)) (and (eq ?c:path "/clips-executive/debug/level") (eq ?c:type UINT)) + (printout debug "Setting debug level to " ?c:value " (was " ?*DEBUG* ")" crlf) + (debug-set-level ?c:value) + ) -(defrule executive-silence-debug-facts - (declare (salience ?*SALIENCE-INIT-LATE*)) - (executive-init) - (confval (path "/clips-executive/clips-debug") (type BOOL) (value TRUE)) - (confval (path "/clips-executive/unwatch-facts") (type STRING) (is-list TRUE) (list-value $?lv)) - => - (printout t "Disabling watching of the following facts: " ?lv crlf) - (bind ?deftemplates (get-deftemplate-list)) - (foreach ?v ?lv - (bind ?v-sym (sym-cat ?v)) - (if (member$ ?v-sym ?deftemplates) - then (unwatch facts ?v-sym) - else (printout warn "Cannot unwatch " ?v " (deftemplate not defined)" crlf) - ) + (do-for-fact ((?c confval)) (and (eq ?c:path "/clips-executive/debug/unwatch-facts") + (eq ?c:type STRING) ?c:is-list) + (cx-debug-unwatch-facts ?c:list-value) ) -) - -(defrule executive-silence-debug-rules - (declare (salience ?*SALIENCE-INIT-LATE*)) - (executive-init) - (confval (path "/clips-executive/clips-debug") (type BOOL) (value TRUE)) - (confval (path "/clips-executive/unwatch-rules") (type STRING) (is-list TRUE) (list-value $?lv)) - => - (printout t "Disabling watching of the following rules: " ?lv crlf) - (bind ?defrules (get-defrule-list)) - (foreach ?v ?lv - (bind ?v-sym (sym-cat ?v)) - (if (member$ ?v-sym ?defrules) - then (unwatch rules ?v-sym) - else (printout warn "Cannot unwatch " ?v " (defrule not defined)" crlf) - ) + (do-for-fact ((?c confval)) (and (eq ?c:path "/clips-executive/debug/unwatch-rules") + (eq ?c:type STRING) ?c:is-list) + (cx-debug-unwatch-rules ?c:list-value) ) ) -(defrule executive-init-stage1 - (executive-init) - => - (printout t "PDDL feature" crlf) - (ff-feature-request "pddl-parser") - (printout t "Blackboard feature and skill exec init" crlf) - (ff-feature-request "blackboard") +(deffunction cx-init-indexes (?spec ?stage) + (bind ?rv (create$)) + (do-for-all-facts ((?c confval)) (str-prefix (str-cat "/clips-executive/specs/" ?spec "/init/" ?stage "/") + ?c:path) + (bind ?path-elements (str-split ?c:path "/")) + (bind ?idx (nth$ 6 ?path-elements)) + (if (not (member$ ?idx ?rv)) then (bind ?rv (append$ ?rv ?idx))) + ) + (return ?rv) ) -(defrule executive-conditional-navgraph-init - (executive-init) - (confval (path "/clips-executive/use_navgraph") (type BOOL) (value TRUE)) - => - (printout t "Loading navgraph feature" crlf) - (ff-feature-request "navgraph") +(deffunction cx-assert-init-requests (?spec ?stage ?feature-default) + (bind ?cfg-stage (str-cat (lowcase ?stage))) + (bind ?cfgpfx (str-cat "/clips-executive/specs/" ?spec "/init/" ?cfg-stage "/")) + (foreach ?i (cx-init-indexes ?spec ?cfg-stage) + (bind ?feature ?feature-default) + (bind ?name "MISSING") + (bind ?files (create$)) + (bind ?error-msgs (create$)) + (bind ?state PENDING) + (if (not (any-factp ((?c confval)) (eq (str-cat ?cfgpfx ?i "/name") ?c:path))) + then + (bind ?state ERROR) + (bind ?error-msgs (append$ ?error-msgs (str-cat ?stage " entry " ?i " is missing name entry"))) + else + (do-for-fact ((?c confval)) (eq (str-cat ?cfgpfx ?i "/name") ?c:path) + (bind ?name ?c:value) + ) + (do-for-fact ((?c confval)) (eq (str-cat ?cfgpfx ?i "/feature-request") ?c:path) + (bind ?feature ?c:value) + ) + (do-for-fact ((?c confval)) (eq (str-cat ?cfgpfx ?i "/file") ?c:path) + (bind ?files (append$ ?files ?c:value)) + ) + (do-for-fact ((?c confval)) (eq (str-cat ?cfgpfx ?i "/files") ?c:path) + (if (not ?c:is-list) + then + (printout warn "Config entry " (str-cat ?cfgpfx ?i "/files") " is not a list value, ignoring") + else + (bind ?files (append$ ?files ?c:list-value)) + ) + ) + ) + (assert (executive-init-request (state ?state) (error-msgs ?error-msgs) + (stage ?stage) (order ?i-index) + (name (sym-cat ?name)) (feature ?feature) (files ?files))) + ) ) -(defrule executive-conditional-robot-memory-init - "Load robot-memory feature required for PDDL." - (executive-init) - (confval (path "/clips-executive/use_pddl") (type BOOL) (value TRUE)) - => - (printout t "Robot Memory feature" crlf) - (ff-feature-request "robot_memory") +(defrule executive-init-start + (declare (salience ?*SALIENCE-INIT-LATE*)) + (executive-init) + (confval (path "/clips-executive/spec") (type STRING) (value ?spec)) + => + (cx-assert-init-requests ?spec STAGE-1 TRUE) + (assert (executive-init-request (state PENDING) (stage STAGE-2) (order 0) + (name cx-files) (feature FALSE) (files ?*CX-FILES*))) + (cx-assert-init-requests ?spec STAGE-2 FALSE) + (cx-assert-init-requests ?spec STAGE-3 FALSE) + (assert (executive-init-stage STAGE-1)) ) -(defrule executive-conditional-pddl-init - "Load PDDL feature if requested in the config." - (executive-init) - (ff-feature-loaded blackboard) - (confval (path "/clips-executive/use_pddl") (type BOOL) (value TRUE)) - (ff-feature-loaded robot_memory) - => - (printout t "Loading PDDL Planner interface" crlf) - (path-load "pddl-init.clp") +(defrule executive-init-failed + (declare (salience ?*SALIENCE-INIT*)) + (executive-init) + (executive-init-request (state ERROR) (stage ?stage) (order ?i) (error-msgs $?error-msgs)) + ?sf <- (executive-init-stage ?stage) + => + (printout error crlf) + (printout error "***********************************************************" crlf) + (printout error crlf) + (printout error ?stage " request " ?i " failed: " ?error-msgs crlf) + (printout error crlf) + (printout error "***********************************************************" crlf) + (printout error crlf) + (retract ?sf) + (assert (executive-init-stage FAILED)) ) -(defrule executive-conditional-protobuf-init - "Load protobuf feature required for protobuf communication" - (executive-init) - (confval (path "/clips-executive/use_protobuf") (type BOOL) (value TRUE)) - => - (printout t "Loading Protobuf feature" crlf) - (ff-feature-request "protobuf") +(defrule executive-init-stage-request-feature + (executive-init) + (executive-init-stage ?stage) + ?ir <- (executive-init-request (state PENDING) (stage ?stage) (order ?order) + (name ?name) (feature TRUE)) + (not (executive-init-request (state ~COMPLETED) (stage ?stage) (order ?order2&:(< ?order2 ?order)))) + (ff-feature ?name) + => + (printout t "Init " ?stage ": requesting feature " ?name crlf) + (ff-feature-request ?name) + (modify ?ir (state FEATURE-REQUESTED)) ) -(defrule executive-conditional-tf-init - "Load tf feature if required in config " - (executive-init) - (confval (path "/clips-executive/use_tf") (type BOOL) (value TRUE)) - => - (printout t "Loading tf feature" crlf) - (ff-feature-request "tf") +(defrule executive-init-stage-request-no-feature + (executive-init) + (executive-init-stage ?stage) + ?ir <- (executive-init-request (state PENDING) (stage ?stage) (order ?order) + (name ?name) (feature FALSE)) + (not (executive-init-request (state ~COMPLETED) (stage ?stage) (order ?order2&:(< ?order2 ?order)))) + => + (printout t "Init " ?stage ": no feature to request for " ?name crlf) + (modify ?ir (state FEATURE-DONE)) ) -(defrule executive-init-stage2 +(defrule executive-init-stage-request-feature-unavailable (executive-init) - (ff-feature-loaded blackboard) + (executive-init-stage ?stage) + ?ir <- (executive-init-request (state PENDING) (stage ?stage) (order ?order) + (name ?name) (feature TRUE)) + (not (executive-init-request (state ~COMPLETED) (stage ?stage) (order ?order2&:(< ?order2 ?order)))) + ;(not (ff-feature ?name)) => - - ; Here we load basic, non-flow components which deal with - ; representation and templates - (path-load "plan.clp") - (path-load "domain.clp") - (path-load "worldmodel.clp") - (path-load "wm-domain-sync.clp") - (path-load "wm-config.clp") - (path-load "blackboard-init.clp") - (path-load "skills-init.clp") + (printout error "Init " ?stage ": feature " ?name " is not available" crlf) + (modify ?ir (state ERROR) (error-msgs (str-cat "Feature " ?name " is not available"))) ) -(defrule executive-init-load-robot-memory-sync - "Load the robot memory domain model synchronization if enabled in the config." +(defrule executive-init-stage-request-feature-fulfilled (executive-init) - (ff-feature-loaded robot_memory) - ; Only load after the domain file has been loaded. - (path-info (file "domain.clp") (loaded TRUE)) - (confval (path "/clips-executive/sync_domain_facts") (type BOOL) (value TRUE)) - => - (path-load "robot-memory-sync.clp") + (executive-init-stage ?stage) + ?ir <- (executive-init-request (state FEATURE-REQUESTED) (stage ?stage) (name ?name)) + (ff-feature-loaded ?name) + => + (printout t "Init " ?stage ": feature request for " ?name " has been fulfilled" crlf) + (modify ?ir (state FEATURE-DONE)) ) -(defrule executive-init-stage3 +(defrule executive-init-stage-request-files (executive-init) - (ff-feature-loaded skills) - (or (ff-feature-loaded navgraph) - (not (confval (path "/clips-executive/use_navgraph") - (type BOOL) (value TRUE))) - ) - (or (and (ff-feature-loaded pddl_planner) (ff-feature-loaded robot_memory)) - (not (confval (path "/clips-executive/use_pddl") - (type BOOL) (value TRUE))) - ) - (or (ff-feature-loaded protobuf) - (not (confval (path "/clips-executive/use_protobuf") - (type BOOL) (value TRUE))) - ) - (or (ff-feature-loaded tf) - (not (confval (path "/clips-executive/use_tf") - (type BOOL) (value TRUE))) - ) - (or (path-info (file "robot-memory-sync.clp") (loaded TRUE)) - (not (confval (path "/clips-executive/sync_domain_facts") (type BOOL) - (value TRUE))) - ) - (confval (path "/clips-executive/spec") (type STRING) (value ?spec)) + (executive-init-stage ?stage) + ?ir <- (executive-init-request (state FEATURE-DONE) (stage ?stage) (name ?name) (files $?files)) => - ; Common spec config prefix - (bind ?pf (str-cat "/clips-executive/specs/" ?spec "/")) - (foreach ?component (create$ "domain" "worldmodel" "state-estimation" - "goal-reasoner" "goal-expander" - "macro-expansion" "action-selection" - "action-execution" "execution-monitoring") - (do-for-fact ((?c confval)) (and (eq ?c:path (str-cat ?pf ?component)) (eq ?c:type STRING)) - (if ?c:is-list - then - (progn$ (?v ?c:list-value) - (printout t "Loading component '" ?component "/" ?v-index "' (" ?v ")" crlf) - (path-load ?v) - ) - else - (printout t "Loading component '" ?component "' (" ?c:value ")" crlf) - (path-load ?c:value) + (if (> (length$ ?files) 0) + then + (printout t "Init " ?stage ": loading files for " ?name " " ?files crlf) + (foreach ?f ?files + (bind ?pipepos (str-index "|" ?f)) + (bind ?file-op "LOAD") + (bind ?file-name ?f) + (if ?pipepos then + (bind ?file-op (sub-string 1 (- ?pipepos 1) ?f)) + (bind ?file-name (sub-string (+ ?pipepos 1) (str-length ?f) ?f)) + ) + (switch ?file-op + (case "BATCH" then (path-batch* ?file-name)) + (case "BATCH*" then (path-batch* ?file-name)) + (default (path-load ?file-name)) ) ) ) + (modify ?ir (state COMPLETED)) +) + +(defrule executive-init-stage-finished + (executive-init) + ?sf <- (executive-init-stage ?stage) + (not (executive-init-request (state ~COMPLETED) (stage ?stage))) + => + (retract ?sf) + (bind ?stage-idx (member$ ?stage ?*INIT-STAGES*)) + (if (< ?stage-idx (length$ ?*INIT-STAGES*)) + then + (bind ?next-stage (nth$ (+ ?stage-idx 1) ?*INIT-STAGES*)) + (printout t "Init " ?stage ": finished, advancing to " ?next-stage crlf) + (assert (executive-init-stage ?next-stage)) + else + (printout t "Initialization completed" crlf) + (assert (executive-initialized)) + ) ) diff --git a/src/plugins/clips-executive/clips/skills.clp b/src/plugins/clips-executive/clips/skills.clp index cc82f66..3f7abd7 100644 --- a/src/plugins/clips-executive/clips/skills.clp +++ b/src/plugins/clips-executive/clips/skills.clp @@ -26,6 +26,17 @@ (multislot start-time (type INTEGER) (cardinality 2 2) (default (create$ 0 0))) ) +(deftemplate skiller-control + (slot acquired (type SYMBOL) (allowed-values FALSE TRUE)) + (slot acquiring (type SYMBOL) (allowed-values FALSE TRUE)) + (multislot last-try (type INTEGER) (cardinality 2 2) (default (create$ 0 0))) +) + +; Expects that the file is batch-loaded +(blackboard-open-reading "SkillerInterface" "Skiller") +(assert (skiller-control)) +(assert (ff-feature-loaded skills)) + (deffunction merge-params (?params ?param-values) (if (not (= (length$ ?params) (length$ ?param-values))) then (printout logerror "Invalid skill call, number of parameters is not the " - *commit* 3570aa47e01c4a1ed16cc0f06c77df2702e6d51e - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 23:15:20 2018 +0200 Subject: config: new initialization configuration for clips-executive cfg/conf.d/clips-executive.yaml | 106 +++++++++++++++++++++++++++------------ 1 files changed, 73 insertions(+), 33 deletions(-) _Diff for modified files_: diff --git a/cfg/conf.d/clips-executive.yaml b/cfg/conf.d/clips-executive.yaml index c570653..e7d179f 100644 --- a/cfg/conf.d/clips-executive.yaml +++ b/cfg/conf.d/clips-executive.yaml @@ -5,35 +5,23 @@ doc-url: !url http://trac.fawkesrobotics.org/wiki/Plugins/clips-executive --- clips-executive: # If true, will enable watching of facts and rules - clips-debug: true - - # If CLIPS debugging is enabled, certain rules and facts can be excluded - # from watching, e.g. if they are showing up at too high frequencies or - # are not of interest. - unwatch-facts: ["time"] - unwatch-rules: ["time-retract"] - - # Currently not working in clips-executive! - # - # If true, simulate skills (assuming they always succeed) instead of - # actually executing the skills. The time indicates how long it should - # take to declare success on skill execution. Note that this cannot - # simulate side effects, like a called component writing to an interface - #skill-sim: true - #skill-sim-time: 2.0 - - # debug level is a number of: 0 ~ none, 1 ~ minimal, 2 ~ more, 3 ~ maximum - debug-level: 3 + debug: + enable: true + + # debug level is a number of: 0 ~ none, 1 ~ minimal, 2 ~ more, 3 ~ maximum + level: 3 + + # If CLIPS debugging is enabled, certain rules and facts can be excluded + # from watching, e.g. if they are showing up at too high frequencies or + # are not of interest. + unwatch-facts: ["time"] + unwatch-rules: ["time-retract"] # automatically pre-require redefine-warning feature? Enabling # this in the plugin instead of in the initial code (init.clp) is # beneficial because it already catches errors in said file. request-redefine-warning-feature: true - # Automatically assert the (start) fact after successful initialization, - # otherwise wait until the an enable message has been received - # auto-start: true - # If set to true, will trigger the assertion of a (time (now)) fact in # each loop. This can be used to trigger loop events in CLIPS. assert-time-each-loop: true @@ -49,22 +37,74 @@ clips-executive: # Agent name. On startup the clips-agent will try to resolve a file named # <agent name>.clp. It must be in the CLIPS path directories. spec: test - use_pddl: false - sync_domain_facts: false specs: test: - domain: test-scenario/test-domain.clp - worldmodel: test-scenario/worldmodel-facts.clp - goal-reasoner: test-scenario/goal-reasoner.clp - goal-expander: test-scenario/fixed-sequence.clp - action-selection: test-scenario/action-selection.clp - #macro-expansion: test-scenario/action-selection.clp - action-execution: ["skills-actions.clp", "test-scenario/print-action.clp"] - execution-monitoring: test-scenario/execution-monitoring.clp - state-estimation: test-scenario/state-estimation.clp - # Map plan actions to skill strings. + # The following configures CX initialization. + # Initialization is organized in three stages: + # 1. Basic CLIPS and feature intialization + # 2. Domain-independent CX initialization + # 3. Domain-specific CX initialization + # The stages and the steps within the stages run strictly + # ordered. The next stage or step is not executed before the + # previous one completes. + init: + # Basic CLIPS and feature initialization + # The first stage is executed in an (almost) bare CLIPS + # environment. CX-specific parts such as the domain or world + # model have not been loaded, yet. + # Use this to request features and load files related to such + # features or performing other initialization duties. + # In this stage, elements are assumed to reference Fawkes CLIPS + # features by default, i.e., an error is reported if a requested + # feature is not available at the time of initialization. + # Features will be requested and only after all have been loaded + # initialization will progress to stage-2. + # To override this for some entries, set "feature-request: + # false" for the respective list elements. + stage-1: + - name: blackboard + - name: pddl-parser + #- name: robot_memory + #- name: pddl-planner + # feature-request: false + # files: ["pddl-init.clp"] + - name: navgraph + + # stage-2 is domain-independent CX initialization + # It contains a set of fixed items loaded. Custom extensions may + # be loaded in this stage. They are loaded *after* the defaults. + + # Domain-specific CX initialization. + # In the third stage load domain-specific files such as domain + # representations, world model bits (mode of synchronization), + # goal reasoner and expander, and action execution machinery. + # At this point all features requested in stage-1 have been + # provided and the CX domain-independent initialization is + # complete. Files are loaded in the order given, account for + # dependencies among the files. + # Each element of this stage must consist of a name and one or + # more files to load. + stage-3: + - name: domain + file: test-scenario/test-domain.clp + - name: state-estimation + file: test-scenario/state-estimation.clp + - name: worldmodel + files: [test-scenario/worldmodel-facts.clp] + - name: goal-reasoner + file: test-scenario/goal-reasoner.clp + - name: goal-expander + file: test-scenario/fixed-sequence.clp + - name: action-selection + file: test-scenario/action-selection.clp + - name: action-execution + files: [skills-actions.clp, test-scenario/print-action.clp] + - name: execution-monitoring + file: test-scenario/execution-monitoring.clp + + # Map plan actions to skill strings, used by skill action execution action-mapping: say: say{text=?(text)s, wait=true} say-hello: say{text="Hello ?(name)y", wait=true} - *commit* afd52c4457464958090d7198825ccf8bf0789501 - - - - - - - - - - Author: Tim Niemueller <niemuel...@kbsg.rwth-aachen.de> Date: Mon Apr 23 23:16:28 2018 +0200 Subject: clips-executive: verify early init and do not assert (start) .../clips-executive/clips_executive_thread.cpp | 21 ++++++++++++++----- .../clips-executive/clips_executive_thread.h | 2 - 2 files changed, 15 insertions(+), 8 deletions(-) _Diff for modified files_: diff --git a/src/plugins/clips-executive/clips_executive_thread.cpp b/src/plugins/clips-executive/clips_executive_thread.cpp index b3eabc4..cd9639b 100644 --- a/src/plugins/clips-executive/clips_executive_thread.cpp +++ b/src/plugins/clips-executive/clips_executive_thread.cpp @@ -132,7 +132,21 @@ ClipsExecutiveThread::init() clips->refresh_agenda(); clips->run(); - started_ = false; + // Verify that initialization did not fail (yet) + { + CLIPS::Fact::pointer fact = clips->get_facts(); + while (fact) { + CLIPS::Template::pointer tmpl = fact->get_template(); + if (tmpl->name() == "executive-init-stage") { + CLIPS::Values v = fact->slot_value(""); + if (v.size() > 0 && v[0].as_string() == "FAILED") { + throw Exception("CLIPS Executive initialization failed"); + } + } + + fact = fact->next(); + } + } } @@ -150,11 +164,6 @@ ClipsExecutiveThread::loop() { MutexLocker lock(clips.objmutex_ptr()); - if (! started_) { - clips->assert_fact("(start)"); - started_ = true; - } - // might be used to trigger loop events // must be cleaned up each loop from within the CLIPS code if (cfg_assert_time_each_loop_) { diff --git a/src/plugins/clips-executive/clips_executive_thread.h b/src/plugins/clips-executive/clips_executive_thread.h index 09e8810..0b654ae 100644 --- a/src/plugins/clips-executive/clips_executive_thread.h +++ b/src/plugins/clips-executive/clips_executive_thread.h @@ -63,8 +63,6 @@ class ClipsExecutiveThread private: bool cfg_assert_time_each_loop_; - bool started_; - std::shared_ptr<fawkes::ActionSkillMapping> action_skill_mapping_; }; -- 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