[Fawkes Git] branch/ggierse/eclipse-clp: 4 revs updated. (0.5.0-3084-g84624cc)

Gesche Gierse gierse at kbsg.rwth-aachen.de
Fri Apr 1 14:02:52 CEST 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, ggierse/eclipse-clp has been updated
  discards  06e811351d8c1f412ac1bae9b1e9cf3ee0250263 (commit)
  discards  a18f9728a172d5c54442ade39b752ff62dc97f3a (commit)
  discards  ea12e1702c45a77c6b5fc8ceef4311f32a2f15af (commit)
  discards  2e0bcf02f6f0897cdff36dd0796ce190de871210 (commit)
  discards  e79006e0474bc6836e08cf0ca2f2834869211347 (commit)
  discards  9a0d0f4228ca5fe30f618a5a7d27f88bc80531b4 (commit)
  discards  b2276899d3eb8c41106ad2c052db011533eaa494 (commit)
  discards  ed00e5db94ec36fd5e2f046e649bca57c3cf4e3d (commit)
  discards  2f00cc914647b8dc9689ca44d2c52c23f4df4417 (commit)
  discards  01105a678453dbc06a3abe3ac1f0aea435edaebf (commit)
        to  84624cc0b6e08913c82ba1cec7de8a95735a1853 (commit)
       via  55691addff0e18e3ced729aa61d6d04afcc2e992 (commit)
       via  78b47a77fb36d470ae206cc8d78bfa8a52d7bc69 (commit)
       via  ec5de04f98c2c8f58023a317949f391c7397e34a (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (06e811351d8c1f412ac1bae9b1e9cf3ee0250263)
            \
             N -- N -- N (84624cc0b6e08913c82ba1cec7de8a95735a1853)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

http://git.fawkesrobotics.org/fawkes.git/ggierse/eclipse-clp

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 ec5de04f98c2c8f58023a317949f391c7397e34a
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Apr 1 13:38:53 2016 +0200
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Apr 1 13:57:04 2016 +0200

    interfaces: add interface to send exit simulation msg

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 78b47a77fb36d470ae206cc8d78bfa8a52d7bc69
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Apr 1 13:42:19 2016 +0200
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Apr 1 13:57:20 2016 +0200

    eclipse-clp: allow sending ExitSimulation msgs to control thread
    
    Enables an agent to send a message to that interface and
    thereby force shutdown of fawkes and the gazebo simulation.

http://git.fawkesrobotics.org/fawkes.git/commit/78b47a7
http://trac.fawkesrobotics.org/changeset/78b47a7

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 55691addff0e18e3ced729aa61d6d04afcc2e992
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Apr 1 13:45:28 2016 +0200
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Apr 1 13:57:31 2016 +0200

    eclipse_externals: add predicate to check if map is already loaded
    
    By this predicate an agent can check, if a a map is loaded.
    This is important if plugin is restarted. Then the map is
    already loaded internally. However, an agent that loads a
    map at startup had previously no way of knowing that.

http://git.fawkesrobotics.org/fawkes.git/commit/55691ad
http://trac.fawkesrobotics.org/changeset/55691ad

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 84624cc0b6e08913c82ba1cec7de8a95735a1853
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Apr 1 13:47:03 2016 +0200
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Apr 1 13:57:38 2016 +0200

    eclipse-clp: add skill execution which returns the message ID

http://git.fawkesrobotics.org/fawkes.git/commit/84624cc
http://trac.fawkesrobotics.org/changeset/84624cc

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


- *Summary* -----------------------------------------------------------
 cfg/conf.d/gazsim.yaml                             |   13 --
 src/lua/skills/generic/align_at_table.lua          |   18 +---
 src/plugins/Makefile                               |    2 +-
 src/plugins/gazebo/Makefile                        |    3 +-
 src/plugins/gazebo/gazsim-depthcam/Makefile        |   71 ----------
 .../gazsim-depthcam/gazsim_depthcam_plugin.cpp     |   48 -------
 .../gazsim-depthcam/gazsim_depthcam_thread.cpp     |  105 ---------------
 .../gazsim-depthcam/gazsim_depthcam_thread.h       |   80 ------------
 src/plugins/gazebo/gazsim-pantilt/Makefile         |   58 ---------
 .../gazsim-pantilt/gazsim_pantilt_plugin.cpp       |   47 -------
 .../gazsim-pantilt/gazsim_pantilt_thread.cpp       |  136 --------------------
 .../gazebo/gazsim-pantilt/gazsim_pantilt_thread.h  |   73 -----------
 12 files changed, 3 insertions(+), 651 deletions(-)
 delete mode 100644 src/plugins/gazebo/gazsim-depthcam/Makefile
 delete mode 100644 src/plugins/gazebo/gazsim-depthcam/gazsim_depthcam_plugin.cpp
 delete mode 100644 src/plugins/gazebo/gazsim-depthcam/gazsim_depthcam_thread.cpp
 delete mode 100644 src/plugins/gazebo/gazsim-depthcam/gazsim_depthcam_thread.h
 delete mode 100644 src/plugins/gazebo/gazsim-pantilt/Makefile
 delete mode 100644 src/plugins/gazebo/gazsim-pantilt/gazsim_pantilt_plugin.cpp
 delete mode 100644 src/plugins/gazebo/gazsim-pantilt/gazsim_pantilt_thread.cpp
 delete mode 100644 src/plugins/gazebo/gazsim-pantilt/gazsim_pantilt_thread.h


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

- *commit* ec5de04f98c2c8f58023a317949f391c7397e34a - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Apr 1 13:38:53 2016 +0200
Subject: interfaces: add interface to send exit simulation msg

 src/libs/interfaces/ExitSimulationInterface.cpp    |  193 ++++++++++++++++++++
 ...buggerInterface.h => ExitSimulationInterface.h} |   44 ++---
 ...terface.tolua => ExitSimulationInterface.tolua} |   20 ++-
 src/libs/interfaces/ExitSimulationInterface.xml    |   11 +
 4 files changed, 236 insertions(+), 32 deletions(-)


