[Fawkes Git] branch/fzwilling/robot-memory: 3 revs updated. (0.5.0-3452-gac7cf87)

Frederik Zwilling zwilling at kbsg.rwth-aachen.de
Wed Nov 30 16:52:45 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, fzwilling/robot-memory has been updated
        to  ac7cf879b77533cdc706afe79a17496a169c9694 (commit)
       via  7dc316b0a922ca18e24d632b834cc1060fa45546 (commit)
       via  dce07be9146ffbc0d9e88e5a438462decd7fd5c1 (commit)
      from  0bd5b96d1753dbf5b8414ceac7422ed4eda6ba2b (commit)

http://git.fawkesrobotics.org/fawkes.git/fzwilling/robot-memory

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 dce07be9146ffbc0d9e88e5a438462decd7fd5c1
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Wed Nov 30 15:02:17 2016 +0100
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Wed Nov 30 16:52:27 2016 +0100

    clips-robot-memory: added function (bson-has-hield ?obj "field")

http://git.fawkesrobotics.org/fawkes.git/commit/dce07be
http://trac.fawkesrobotics.org/changeset/dce07be

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 7dc316b0a922ca18e24d632b834cc1060fa45546
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Wed Nov 30 15:03:09 2016 +0100
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Wed Nov 30 16:52:33 2016 +0100

    robot-memory: fixed trigger on local replica set

http://git.fawkesrobotics.org/fawkes.git/commit/7dc316b
http://trac.fawkesrobotics.org/changeset/7dc316b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit ac7cf879b77533cdc706afe79a17496a169c9694
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Wed Nov 30 16:51:06 2016 +0100
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Wed Nov 30 16:52:38 2016 +0100

    pddl-robot-memory: added interface files

http://git.fawkesrobotics.org/fawkes.git/commit/ac7cf87
http://trac.fawkesrobotics.org/changeset/ac7cf87

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 ...veRobotMemoryInterface.h => PddlGenInterface.h} |   46 +++--
 .../clips_robot_memory_thread.cpp                  |   18 ++
 .../clips-robot-memory/clips_robot_memory_thread.h |    1 +
 .../interfaces/PddlGenInterface.cpp                |  235 ++++++++++++++++++++
 .../interfaces/PddlGenInterface.h_ext}             |   46 +++--
 .../interfaces/PddlGenInterface.tolua}             |   25 ++-
 src/plugins/robot-memory/event_trigger_manager.cpp |    6 +-
 src/plugins/robot-memory/event_trigger_manager.h   |   11 +-
 8 files changed, 326 insertions(+), 62 deletions(-)
 copy src/libs/interfaces/{OpenraveRobotMemoryInterface.h => PddlGenInterface.h} (70%)
 create mode 100644 src/plugins/pddl-robot-memory/interfaces/PddlGenInterface.cpp
 copy src/{libs/interfaces/OpenraveRobotMemoryInterface.h => plugins/pddl-robot-memory/interfaces/PddlGenInterface.h_ext} (70%)
 copy src/{libs/interfaces/OpenraveRobotMemoryInterface.tolua => plugins/pddl-robot-memory/interfaces/PddlGenInterface.tolua} (79%)


- *Diffs* -------------------------------------------------------------

- *commit* dce07be9146ffbc0d9e88e5a438462decd7fd5c1 - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Wed Nov 30 15:02:17 2016 +0100
Subject: clips-robot-memory: added function (bson-has-hield ?obj "field")

 .../clips_robot_memory_thread.cpp                  |   18 ++++++++++++++++++
 .../clips-robot-memory/clips_robot_memory_thread.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/clips-robot-memory/clips_robot_memory_thread.cpp b/src/plugins/clips-robot-memory/clips_robot_memory_thread.cpp
index 3b9e4f9..187d1fb 100644
--- a/src/plugins/clips-robot-memory/clips_robot_memory_thread.cpp
+++ b/src/plugins/clips-robot-memory/clips_robot_memory_thread.cpp
@@ -96,6 +96,7 @@ ClipsRobotMemoryThread::clips_context_init(const std::string &env_name,
     );
   clips->add_function("robmem-trigger-destroy", sigc::slot<void, void *>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_robotmemory_destroy_trigger)));
   clips->add_function("bson-field-names", sigc::slot<CLIPS::Values, void *>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_bson_field_names)));
+  clips->add_function("bson-has-field", sigc::slot<CLIPS::Value, void *, std::string>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_bson_has_field)));
   clips->add_function("bson-get", sigc::slot<CLIPS::Value, void *, std::string>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_bson_get)));
   clips->add_function("bson-get-array", sigc::slot<CLIPS::Values, void *, std::string>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_bson_get_array)));
   clips->add_function("bson-get-time", sigc::slot<CLIPS::Values, void *, std::string>(sigc::mem_fun(*this, &ClipsRobotMemoryThread::clips_bson_get_time)));
@@ -583,6 +584,23 @@ ClipsRobotMemoryThread::clips_bson_get(void *bson, std::string field_name)
   }
 }
 
+CLIPS::Value
+ClipsRobotMemoryThread::clips_bson_has_field(void *bson, std::string field_name)
+{
+  mongo::BSONObjBuilder *b = static_cast<mongo::BSONObjBuilder *>(bson);
+
+  if (! b) {
+    logger->log_error("MongoDB", "mongodb-bson-get: invalid object");
+    return CLIPS::Value("FALSE", CLIPS::TYPE_SYMBOL);
+  }
+
+  mongo::BSONObj o(b->asTempObj());
+
+  if (! o.hasField(field_name)) {
+    return CLIPS::Value("FALSE", CLIPS::TYPE_SYMBOL);
+  }
+  return CLIPS::Value("TRUE", CLIPS::TYPE_SYMBOL);
+}
 
 CLIPS::Values
 ClipsRobotMemoryThread::clips_bson_get_array(void *bson, std::string field_name)
