commit 4bd3e8527617dfaf7a39c70f6cc60d58e501905f
Author: Simon Schulz <sschulz@cit-ec.uni-bielefeld.de>
Date:   Wed Jan 6 12:50:32 2016 +0100

    ported to new rst

diff --git a/client/cpp/hlrc_clientConfigVersion.cmake.in b/client/cpp/hlrc_clientConfigVersion.cmake.in
index 0ec5ec2..46df9a3 100644
--- a/client/cpp/hlrc_clientConfigVersion.cmake.in
+++ b/client/cpp/hlrc_clientConfigVersion.cmake.in
@@ -1,11 +1,11 @@
-set(PACKAGE_VERSION "@HLRC_CLIENT_VERSION@")
- 
-# Check whether the requested PACKAGE_FIND_VERSION is compatible
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
-  set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
-  set(PACKAGE_VERSION_COMPATIBLE TRUE)
-  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
-    set(PACKAGE_VERSION_EXACT TRUE)
-  endif()
-endif()
+    set(PACKAGE_VERSION "@HLRC_CLIENT_VERSION@")
+
+    # Check whether the requested PACKAGE_FIND_VERSION is compatible
+    if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+      set(PACKAGE_VERSION_COMPATIBLE FALSE)
+    else()
+      set(PACKAGE_VERSION_COMPATIBLE TRUE)
+      if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+        set(PACKAGE_VERSION_EXACT TRUE)
+      endif()
+    endif()
diff --git a/client/cpp/src/MiddlewareROS.cpp b/client/cpp/src/MiddlewareROS.cpp
index 7775bcc..8af1fa5 100644
--- a/client/cpp/src/MiddlewareROS.cpp
+++ b/client/cpp/src/MiddlewareROS.cpp
@@ -25,7 +25,6 @@
 * Excellence Initiative.
 *
 */
-
 #ifdef ROS_SUPPORT
 
 #include "MiddlewareROS.h"
@@ -263,3 +262,4 @@ void MiddlewareROS::publish_speech(string text, bool blocking){
 }
 
 #endif
+
diff --git a/client/cpp/src/RobotController.cpp b/client/cpp/src/RobotController.cpp
index 5c0c958..fa60d35 100644
--- a/client/cpp/src/RobotController.cpp
+++ b/client/cpp/src/RobotController.cpp
@@ -28,19 +28,21 @@
 
 #include "RobotController.h"
 #include "Middleware.h"
-#include "MiddlewareRSB.h"
 #include "MiddlewareROS.h"
