commit 78cc756c7a2d367c0c8fdce943c624cc117054ac
Author: Simon Schulz <sschulz@cit-ec.uni-bielefeld.de>
Date:   Fri Jan 15 11:03:40 2016 +0100

    towards a working port

diff --git a/client/python/hlrc_client/MiddlewareRSB.py b/client/python/hlrc_client/MiddlewareRSB.py
index 65c203c..c9c01e2 100644
--- a/client/python/hlrc_client/MiddlewareRSB.py
+++ b/client/python/hlrc_client/MiddlewareRSB.py
@@ -32,11 +32,10 @@ import rsb
 import rsb.converter
 import rst
 
-#This is untested for now (flier), RST has been refactored during "GGB", so these are the new types (names and packages)
-from rstsandbox.animation.EmotionExpression_pb2 import EmotionExpression as EmotionState
-from rstsandbox.animation.HeadAnimation_pb2 import HeadAnimation as Animation
-from rstsandbox.robot.HumotionGazeTarget_pb2 import HumotionGazeTarget as GazeTarget
-from rstsandbox.robot.MouthTarget_pb2 import MouthTarget
+from rstsandbox.animation.EmotionExpression_pb2 import EmotionExpression
+from rstsandbox.animation.HeadAnimation_pb2 import HeadAnimation
+from rstsandbox.animation.BinocularHeadGaze_pb2 import BinocularHeadGaze
+from rstsandbox.geometry.SphericalDirectionFloat_pb2 import SphericalDirectionFloat
 
 
 class MiddlewareRSB(Middleware):
@@ -65,17 +64,14 @@ class MiddlewareRSB(Middleware):
         #initialise RSB stuff
         self.logger.info("initialising RSB middleware connection on scope %s, registering rst converters..." % (self.base_scope))
 
-        self.emotionstate_converter = rsb.converter.ProtocolBufferConverter(messageClass = EmotionState)
-        rsb.converter.registerGlobalConverter(self.emotionstate_converter)
+        self.EmotionExpression_converter = rsb.converter.ProtocolBufferConverter(messageClass = EmotionExpression)
+        rsb.converter.registerGlobalConverter(self.EmotionExpression_converter)
 
-        self.animation_converter = rsb.converter.ProtocolBufferConverter(messageClass = Animation)
-        rsb.converter.registerGlobalConverter(self.animation_converter)
+        self.HeadAnimation_converter = rsb.converter.ProtocolBufferConverter(messageClass = HeadAnimation)
+        rsb.converter.registerGlobalConverter(self.HeadAnimation_converter)
 
-        self.gaze_converter = rsb.converter.ProtocolBufferConverter(messageClass = GazeTarget)
-        rsb.converter.registerGlobalConverter(self.gaze_converter)
-
-        self.mouth_converter = rsb.converter.ProtocolBufferConverter(messageClass = MouthTarget)
-        rsb.converter.registerGlobalConverter(self.mouth_converter)
+        self.BinocularHeadGaze_converter = rsb.converter.ProtocolBufferConverter(messageClass = BinocularHeadGaze)
+        rsb.converter.registerGlobalConverter(self.BinocularHeadGaze_converter)
 
         try:
             self.server = rsb.createRemoteServer(self.base_scope + '/set')
@@ -93,7 +89,7 @@ class MiddlewareRSB(Middleware):
         """
 
         #create emotion & fill it with values:
-        rsb_em = EmotionState()
+        rsb_em = EmotionExpression()
 
         #set value
         rsb_em.value = self.convert_emotiontype_to_rsbval(emotion.value)
@@ -106,14 +102,14 @@ class MiddlewareRSB(Middleware):
 
             if (blocking):
                 #blocking rpc call:
-                if (em_type == RobotEmotion.TYPE_DEFAULT):
+                if (em_type == EmotionExpression.TYPE_DEFAULT):
                     result = server.defaultEmotion(rsb_em)
                 else:
                     result = server.currentEmotion(rsb_em)
 
                 self.logger.debug("server reply: '%s'" % result)
             else:
-                if (em_type == RobotEmotion.TYPE_DEFAULT):
+                if (em_type == EmotionExpression.TYPE_DEFAULT):
                     future = server.defaultEmotion.async(rsb_em)
                 else:
                     future = server.currentEmotion.async(rsb_em)
@@ -122,33 +118,33 @@ class MiddlewareRSB(Middleware):
                 #print '> server reply: "%s"' % future.get(timeout = 10);
             self.logger.debug("emotion rpc done")
 
-    def publish_head_animation(self, animation, blocking):
-        """publish an head animation via mw
-        :param animation: animation to set
+    def publish_head_HeadAnimation(self, HeadAnimation, blocking):
+        """publish an head HeadAnimation via mw
+        :param HeadAnimation: HeadAnimation to set
         :param blocking: True if this call should block until execution finished on robot
         """
 
