[Fawkes Git] branch/ggierse/eclipse-clp: created (0.5.0-3090-g06e8113)

Gesche Gierse gierse at kbsg.rwth-aachen.de
Fri Apr 1 13:50:19 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 created
        at  06e811351d8c1f412ac1bae9b1e9cf3ee0250263 (commit)

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

- *Log* ---------------------------------------------------------------
commit 9a0d0f4228ca5fe30f618a5a7d27f88bc80531b4
Merge: ed00e5d 01105a6
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Mar 4 11:36:19 2016 +0100
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Mar 4 11:36:19 2016 +0100

    Merge remote-tracking branch 'origin/fzwilling/gazsim-pantilt'
    
    Conflicts:
    	cfg/conf.d/gazsim.yaml
    	src/plugins/gazebo/Makefile

http://git.fawkesrobotics.org/fawkes.git/commit/9a0d0f4
http://trac.fawkesrobotics.org/changeset/9a0d0f4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit e79006e0474bc6836e08cf0ca2f2834869211347
Merge: 9a0d0f4 b227689
Author:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
AuthorDate: Fri Mar 4 11:36:42 2016 +0100
Commit:     Gesche Gierse <gierse at kbsg.rwth-aachen.de>
CommitDate: Fri Mar 4 11:36:42 2016 +0100

    Merge remote-tracking branch 'origin/fzwilling/align_at_table-transform'

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 2e0bcf02f6f0897cdff36dd0796ce190de871210
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:38:53 2016 +0200

    interfaces: add interface to send exit simulation msg

http://git.fawkesrobotics.org/fawkes.git/commit/2e0bcf0
http://trac.fawkesrobotics.org/changeset/2e0bcf0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit ea12e1702c45a77c6b5fc8ceef4311f32a2f15af
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:42:19 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/ea12e17
http://trac.fawkesrobotics.org/changeset/ea12e17

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit a18f9728a172d5c54442ade39b752ff62dc97f3a
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:45:28 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/a18f972
http://trac.fawkesrobotics.org/changeset/a18f972

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 06e811351d8c1f412ac1bae9b1e9cf3ee0250263
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:47:03 2016 +0200

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

http://git.fawkesrobotics.org/fawkes.git/commit/06e8113
http://trac.fawkesrobotics.org/changeset/06e8113

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


- *Summary* -----------------------------------------------------------
 cfg/conf.d/eclipse-clp.yaml                        |    5 +
 src/libs/interfaces/ExitSimulationInterface.cpp    |  193 ++++++++++++++++++++
 ...buggerInterface.h => ExitSimulationInterface.h} |   44 ++---
 ...terface.tolua => ExitSimulationInterface.tolua} |   20 ++-
 src/libs/interfaces/ExitSimulationInterface.xml    |   11 +
 src/lua/skills/generic/align_at_table.lua          |   18 ++-
 src/plugins/eclipse-clp/Makefile                   |    2 +-
 src/plugins/eclipse-clp/control_thread.cpp         |   52 ++++++
 src/plugins/eclipse-clp/control_thread.h           |    8 +
 .../eclipse-clp/externals/rcsoft_map_graph.cpp     |   11 +
 .../eclipse-clp/externals/rcsoft_map_graph.ecl     |    2 +
 .../eclipse-clp/externals/rcsoft_map_graph.h       |    1 +
 src/plugins/eclipse-clp/utils/skiller.ecl          |   15 ++
 13 files changed, 348 insertions(+), 34 deletions(-)
 create mode 100644 src/libs/interfaces/ExitSimulationInterface.cpp
 copy src/libs/interfaces/{EclipseDebuggerInterface.h => ExitSimulationInterface.h} (68%)
 copy src/libs/interfaces/{JointInterface.tolua => ExitSimulationInterface.tolua} (81%)
 create mode 100644 src/libs/interfaces/ExitSimulationInterface.xml


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

- *commit* 9a0d0f4228ca5fe30f618a5a7d27f88bc80531b4 - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Mar 4 11:36:19 2016 +0100
Subject: Merge remote-tracking branch 'origin/fzwilling/gazsim-pantilt'

 cfg/conf.d/gazsim.yaml                             |    8 +-
 src/plugins/Makefile                               |    2 +-
 src/plugins/gazebo/Makefile                        |    2 +-
 .../gazebo-plugin => gazsim-pantilt}/Makefile      |   36 +++---
 .../gazsim_pantilt_plugin.cpp}                     |   38 +++---
 .../gazsim-pantilt/gazsim_pantilt_thread.cpp       |  136 ++++++++++++++++++++
 .../gazsim_pantilt_thread.h}                       |   52 ++++----
 7 files changed, 212 insertions(+), 62 deletions(-)

_Diff for modified files_:
diff --cc cfg/conf.d/gazsim.yaml
index f9750c5,70a741b..263855a
--- a/cfg/conf.d/gazsim.yaml
+++ b/cfg/conf.d/gazsim.yaml
@@@ -74,10 -75,8 +75,15 @@@ gazsim
        update-rate: 5.0 #in Hz
        label-size: 0.3
        label-height: 0.9
 +
 +  depthcam:
 +    topic: "~/depthcam_sensor/depthcam-pcl/"
 +    width: 640
 +    height: 480
 +    frame: !frame kinect/depth
-     pointcloud-id: "openni-pointcloud-xyz"
++    pointcloud-id: "openni-pointcloud-xyz"
+       
+   pantilt:
+     if-name: "PanTilt RX28"
+     cfg-prefix: "/hardware/pantilt/ptus/RX28/"
 -    gazebo-joint-name: ""
++    gazebo-joint-name: ""
diff --cc src/plugins/gazebo/Makefile
index 76aab95,0521d5f..63accdd
--- a/src/plugins/gazebo/Makefile
+++ b/src/plugins/gazebo/Makefile
@@@ -24,7 -24,7 +24,7 @@@ PRESUBDIRS = aspect msg
  
  SUBDIRS = gazsim-robotino gazsim-laser gazsim-localization gazsim-comm \
  	  gazsim-vis-localization gazsim-webcam gazsim-timesource \
- 	  gazsim-depthcam
 -	  gazsim-pantilt
++	  gazsim-depthcam gazsim-pantilt
  
  LIBS_gazebo = fawkescore fawkesaspects fawkesgazeboaspect
  OBJS_gazebo = gazebo_plugin.o node_thread.o

- *commit* e79006e0474bc6836e08cf0ca2f2834869211347 - - - - - - - - - -
Author:  Gesche Gierse <gierse at kbsg.rwth-aachen.de>
Date:    Fri Mar 4 11:36:42 2016 +0100
Subject: Merge remote-tracking branch 'origin/fzwilling/align_at_table-transform'

 src/lua/skills/generic/align_at_table.lua |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

_Diff for modified files_:

- *commit* 2e0bcf02f6f0897cdff36dd0796ce190de871210 - - - - - - - - - -
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* ea12e1702c45a77c6b5fc8ceef4311f32a2f15af - - - - - - - - - -
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* a18f9728a172d5c54442ade39b752ff62dc97f3a - - - - - - - - - -
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* 06e811351d8c1f412ac1bae9b1e9cf3ee0250263 - - - - - - - - - -
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