- *commit* 78b47a77fb36d470ae206cc8d78bfa8a52d7bc69 - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Apr 1 13:42:19 2016 +0200
Subject: eclipse-clp: allow sending ExitSimulation msgs to control thread

 cfg/conf.d/eclipse-clp.yaml                |    5 +++
 src/plugins/eclipse-clp/Makefile           |    2 +-
 src/plugins/eclipse-clp/control_thread.cpp |   52 ++++++++++++++++++++++++++++
 src/plugins/eclipse-clp/control_thread.h   |    8 ++++
 4 files changed, 66 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/cfg/conf.d/eclipse-clp.yaml b/cfg/conf.d/eclipse-clp.yaml
index 295e953..1bc2faf 100644
--- a/cfg/conf.d/eclipse-clp.yaml
+++ b/cfg/conf.d/eclipse-clp.yaml
@@ -15,6 +15,11 @@ eclipse-clp:
               "@FAWKESDIR@/src/eclipse-clp/externals/",
               "@BASEDIR@/src/agents/@AGENT@/"]
 
+  gazebo:
+    allow-shutdown: True
+    fawkes-path: "~/fawkes_clean/fawkes-athome/"
+    simulation-shutdown-script: "bin/gazsim.bash -x kill"
+
   elevator:
     use_graph: False
   skillexec:
diff --git a/src/plugins/eclipse-clp/Makefile b/src/plugins/eclipse-clp/Makefile
index ffcba5d..8bbf53d 100644
--- a/src/plugins/eclipse-clp/Makefile
+++ b/src/plugins/eclipse-clp/Makefile
@@ -28,7 +28,7 @@ HAVE_BOOST_LIBS = $(call boost-have-libs,$(REQ_BOOST_LIBS))
 
 LIBS_eclipse_clp = fawkescore fawkesinterface fawkesblackboard \
                      fawkesaspects fawkesutils eclipse TestInterface \
-                     EclipseDebuggerInterface
+                     EclipseDebuggerInterface ExitSimulationInterface
 OBJS_eclipse_clp = plugin.o control_thread.o eclipse_thread.o \
 		     externals/fawkes_logger.o       \
 		     externals/blackboard.o          \
diff --git a/src/plugins/eclipse-clp/control_thread.cpp b/src/plugins/eclipse-clp/control_thread.cpp
index 4b293e2..2e8b147 100644
--- a/src/plugins/eclipse-clp/control_thread.cpp
+++ b/src/plugins/eclipse-clp/control_thread.cpp
@@ -55,6 +55,40 @@ AgentControlThread::init()
   // open & register interfaces
   m_test_iface = blackboard->open_for_writing< TestInterface >("eclipse_clp_test");
   m_debug_iface = blackboard->open_for_reading< EclipseDebuggerInterface >("eclipse_clp_connect");