-        self.logger.debug("calling the animation rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING"))
+        self.logger.debug("calling the HeadAnimation rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING"))
 
-        #create animation & fill it with values:
-        rsb_ani = Animation()
+        #create HeadAnimation & fill it with values:
+        rsb_ani = HeadAnimation()
 
         #select ani
-        rsb_ani.target = self.convert_animationtype_to_rsbval(animation.value)
-        rsb_ani.repetitions = animation.repetitions
-        rsb_ani.duration_each = animation.time_ms
-        rsb_ani.scale       = animation.scale
+        rsb_ani.target = self.convert_HeadAnimationtype_to_rsbval(HeadAnimation.value)
+        rsb_ani.repetitions = HeadAnimation.repetitions
+        rsb_ani.duration_each = HeadAnimation.time_ms
+        rsb_ani.scale       = HeadAnimation.scale
 
         if (blocking):
             #blocking:
-            result = self.server.animation(rsb_ani)
+            result = self.server.HeadAnimation(rsb_ani)
             self.logger.debug("server reply: '%s'" % result)
         else:
-            future = self.server.animation.async(rsb_ani)
+            future = self.server.HeadAnimation.async(rsb_ani)
             #we can block here for a incoming result with a timeout in s
             #print '> server reply: "%s"' % future.get(timeout = 10);
 
-        self.logger.debug("animation rpc done")
+        self.logger.debug("HeadAnimation rpc done")
 
     def publish_default_emotion(self, emotion, blocking):
         self.publish_emotion(RobotEmotion.TYPE_DEFAULT, emotion, blocking)
@@ -164,15 +160,19 @@ class MiddlewareRSB(Middleware):
         self.logger.debug("calling the gaze rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING"))
 
         #create gaze target & fill it with values:
-        rsb_gaze = GazeTarget()
+        rsb_gaze = BinocularHeadGaze()
 
         #fill proto
-        rsb_gaze.pan  = gaze.pan
-        rsb_gaze.tilt = gaze.tilt
-        rsb_gaze.roll = gaze.roll
+	rsb_gaze.target = SphericalDirectionFloat()
+	rsb_gaze.target.elevation = gaze.tilt
+	rsb_gaze.target.azimuth   = gaze.pan
+
         rsb_gaze.vergence = gaze.vergence
-        rsb_gaze.pan_offset  = gaze.pan_offset
-        rsb_gaze.tilt_offset = gaze.tilt_offset
+
+	
+	rsb_gaze.offset = SphericalDirectionFloat()
+	rsb_gaze.offset.elevation = gaze.tilt_offset
+	rsb_gaze.offset.azimuth   = gaze.pan_offset
 
         if (blocking):
             #blocking:
@@ -185,11 +185,12 @@ class MiddlewareRSB(Middleware):
 
         self.logger.debug("gaze rpc done")
 
+"""
     def publish_mouth_target(self, mouth, blocking):
-        """publish a mouth target via mw
+        publish a mouth target via mw
         :param mouth: mouth value to set
         :param blocking: True if this call should block until execution finished on robot
