diff --git a/include/ontologenius/interface/RosInterface.h b/include/ontologenius/interface/RosInterface.h index c2b8dd28..9a176431 100644 --- a/include/ontologenius/interface/RosInterface.h +++ b/include/ontologenius/interface/RosInterface.h @@ -108,6 +108,10 @@ class RosInterface /// @brief The variable used to display or not debug information. Can be changed at run time bool display_; + /// @brief represents all files provided at the initialization + std::vector files_; + /// @brief represents the dedicated intern file + std::string intern_file_; /// @brief The ROS topic callback receiving statements not stamped void knowledgeCallback(compat::onto_ros::MessageWrapper msg); diff --git a/src/interface/RosInterface.cpp b/src/interface/RosInterface.cpp index 7682a1ce..4dba8601 100644 --- a/src/interface/RosInterface.cpp +++ b/src/interface/RosInterface.cpp @@ -74,7 +74,9 @@ void RosInterface::init(const std::string& lang, const std::string& intern_file, if(pose != std::string::npos) dedicated_intern_file.insert(pose, "_" + name_); } + intern_file_ = dedicated_intern_file; + files_ = files; if(onto_->preload(dedicated_intern_file) == false) for(auto& file : files) onto_->readFromFile(file); @@ -233,6 +235,21 @@ bool RosInterface::actionsHandle(compat::onto_ros::ServiceWrappercode = REQUEST_ERROR; } + else if(req->action == "reset") + { + lock(); + delete onto_; + onto_ = new Ontology(); + onto_->setDisplay(display_); + reasoners_.link(onto_); + feeder_.link(onto_); + sparql_.link(onto_); + + if(onto_->preload(intern_file_) == false) + for(auto& file : files_) + onto_->readFromFile(file); + release(); + } else if(req->action == "clear") { lock();