+
+  fawkes_path_ = "";
+  simulation_shutdown_script_ = "";
+  allow_shutdown_ = false;
+  try
+  {
+    logger->log_info(name(), "reading config /eclipse-clp/gazebo/allow-shutdown");
+    allow_shutdown_ =  config->get_bool( "/eclipse-clp/gazebo/allow-shutdown" );
+  }  catch (...) {}
+  try
+  {
+    logger->log_info(name(), "reading config fawkes-path");
+    fawkes_path_ = strdup( config->get_string( "/eclipse-clp/gazebo/fawkes-path" ).c_str() );
+  }  catch (...) 
+  {
+    logger->log_error(name(), "error reading config value: /eclipse-clp/gazebo/fawkes-path");
+    allow_shutdown_ = false;
+  }
+  try
+  {
+    logger->log_info(name(), "reading config simulation_shutdown_script_");
+    simulation_shutdown_script_ = strdup( config->get_string( "/eclipse-clp/gazebo/simulation-shutdown-script" ).c_str() );
+  }  catch (...)
+  {
+    logger->log_error(name(), "error reading config value: /eclipse-clp/gazebo/simulation-shutdown-script");
+    allow_shutdown_ = false;
+  }
+
+  logger->log_info(name(), "testing allow_shutdown_");
+  if (allow_shutdown_)
+  {
+    logger->log_info(name(), "opening ExitSimulationInterface");
+    m_exit_iface = blackboard->open_for_writing< ExitSimulationInterface >("eclipse_clp_exit");
+  }
 }
 
 bool
@@ -71,6 +105,9 @@ AgentControlThread::finalize()
   // close interfaces
   blackboard->close( m_test_iface );
   blackboard->close( m_debug_iface );
+  if (allow_shutdown_) {
+	blackboard->close( m_exit_iface );
+  }
 }
 
 void
@@ -97,6 +134,21 @@ AgentControlThread::loop()
   }
   m_test_iface->write();
 
+  // this is used to receive exit messages to quit fawkes and the simulation
+  if (allow_shutdown_) {
+    while ( !m_exit_iface->msgq_empty() )
+    {
+      if ( m_exit_iface->msgq_first_is< ExitSimulationInterface::ExitSimulationMessage >() )
+      {
+	  logger->log_info(name(), "shutting down: %s%s", fawkes_path_.c_str(), simulation_shutdown_script_.c_str());
+	  std::string command = fawkes_path_ + simulation_shutdown_script_;
+	  int schnurz = system(command.c_str());
+	  //just avoid warning that the return value of system() is ignored
+	  schnurz++;
+      }
+      m_exit_iface->msgq_pop();
+    }
+  }
 
   //m_eclipse_thread->post_event( "update" );
 
diff --git a/src/plugins/eclipse-clp/control_thread.h b/src/plugins/eclipse-clp/control_thread.h
index 6bd8e2f..bb5de52 100644
--- a/src/plugins/eclipse-clp/control_thread.h
+++ b/src/plugins/eclipse-clp/control_thread.h
@@ -26,8 +26,10 @@
 #include <core/threading/thread.h>
 #include <aspect/blocked_timing.h>
 #include <aspect/blackboard.h>
+#include <aspect/configurable.h>
 #include <aspect/logging.h>
 #include <interfaces/EclipseDebuggerInterface.h>
+#include <interfaces/ExitSimulationInterface.h>
 
 namespace fawkes {
   class TestInterface;
@@ -39,6 +41,7 @@ class AgentControlThread
 : public fawkes::Thread,
   public fawkes::BlockedTimingAspect,
   public fawkes::BlackBoardAspect,
+  public fawkes::ConfigurableAspect,
   public fawkes::LoggingAspect
 {
  public:
@@ -54,7 +57,12 @@ class AgentControlThread
   EclipseAgentThread* m_eclipse_thread;
 
   fawkes::TestInterface* m_test_iface;
+  fawkes::ExitSimulationInterface* m_exit_iface;
   fawkes::EclipseDebuggerInterface* m_debug_iface;
+  
+  bool 		allow_shutdown_;
+  std::string 	fawkes_path_;
+  std::string 	simulation_shutdown_script_;
 };
 
 #endif /* __PLUGINS_ECLIPSE_CLP_CONTROL_THREAD_H_ */

- *commit* 55691addff0e18e3ced729aa61d6d04afcc2e992 - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Apr 1 13:45:28 2016 +0200
Subject: eclipse_externals: add predicate to check if map is already loaded

 .../eclipse-clp/externals/rcsoft_map_graph.cpp     |   11 +++++++++++
 .../eclipse-clp/externals/rcsoft_map_graph.ecl     |    2 ++
 .../eclipse-clp/externals/rcsoft_map_graph.h       |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.cpp b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.cpp
index be84c57..8a5d6e8 100644
--- a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.cpp
+++ b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.cpp
@@ -122,6 +122,17 @@ p_map_graph_load()
 }
 
 int