-        """
+        
         self.logger.debug("calling the mouth rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING"))
 
         #create mouth state & fill it with values:
@@ -213,6 +214,7 @@ class MiddlewareRSB(Middleware):
             #print '> server reply: "%s"' % future.get(timeout = 10);
 
         self.logger.debug("mouth rpc done")
+"""
 
     def publish_speech(self, text, blocking):
         """publish a tts request via mw
@@ -237,52 +239,52 @@ class MiddlewareRSB(Middleware):
 
     #######################################################################
     # some helpers
-    def convert_animationtype_to_rsbval(self, value):
-        """convert RobotAnimation.value to RSB animation value
-        :param value: RobotAnimation.* id to convert to rsb id
+    def convert_HeadAnimationtype_to_rsbval(self, value):
+        """convert RobotHeadAnimation.value to RSB HeadAnimation value
+        :param value: RobotHeadAnimation.* id to convert to rsb id
         """
         #NOTE: this convertion is important as the actual integer values of
         #      thy python api and the protobuf might be different
 
-        if (value == RobotAnimation.IDLE):
-            return Animation().IDLE
-        elif (value == RobotAnimation.HEAD_NOD):
-            return Animation().HEAD_NOD
-        elif (value == RobotAnimation.HEAD_SHAKE):
-            return Animation().HEAD_SHAKE
-        elif (value == RobotAnimation.EYEBLINK_L):
-            return Animation().EYEBLINK_L
-        elif (value == RobotAnimation.EYEBLINK_R):
-            return  Animation().EYEBLINK_R
-        elif (value == RobotAnimation.EYEBLINK_BOTH):
-            return  Animation().EYEBLINK_BOTH
-        elif (value == RobotAnimation.EYEBROWS_RAISE):
-            return  Animation().EYEBROWS_RAISE
-        elif (value == RobotAnimation.EYEBROWS_LOWER):
-            return  Animation().EYEBROWS_LOWER
+        if (value == RobotHeadAnimation.IDLE):
+            return HeadAnimation().IDLE
+        elif (value == RobotHeadAnimation.HEAD_NOD):
+            return HeadAnimation().HEAD_NOD
+        elif (value == RobotHeadAnimation.HEAD_SHAKE):
+            return HeadAnimation().HEAD_SHAKE
+        elif (value == RobotHeadAnimation.EYEBLINK_L):
+            return HeadAnimation().EYEBLINK_L
+        elif (value == RobotHeadAnimation.EYEBLINK_R):
+            return  HeadAnimation().EYEBLINK_R
+        elif (value == RobotHeadAnimation.EYEBLINK_BOTH):
+            return  HeadAnimation().EYEBLINK_BOTH
+        elif (value == RobotHeadAnimation.EYEBROWS_RAISE):
+            return  HeadAnimation().EYEBROWS_RAISE
+        elif (value == RobotHeadAnimation.EYEBROWS_LOWER):
+            return  HeadAnimation().EYEBROWS_LOWER
         else:
-            self.logger.error("invalid animation type %d\n" % (value))
-            return  Animation().NEUTRAL
+            self.logger.error("invalid HeadAnimation type %d\n" % (value))
+            return  HeadAnimation().NEUTRAL
 
     def convert_emotiontype_to_rsbval(self, value):
-        """convert RobotEmotion.value to RSB animation value
+        """convert RobotEmotion.value to RSB HeadAnimation value
         :param value: RobotEmotion.* id to convert to rsb id
         """
         #NOTE: this convertion is important as the actual integer values of
         #      thy python api and the protobuf might be different
 
         if (value == RobotEmotion.NEUTRAL):
-            return EmotionState().NEUTRAL
+            return EmotionExpression().NEUTRAL
         elif (value == RobotEmotion.HAPPY):
-            return EmotionState().HAPPY
+            return EmotionExpression().HAPPY
         elif (value == RobotEmotion.SAD):
-            return EmotionState().SAD
+            return EmotionExpression().SAD
         elif (value == RobotEmotion.ANGRY):
-            return EmotionState().ANGRY
+            return EmotionExpression().ANGRY
         elif (value == RobotEmotion.SURPRISED):
-            return  EmotionState().SURPRISED
+            return  EmotionExpression().SURPRISED
         elif (value == RobotEmotion.FEAR):
-            return EmotionState().FEAR
+            return EmotionExpression().FEAR
         else:
             self.logger.error("invalid emotion type %d\n" % (value))
-            return  EmotionState().NEUTRAL
+            return  EmotionExpression().NEUTRAL