+#include "MiddlewareRSB.h"
+
 using namespace std;
 
 RobotController::RobotController(string mw_name, string base_scope){
-    if (mw_name == "ROS"){
-        //intantiate ROS mw
-        middleware = new MiddlewareROS(base_scope);
-    }else if (mw_name == "RSB"){
-        //intantiate RSB mw
-        middleware = new MiddlewareRSB(base_scope);
+
+     if (mw_name == "ROS"){
+         //intantiate ROS mw
+         middleware = new MiddlewareROS(base_scope);
+     }else if (mw_name == "RSB"){
+         //intantiate RSB mw
+         middleware = new MiddlewareRSB(base_scope);
     }else{
-        printf("ERROR: invalid middleware requested (%s). supported: {ROS, RSB}\n\n", mw_name.c_str());
+         printf("ERROR: invalid middleware requested (%s). supported: {ROS, RSB}\n\n", mw_name.c_str());
         exit(EXIT_FAILURE);
     }
 }
diff --git a/client/python/tools/dump_relative_gazetargets.py b/client/python/tools/dump_relative_gazetargets.py
index 6b6b24a..b8fce35 100644
--- a/client/python/tools/dump_relative_gazetargets.py
+++ b/client/python/tools/dump_relative_gazetargets.py
@@ -11,18 +11,22 @@ import array
 small code snippet to dump humotion relative gaze targets
 combined with the current gaze direction from tf
 """
-USE_MEKA_TOPICS=False
+USE_MEKA_TOPICS=True
 
-humotion_gaze_topic = "/flobi/humotion/gaze/target"
-tf_topic_base   = "BASE_LINK"
-tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
-tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
 
 #joint targets
 if USE_MEKA_TOPICS:
+    humotion_gaze_topic = "/flobi/humotion/gaze/target"
+    tf_topic_base   = "BASE_LINK"
+    tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
+    tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
     from trajectory.msg import *
     topic_joint_target = "/meka_roscontrol/head_position_trajectory_controller/command"
 else:
+    humotion_gaze_topic = "/flobi/humotion/gaze/target"
+    tf_topic_base   = "BASE_LINK"
+    tf_topic_gaze_l = "EYES_LEFT_UD_VIRTUAL_LINK"
+    tf_topic_gaze_r = "EYES_RIGHT_UD_VIRTUAL_LINK"
     from xsc3_server.msg import *
     topic_joint_target = "/xsc3/custom_joint_state"
 
diff --git a/server/include/RSB/AnimationCallbackWrapper.h b/server/include/RSB/AnimationCallbackWrapper.h
index 50bfeff..588d5ea 100644
--- a/server/include/RSB/AnimationCallbackWrapper.h
+++ b/server/include/RSB/AnimationCallbackWrapper.h
@@ -31,35 +31,37 @@
 #include "Animation.h"
 
 //callback handler incoming animation requests:
-class AnimationCallbackWrapper : public CallbackWrapper<rst::robot::Animation>{
+class AnimationCallbackWrapper : public CallbackWrapper<rst::animation::HeadAnimation>{
     public:
        AnimationCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
 
-       void call(const std::string& method_name, boost::shared_ptr<rst::robot::Animation> input){
+       void call(const std::string& method_name, boost::shared_ptr<rst::animation::HeadAnimation> input){
            printf("> incomint animation (method = %s)\n",method_name.c_str());
 
            //fetch animation passed by rsb:
-           rst::robot::Animation *rst_ani = input.get();
+           rst::animation::HeadAnimation *rst_ani = input.get();
            boost::shared_ptr<Animation> ani(new Animation());
 
-           switch ((int) rst_ani->target()){
-               case(rst_ani->IDLE):         ani->target = Animation::IDLE; break;
-               case(rst_ani->HEAD_NOD):     ani->target = Animation::HEAD_NOD; break;
-               case(rst_ani->HEAD_SHAKE):   ani->target = Animation::HEAD_SHAKE; break;
-               case(rst_ani->EYEBLINK_L):   ani->target = Animation::EYEBLINK_L; break;
-               case(rst_ani->EYEBLINK_R):   ani->target = Animation::EYEBLINK_R; break;
-               case(rst_ani->EYEBLINK_BOTH):ani->target = Animation::EYEBLINK_BOTH; break;
-               case(rst_ani->EYEBROWS_RAISE):ani->target = Animation::EYEBROWS_RAISE;break;
-               case(rst_ani->EYEBROWS_LOWER):ani->target = Animation::EYEBROWS_LOWER;break;
+           switch ((int) rst_ani->animation()){
+               case(rst_ani->IDLE):             ani->target = Animation::IDLE; break;
+               case(rst_ani->HEAD_NOD):         ani->target = Animation::HEAD_NOD; break;
+               case(rst_ani->HEAD_SHAKE):       ani->target = Animation::HEAD_SHAKE; break;
+               case(rst_ani->EYEBLINK_LEFT):    ani->target = Animation::EYEBLINK_L; break;
+               case(rst_ani->EYEBLINK_RIGHT):   ani->target = Animation::EYEBLINK_R; break;
+               case(rst_ani->EYEBLINK_BOTH):    ani->target = Animation::EYEBLINK_BOTH; break;
+               case(rst_ani->EYEBROWS_RAISE):   ani->target = Animation::EYEBROWS_RAISE;break;
+               case(rst_ani->EYEBROWS_LOWER):   ani->target = Animation::EYEBROWS_LOWER;break;
+               case(rst_ani->ENGAGEMENT_LEFT):  ani->target = Animation::ENGAGEMENT_LEFT;break;
+               case(rst_ani->ENGAGEMENT_RIGHT): ani->target = Animation::ENGAGEMENT_RIGHT;break;
                default:
                    ani->target = Animation::IDLE;
-                   printf("> unhandled animatin target %d\n",(int)rst_ani->target());
+                   printf("> unhandled animatin target %d\n",(int)rst_ani->animation());
                    throw std::runtime_error("AnimationCallback: invalid animation id");
                    return;
            }
            ani->repetitions   = rst_ani->repetitions();
            ani->duration_each = rst_ani->duration_each();
-           ani->scale         = rst_ani->scale();
+           ani->scale         = rst_ani->emphasis_scale();
 
            printf("> new Animation: %s\n", ani->as_string().c_str());
 
diff --git a/server/include/RSB/CallbackWrapper.h b/server/include/RSB/CallbackWrapper.h
index 5ce7424..fd8b9e3 100644
--- a/server/include/RSB/CallbackWrapper.h
+++ b/server/include/RSB/CallbackWrapper.h
@@ -28,10 +28,10 @@
 
 #pragma once
 #include "Middleware.h"
-#include <rst/robot/EmotionState.pb.h>
-#include <rst/robot/GazeTarget.pb.h>
-#include <rst/robot/MouthTarget.pb.h>
-#include <rst/robot/Animation.pb.h>
+//#include <rst/robot/MouthTarget.pb.h>
+#include <rst/animation/EmotionExpression.pb.h>
+#include <rst/animation/BinocularHeadGaze.pb.h>
+#include <rst/animation/HeadAnimation.pb.h>
 #include <rst/audition/Utterance.pb.h>
 #include <rst/audition/SoundChunk.pb.h>
 #include <rsb/Factory.h>
diff --git a/server/include/RSB/EmotionCallbackWrapper.h b/server/include/RSB/EmotionCallbackWrapper.h
index 3e4319e..5fc6c70 100644
--- a/server/include/RSB/EmotionCallbackWrapper.h
+++ b/server/include/RSB/EmotionCallbackWrapper.h
@@ -30,26 +30,26 @@
 #include "CallbackWrapper.h"
 
 //callback handler incoming emotion requests:
-class EmotionCallbackWrapper : public CallbackWrapper<rst::robot::EmotionState>{
+class EmotionCallbackWrapper : public CallbackWrapper<rst::animation::EmotionExpression>{
     public:
        EmotionCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
 
-       void call(const std::string& method_name, boost::shared_ptr<rst::robot::EmotionState> input){
-           printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->value());
+       void call(const std::string& method_name, boost::shared_ptr<rst::animation::EmotionExpression> input){
+           printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->emotion());
 
            EmotionState emotion_state;
-           rst::robot::EmotionState *emotion = input.get();
+           rst::animation::EmotionExpression *emotion = input.get();
 
            //extract data & copy it to our datatype (might be good when we allow multiple middlewares in the feature)
-           switch ((int)emotion->value()){
-               case(rst::robot::EmotionState_EmotionType_NEUTRAL):   emotion_state.value = EmotionConfig::NEUTRAL; break;
-               case(rst::robot::EmotionState_EmotionType_HAPPY):     emotion_state.value = EmotionConfig::HAPPY; break;
-               case(rst::robot::EmotionState_EmotionType_SAD):       emotion_state.value = EmotionConfig::SAD; break;
-               case(rst::robot::EmotionState_EmotionType_ANGRY):     emotion_state.value = EmotionConfig::ANGRY; break;
-               case(rst::robot::EmotionState_EmotionType_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
-               case(rst::robot::EmotionState_EmotionType_FEAR):      emotion_state.value = EmotionConfig::FEAR; break;
+           switch ((int)emotion->emotion()){
+               case(rst::animation::EmotionExpression_Emotion_NEUTRAL):   emotion_state.value = EmotionConfig::NEUTRAL; break;
+               case(rst::animation::EmotionExpression_Emotion_HAPPY):     emotion_state.value = EmotionConfig::HAPPY; break;
+               case(rst::animation::EmotionExpression_Emotion_SAD):       emotion_state.value = EmotionConfig::SAD; break;
+               case(rst::animation::EmotionExpression_Emotion_ANGRY):     emotion_state.value = EmotionConfig::ANGRY; break;
+               case(rst::animation::EmotionExpression_Emotion_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
+               case(rst::animation::EmotionExpression_Emotion_FEAR):      emotion_state.value = EmotionConfig::FEAR; break;
                default:
-               printf("> invalid EmotionState value. exiting\n"); exit(EXIT_FAILURE);
+               printf("> invalid EmotionExpression emotion value. exiting\n"); exit(EXIT_FAILURE);
            }
 
            emotion_state.duration = emotion->duration();
diff --git a/server/include/RSB/GazeCallbackWrapper.h b/server/include/RSB/GazeCallbackWrapper.h
index 5ae5d6b..7c9dd10 100644
--- a/server/include/RSB/GazeCallbackWrapper.h
+++ b/server/include/RSB/GazeCallbackWrapper.h
@@ -30,28 +30,31 @@
 #include "CallbackWrapper.h"
 
 //callback handler incoming gaze requests:
-class GazeCallbackWrapper : public CallbackWrapper<rst::robot::GazeTarget>{
+class GazeCallbackWrapper : public CallbackWrapper<rst::animation::BinocularHeadGaze>{
     public:
         GazeCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){}
-        void call(const std::string& method_name, boost::shared_ptr<rst::robot::GazeTarget> input){
-            rst::robot::GazeTarget *gaze = input.get();
+        void call(const std::string& method_name, boost::shared_ptr<rst::animation::BinocularHeadGaze> input){
+            rst::animation::BinocularHeadGaze *gaze = input.get();
             //printf("> incoming gaze (p=%3.1f t=%3.1f r=%3.1f / v=%3.1f)\n", gaze->pan(), gaze->tilt(), gaze->roll(), gaze->vergence());
 
             humotion::GazeState gaze_state;
 
             //fill in gaze
-            gaze_state.pan   = gaze->pan();
-            gaze_state.tilt  = gaze->tilt();
-            gaze_state.roll  = gaze->roll();
+            gaze_state.pan   = gaze->target().azimuth();
+            gaze_state.tilt  = gaze->target().elevation();
+            gaze_state.roll  = 0.0;
+
             //RSB supports only absolute targets for now...
             gaze_state.timestamp = 123.45; //FIXME!!
-            gaze_state.type  = humotion::GazeState::ABSOLUTE;
+            gaze_state.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE;
+
             //vergence
-            gaze_state.vergence  = (gaze->has_vergence())?gaze->vergence():0.0;
+            gaze_state.vergence  = (gaze->has_eye_vergence())?gaze->eye_vergence():0.0;
+
             //offsets
-            gaze_state.pan_offset  = (gaze->has_pan_offset())?gaze->pan_offset():0.0;
-            gaze_state.tilt_offset = (gaze->has_tilt_offset())?gaze->tilt_offset():0.0;
-            
+            gaze_state.pan_offset  = (gaze->has_offset())?gaze->offset().azimuth():0.0;
+            gaze_state.tilt_offset = (gaze->has_offset())?gaze->offset().elevation():0.0;
+
             //send to application:
             mw->gaze_callback(gaze_state);
         }
diff --git a/server/include/RSB/MouthCallbackWrapper.h b/server/include/RSB/MouthCallbackWrapper.h
index 766e050..47f69c1 100644
--- a/server/include/RSB/MouthCallbackWrapper.h
+++ b/server/include/RSB/MouthCallbackWrapper.h
@@ -28,7 +28,8 @@
 
 #pragma once
 #include "CallbackWrapper.h"
-
+#if 0
+DISABLED MOUTH TARGET IN RSB FOR NOW
 //callback handler incoming gaze requests:
 class MouthCallbackWrapper : public CallbackWrapper<rst::robot::MouthTarget>{
     public:
@@ -51,3 +52,4 @@ class MouthCallbackWrapper : public CallbackWrapper<rst::robot::MouthTarget>{
             mw->mouth_callback(mouth_state);
         }
 };
+#endif
diff --git a/server/include/RSB/UtteranceCallbackWrapper.h b/server/include/RSB/UtteranceCallbackWrapper.h
index a86a5b4..4d04734 100644
--- a/server/include/RSB/UtteranceCallbackWrapper.h
+++ b/server/include/RSB/UtteranceCallbackWrapper.h
@@ -37,7 +37,7 @@ class UtteranceCallbackWrapper : public CallbackWrapper<rst::audition::Utterance
         void call(const std::string&, boost::shared_ptr<rst::audition::Utterance> param){
             //convert rsb utterance to out own:
             rst::audition::Utterance *rst_utterance = param.get();
-            printf("> incoming utterance '%s' (%d phone symbols)\n", param->text().c_str(), (int)rst_utterance->phonemes().size());
+            printf("> incoming utterance '%s' (%d phone symbols)\n", param->textual_representation().c_str(), (int)rst_utterance->phonemes().element().size());
 
             boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*rst_utterance));
 
diff --git a/server/include/RSB/UtteranceRSB.h b/server/include/RSB/UtteranceRSB.h
index 2b36b25..145dece 100644
--- a/server/include/RSB/UtteranceRSB.h
+++ b/server/include/RSB/UtteranceRSB.h
@@ -37,7 +37,7 @@ class UtteranceRSB : public Utterance {
     public:
         UtteranceRSB(rst::audition::Utterance rst_utterance){
             //set text:
-            set_text(rst_utterance.text());
+            set_text(rst_utterance.textual_representation());
 
             //convert soundchunk to audio data:
             extract_audio_data(rst_utterance.audio());
@@ -100,8 +100,8 @@ class UtteranceRSB : public Utterance {
     void extract_phonemes(rst::audition::Utterance rst_utterance){
         //extract phoneme vector
         phonemes_vector.clear();
-        for(int i=0; i<rst_utterance.phonemes().size(); i++){
-            rst::audition::Phoneme rst_phoneme = rst_utterance.phonemes().Get(i);
+        for(int i=0; i<rst_utterance.phonemes().element().size(); i++){
+            rst::audition::Phoneme rst_phoneme = rst_utterance.phonemes().element().Get(i);
             Utterance::symbol_duration_pair_t phoneme = make_pair(rst_phoneme.symbol(), rst_phoneme.duration());
             phonemes_vector.push_back(phoneme);
         }
diff --git a/server/src/MiddlewareRSB.cpp b/server/src/MiddlewareRSB.cpp
index 40416ba..a21a65e 100644
--- a/server/src/MiddlewareRSB.cpp
+++ b/server/src/MiddlewareRSB.cpp
@@ -45,9 +45,6 @@ using namespace std;
 using namespace rsb;
 using namespace rsb::patterns;
 
-WARNING: RSB interface might be deprtecated and needs some backporting
-from the ROS code. [todo]
-
 
 MiddlewareRSB::MiddlewareRSB(Arbiter *arbiter, std::string scope) : Middleware(arbiter, scope){
     init();
@@ -65,7 +62,7 @@ void MiddlewareRSB::init(){
     printf("> registering converters\n");
 
     //converter for EmotionState
-    rsb::converter::Converter<string>::Ptr emotionStateConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::EmotionState>());
+    rsb::converter::Converter<string>::Ptr emotionStateConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::EmotionExpression>());
     rsb::converter::converterRepository<string>()->registerConverter(emotionStateConverter);
 
     //converter for SoundChunk
@@ -77,15 +74,15 @@ void MiddlewareRSB::init(){
     rsb::converter::converterRepository<string>()->registerConverter(UtteranceConverter);
 
     //converter for GazeTarget
-    rsb::converter::Converter<string>::Ptr gazeTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::GazeTarget>());
+    rsb::converter::Converter<string>::Ptr gazeTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::BinocularHeadGaze>());
     rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
 
     //converter for MouthTarget
-    rsb::converter::Converter<string>::Ptr mouthTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
-    rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
+    //rsb::converter::Converter<string>::Ptr mouthTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
+    //rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
 
     //converter for Animation
-    rsb::converter::Converter<string>::Ptr animationConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::Animation>());
+    rsb::converter::Converter<string>::Ptr animationConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::HeadAnimation>());
     rsb::converter::converterRepository<string>()->registerConverter(animationConverter);
 
     //first get a factory instance that is used to create RSB domain objects
@@ -132,7 +129,7 @@ void MiddlewareRSB::init_callbacks(){
     init_callback("speech",    LocalServer::CallbackPtr(new SpeechCallbackWrapper(this)));
     init_callback("utterance", LocalServer::CallbackPtr(new UtteranceCallbackWrapper(this)));
     init_callback("gaze",      LocalServer::CallbackPtr(new GazeCallbackWrapper(this)));
-    init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
+    ///init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
 
     EmotionCallbackWrapper *emotion_cb = new EmotionCallbackWrapper(this);
     init_callback("defaultEmotion", LocalServer::CallbackPtr(emotion_cb));