+p_is_map_graph_loaded()
+{
+  if ( g_map_graph.loaded() )
+  {
+    return EC_succeed;
+  } else {
+    return EC_fail;
+  }
+}
+
+int
 p_map_graph_get_node_coords3()
 {
   if ( !g_map_graph.loaded() )
diff --git a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.ecl b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.ecl
index c52f026..7deccf3 100644
--- a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.ecl
+++ b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.ecl
@@ -23,6 +23,7 @@
 %% module definition
 :- module(rcsoft_map_graph).
 :- export map_graph_load/1.
+:- export is_map_graph_loaded/0.
 :- export map_graph_get_node_coords/3.
 :- export map_graph_get_node_coords/4.
 :- export map_graph_get_nodes/1.
@@ -32,6 +33,7 @@
 
 %% definition of external predicates
 :- external(map_graph_load/1, p_map_graph_load).
+:- external(is_map_graph_loaded/0, p_is_map_graph_loaded).
 :- external(map_graph_get_node_coords/3, p_map_graph_get_node_coords3).
 :- external(map_graph_get_node_coords/4, p_map_graph_get_node_coords4).
 :- external(map_graph_get_nodes/1, p_map_graph_get_nodes).
diff --git a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.h b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.h
index b6ac77e..1816919 100644
--- a/src/plugins/eclipse-clp/externals/rcsoft_map_graph.h
+++ b/src/plugins/eclipse-clp/externals/rcsoft_map_graph.h
@@ -24,6 +24,7 @@
 #define __ECLIPSE_EXTERNALS_RCSOFT_MAP_GRAPH_H
 
 extern "C" int p_map_graph_load();
+extern "C" int p_is_map_graph_loaded();
 extern "C" int p_map_graph_get_node_coords3();
 extern "C" int p_map_graph_get_node_coords4();
 extern "C" int p_map_graph_get_nodes();

- *commit* 84624cc0b6e08913c82ba1cec7de8a95735a1853 - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Apr 1 13:47:03 2016 +0200
Subject: eclipse-clp: add skill execution which returns the message ID

 src/plugins/eclipse-clp/utils/skiller.ecl |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/eclipse-clp/utils/skiller.ecl b/src/plugins/eclipse-clp/utils/skiller.ecl
index 8305222..6cb0966 100644
--- a/src/plugins/eclipse-clp/utils/skiller.ecl
+++ b/src/plugins/eclipse-clp/utils/skiller.ecl
@@ -27,11 +27,14 @@
 
 :- export(exec_skill/2).
 :- export(exec_skill2/1).
+:- export(exec_skill_id/3).
+:- export(exec_skill_id2/2).
 :- export(wait_for_skiller/0).
 :- export(decide_on_sensing/1).
 :- export(is_final/1).
 :- export(is_failed/1).
 :- export(is_running/1).
+:- export(not_running/1).
 
 
 :- log_info("Loading skiller tools done").
@@ -90,3 +93,15 @@ exec_skill2(Skillmsg) :-
     wait_until_processed(MsgID),
     log_info("Sent Skiller Message").
 
+% returns MsgID of the skill execution
+exec_skill_id(Skill, Arguments, MsgID) :-
+    append_strings(Skill, "{", Str1),
+    append_strings(Str1, Arguments, Str2),
+    append_strings(Str2, "}", Skillmsg),
+    bb_send_message("SkillerInterface::Skiller", "ExecSkillMessage", [["skill_string", Skillmsg]], MsgID),
+    wait_until_processed(MsgID).
+
+exec_skill_id2(Skillmsg, MsgID) :-
+    bb_send_message("SkillerInterface::Skiller", "ExecSkillMessage", [["skill_string", Skillmsg]], MsgID),
+    wait_until_processed(MsgID).
+




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


More information about the fawkes-commits mailing list