commit 1c7584593a1c4ab01b5823691e4342c8e8c15675
Author: Simon Schulz <sschulz@cit-ec.uni-bielefeld.de>
Date:   Wed Dec 2 16:10:32 2015 +0100

    fixed gazetype rel/abs and fixed msg include from local build

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9879a6..53a1c44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,11 +132,14 @@ ENDIF (catkin_FOUND)
 ## Specify additional locations of header files
 ## Your package locations should be listed before other locations
 include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
-include_directories(include/humotion)
-include_directories( ${catkin_INCLUDE_DIRS})
+include_directories(BEFORE include)
+include_directories(BEFORE include/humotion)
+#make sure to use ros messages from current build
+include_directories(BEFORE ${CATKIN_DEVEL_PREFIX}/include)
+#this should be appended:
+include_directories(${catkin_INCLUDE_DIRS})
 #link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
 
-
 #####################
 # PLEASE DO NOT REMOVE THIS! This is a hack necessary for qtcreator to show cmake header files in the project view!
 file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/humotion/*.h  include/humotion/client/*.h  include/humotion/server/*.h srv/*.srv msg/*.msg etc/*)
diff --git a/include/humotion/gaze_state.h b/include/humotion/gaze_state.h
index 0458ba1..5cd8eeb 100644
--- a/include/humotion/gaze_state.h
+++ b/include/humotion/gaze_state.h
@@ -46,16 +46,16 @@ public:
         float roll_offset;
 
         //pan,tilt,roll can be relative or absolute
-        int type;
+        int gaze_type;
 
         //when was this target requested?
         double timestamp;
 
         //is this relative or
         enum GAZE_STATE_TYPE{
-            ABSOLUTE=0,
-            RELATIVE=1,
-            OVERRIDE=2
+            GAZETYPE_ABSOLUTE=0,
+            GAZETYPE_RELATIVE=1,
+            GAZETYPE_OVERRIDE=2
         };
 
         //
diff --git a/msg/gaze.msg b/msg/gaze.msg
index f56bbf4..5cde44d 100644
--- a/msg/gaze.msg
+++ b/msg/gaze.msg
@@ -1,9 +1,9 @@
 Header header
 
 #type of pan/tilt/roll targets
-int32 type
-int32 ABSOLUTE=0
-int32 RELATIVE=1
+int32 gaze_type
+int32 GAZETYPE_ABSOLUTE=0
+int32 GAZETYPE_RELATIVE=1
 
 float32 pan
 float32 tilt
diff --git a/src/client/middleware_ros.cpp b/src/client/middleware_ros.cpp
index 6bb2b5a..4291d81 100644
--- a/src/client/middleware_ros.cpp
+++ b/src/client/middleware_ros.cpp
@@ -29,8 +29,8 @@
 
 #ifdef ROS_SUPPORT
 
-#include <humotion/mouth.h>
-#include <humotion/gaze.h>
+#include "humotion/mouth.h"
+#include "humotion/gaze.h"
 #include <boost/range/algorithm/remove_if.hpp>
 #include <boost/algorithm/string/classification.hpp>
 
@@ -131,10 +131,10 @@ void MiddlewareROS::send_gaze_target(){
     msg.eyeblink_request_left = gaze_state.eyeblink_request_left;
     msg.eyeblink_request_right = gaze_state.eyeblink_request_right;
 
-    if (gaze_state.type == GazeState::ABSOLUTE){
-        msg.type = humotion::gaze::ABSOLUTE;
+    if (gaze_state.gaze_type == GazeState::GAZETYPE_ABSOLUTE){
+        msg.gaze_type = humotion::gaze::GAZETYPE_ABSOLUTE;
     }else{
-        msg.type = humotion::gaze::RELATIVE;
+        msg.gaze_type = humotion::gaze::GAZETYPE_RELATIVE;
     }
 
     //add position to send queue
diff --git a/src/gaze_state.cpp b/src/gaze_state.cpp
index 34347b0..ab1624d 100644
--- a/src/gaze_state.cpp
+++ b/src/gaze_state.cpp
@@ -45,7 +45,7 @@ GazeState::GazeState(){
     eyebrow_left   = -3.0;
     eyebrow_right  = 3.0;
 
-    type = ABSOLUTE;
+    gaze_type = GAZETYPE_ABSOLUTE;
 
     eyeblink_request_right = 0;
     eyeblink_request_left  = 0;
@@ -60,7 +60,7 @@ void GazeState::dump(){
            pan, pan_offset, tilt, tilt_offset, roll, roll_offset, vergence,
            eyelid_opening_upper,eyelid_opening_lower,
            eyebrow_left, eyebrow_right,
-           (type==ABSOLUTE?"absolute":(type==RELATIVE?"relative":(type==OVERRIDE?"override":"!INVALID!"))),
+           (gaze_type==GAZETYPE_ABSOLUTE?"absolute":(gaze_type==GAZETYPE_RELATIVE?"relative":(gaze_type==GAZETYPE_OVERRIDE?"override":"!INVALID!"))),
            eyeblink_request_left, eyeblink_request_right
            );
 }
diff --git a/src/server/controller.cpp b/src/server/controller.cpp
index 5c961f1..69a3d74 100644
--- a/src/server/controller.cpp
+++ b/src/server/controller.cpp
@@ -107,7 +107,7 @@ GazeState Controller::relative_gaze_to_absolute_gaze(GazeState relative){
     double roll      = joint_interface->get_ts_position(JointInterface::ID_NECK_ROLL).get_interpolated_value(relative_target_timestamp);
 
     //build up absolute target:
-    absolute_gaze.type  = GazeState::ABSOLUTE;
+    absolute_gaze.gaze_type  = GazeState::GAZETYPE_ABSOLUTE;
     absolute_gaze.pan   = pan + relative.pan;
     absolute_gaze.tilt  = tilt + relative.tilt;
     absolute_gaze.roll  = roll + relative.roll;
@@ -137,7 +137,7 @@ void Controller::set_gaze_target(GazeState new_gaze_target){
     GazeState target_gaze;
 
     //relative or absolute gaze update?
-    if (new_gaze_target.type == GazeState::RELATIVE){
+    if (new_gaze_target.gaze_type == GazeState::GAZETYPE_RELATIVE){
         //relative gaze target -> calculate target angles
         target_gaze = relative_gaze_to_absolute_gaze(new_gaze_target);
     }else{
diff --git a/src/server/gaze_motion_generator.cpp b/src/server/gaze_motion_generator.cpp
index 9f34879..90e73aa 100644
--- a/src/server/gaze_motion_generator.cpp
+++ b/src/server/gaze_motion_generator.cpp
@@ -52,10 +52,9 @@ GazeMotionGenerator::~GazeMotionGenerator(){
 //! update gaze target:
 //! \param GazeState with target values for the overall gaze
 void GazeMotionGenerator::set_gaze_target(GazeState new_gaze_target){
-    if (requested_gaze_state.type == GazeState::RELATIVE){
-        //relative gaze target -> calculate target angle:
-        printf("> FIXME: add code to interpolate the current position based on timestamp of gaze correction\n");
-        exit(0);
+    if (requested_gaze_state.gaze_type == GazeState::GAZETYPE_RELATIVE){
+        printf("> ERROR: gaze targets should be converted to absolute before calling this\n");
+        exit(EXIT_FAILURE);
     }
 
     //check magnitude of gaze change to detect eye-neck saccades:
diff --git a/src/server/middleware_ros.cpp b/src/server/middleware_ros.cpp
index 365637d..ed3bf93 100644
--- a/src/server/middleware_ros.cpp
+++ b/src/server/middleware_ros.cpp
@@ -108,7 +108,6 @@ void MiddlewareROS::incoming_gaze_target(const humotion::gaze::ConstPtr& msg){
     GazeState gaze_state;
     ///printf("> incoming gaze_target [P:%3.1f, T:%3.1f, R:%3.1f] %s\n", msg->pan, msg->tilt, msg->roll, msg->type==humotion::gaze::ABSOLUTE?"ABSOLUTE":"RELATIVE");
 
-    gaze_state.type = msg->type;
     gaze_state.pan  = msg->pan;
     gaze_state.tilt = msg->tilt;
     gaze_state.roll = msg->roll;
@@ -127,6 +126,11 @@ void MiddlewareROS::incoming_gaze_target(const humotion::gaze::ConstPtr& msg){
     gaze_state.eyeblink_request_left = msg->eyeblink_request_left;
     gaze_state.eyeblink_request_right = msg->eyeblink_request_right;
 
+    if (msg->gaze_type == humotion::gaze::GAZETYPE_ABSOLUTE){
+        gaze_state.gaze_type = GazeState::GAZETYPE_ABSOLUTE;
+    }else{
+        gaze_state.gaze_type = GazeState::GAZETYPE_RELATIVE;
+    }
     gaze_state.timestamp = convert_ros_to_timestamp_ms(msg->header.stamp);
 
     controller->set_gaze_target(gaze_state);
diff --git a/src/server/neck_motion_generator.cpp b/src/server/neck_motion_generator.cpp
index a902872..4928936 100644
--- a/src/server/neck_motion_generator.cpp
+++ b/src/server/neck_motion_generator.cpp
@@ -181,11 +181,11 @@ void NeckMotionGenerator::setup_neckmotion(int dof, float target, float now){
     float max_speed = (CONST_GUITTON87_A * distance_abs + CONST_GUITTON87_B);
 
     //max accel: 	assuming linear acceleration we have
-    // v ^
-    //   |  / \
-    //   | /   \
-    //   |/_____\___> t
-    //
+    /* v ^
+    *   |  / \
+    *   | /   \
+    *   |/_____\___> t
+    */
     // d_total = 2 * 1/2 * a * (t_total/2)^2 = 1/4 * a * t_total^2
     // as we use linear accel we have
     // v_max = a * t_total/2  --> t_total = 2*v_max / a