diff --git a/src/plugins/clips-robot-memory/clips_robot_memory_thread.h b/src/plugins/clips-robot-memory/clips_robot_memory_thread.h
index f4fd1f4..54977ae 100644
--- a/src/plugins/clips-robot-memory/clips_robot_memory_thread.h
+++ b/src/plugins/clips-robot-memory/clips_robot_memory_thread.h
@@ -90,6 +90,7 @@ class ClipsRobotMemoryThread
   CLIPS::Value  clips_robotmemory_cursor_next(void *cursor);
   void          clips_robotmemory_cursor_destroy(void *cursor);
   CLIPS::Values clips_bson_field_names(void *bson);
+  CLIPS::Value  clips_bson_has_field(void *bson, std::string field_name);
   CLIPS::Value  clips_bson_get(void *bson, std::string field_name);
   CLIPS::Values clips_bson_get_array(void *bson, std::string field_name);
   CLIPS::Values clips_bson_get_time(void *bson, std::string field_name);

- *commit* 7dc316b0a922ca18e24d632b834cc1060fa45546 - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Wed Nov 30 15:03:09 2016 +0100
Subject: robot-memory: fixed trigger on local replica set

 src/plugins/robot-memory/event_trigger_manager.cpp |    6 +++---
 src/plugins/robot-memory/event_trigger_manager.h   |   11 +++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/robot-memory/event_trigger_manager.cpp b/src/plugins/robot-memory/event_trigger_manager.cpp
index 684ce51..73dba88 100644
--- a/src/plugins/robot-memory/event_trigger_manager.cpp
+++ b/src/plugins/robot-memory/event_trigger_manager.cpp
@@ -21,7 +21,6 @@
 
 
 #include "event_trigger_manager.h"
-#include <plugin/loader.h>
 #include <boost/bind.hpp>
 
 using namespace fawkes;
@@ -42,9 +41,10 @@ EventTriggerManager::EventTriggerManager(Logger* logger, Configuration* config)
     std::string err_msg = "Could not connect to mongod process: "+ errmsg;
     throw PluginLoadException("robot-memory", err_msg.c_str());
   }
+  repl_set_dist = config_->get_string("plugins/robot-memory/setup/replicated/replica-set-name");
+  repl_set_local = config_->get_string("plugins/robot-memory/setup/local/replica-set-name");
   if(distributed_)
   {
-    repl_set = config_->get_string("plugins/robot-memory/setup/replicated/replica-set-name");
     con_replica_ = new mongo::DBClientConnection();
     if(!con_replica_->connect("localhost:" + std::to_string(config_->get_uint("plugins/robot-memory/setup/replicated/port")), errmsg))
     {
@@ -79,7 +79,7 @@ void EventTriggerManager::check_events()
       logger_->log_debug(name.c_str(), "Tailable Cursor is dead, requerying");
       //check if collection is local or replicated
       mongo::DBClientConnection* con;
-      if(trigger->oplog_collection.find(repl_set) == 0)
+      if(trigger->oplog_collection.find(repl_set_dist) == 0)
       {
         con = con_replica_;
       }
diff --git a/src/plugins/robot-memory/event_trigger_manager.h b/src/plugins/robot-memory/event_trigger_manager.h
index 06362e8..a28f023 100644
--- a/src/plugins/robot-memory/event_trigger_manager.h
+++ b/src/plugins/robot-memory/event_trigger_manager.h
@@ -28,6 +28,7 @@
 #include <list>
 #include "event_trigger.h"
 #include <boost/bind.hpp>
+#include <plugin/loader.h>
 
 
 ///typedef for shorter type description
@@ -72,16 +73,10 @@ class EventTriggerManager
       mongo::DBClientConnection* con;
       std::string oplog;
       oplog = "local.oplog.rs";
-      if(collection.find(repl_set) == 0)
-      {
+      if(collection.find(repl_set_dist) == 0)
         con = con_replica_;
-        if(!distributed_)
-          logger_->log_error(name.c_str(), "Can not add trigger for %s, if the robot memory is not configured to be distributed", collection.c_str());
-      }
       else
-      {
         con = con_local_;
-      }
 
       EventTrigger *trigger = new EventTrigger(oplog_query, collection, boost::bind(callback, obj, _1));
       trigger->oplog_cursor = create_oplog_cursor(con, oplog, oplog_query);
@@ -103,7 +98,7 @@ class EventTriggerManager
     mongo::DBClientConnection* con_local_;
     mongo::DBClientConnection* con_replica_;
 
-    std::string repl_set, local_db;
+    std::string repl_set_dist, repl_set_local, local_db;
     bool distributed_;
 
     std::list<EventTrigger*> triggers;

- *commit* ac7cf879b77533cdc706afe79a17496a169c9694 - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Wed Nov 30 16:51:06 2016 +0100
Subject: pddl-robot-memory: added interface files

 ...veRobotMemoryInterface.h => PddlGenInterface.h} |   46 +++--
 .../interfaces/PddlGenInterface.cpp                |  235 ++++++++++++++++++++
 .../interfaces/PddlGenInterface.h_ext}             |   46 +++--
 .../interfaces/PddlGenInterface.tolua}             |   25 ++-
 4 files changed, 301 insertions(+), 51 deletions(-)





-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list