commit fdb6f14893fb8963e57e36e09c218d86fc88dd9e
Author: Sebastian Meyer zu Borgsen <semeyerz@techfak.uni-bielefeld.de>
Date:   Thu Dec 3 14:35:00 2015 +0100

    do omr neck trigger based on target instead of positions

diff --git a/examples/meka/src/mekajointinterface.cpp b/examples/meka/src/mekajointinterface.cpp
index 056b133..eee6128 100644
--- a/examples/meka/src/mekajointinterface.cpp
+++ b/examples/meka/src/mekajointinterface.cpp
@@ -64,7 +64,7 @@ void MekaJointInterface::incoming_jointstates(const sensor_msgs::JointState & ms
 }
 
 void MekaJointInterface::store_dummy_data(int id, double timestamp){
-    JointInterface::store_incoming_position(id, 0.0, timestamp);
+    JointInterface::store_incoming_position(joint_target[ID_NECK_PAN]id, 0.0, timestamp);
     JointInterface::store_incoming_speed(id, 0.0, timestamp);
 }
 
diff --git a/src/server/controller.cpp b/src/server/controller.cpp
index d2e943f..ac9f97d 100644
--- a/src/server/controller.cpp
+++ b/src/server/controller.cpp
@@ -136,7 +136,7 @@ void Controller::set_gaze_target(GazeState new_gaze_target){
     }
 
     GazeState target_gaze;
-    new_gaze_target.dump();
+    //new_gaze_target.dump();
 
     //relative or absolute gaze update?
     if (new_gaze_target.gaze_type == GazeState::GAZETYPE_RELATIVE){
diff --git a/src/server/gaze_motion_generator.cpp b/src/server/gaze_motion_generator.cpp
index 90e73aa..0993547 100644
--- a/src/server/gaze_motion_generator.cpp
+++ b/src/server/gaze_motion_generator.cpp
@@ -74,9 +74,13 @@ void GazeMotionGenerator::set_gaze_target(GazeState new_gaze_target){
     }
 
     //check for eye getting close to ocolomotor range
-    float eye_pos_l = joint_interface->get_ts_position(JointInterface::ID_EYES_LEFT_LR).get_newest_value();
-    float eye_pos_r = joint_interface->get_ts_position(JointInterface::ID_EYES_RIGHT_LR).get_newest_value();
-    float eye_pos_ud = joint_interface->get_ts_position(JointInterface::ID_EYES_BOTH_UD).get_newest_value();
+    //float eye_pos_l = joint_interface->get_ts_position(JointInterface::ID_EYES_LEFT_LR).get_newest_value();
+    //float eye_pos_r = joint_interface->get_ts_position(JointInterface::ID_EYES_RIGHT_LR).get_newest_value();
+    //float eye_pos_ud = joint_interface->get_ts_position(JointInterface::ID_EYES_BOTH_UD).get_newest_value();
+    //actually it makes more sense to trigger the neck saccade based on the target getting out of the OMR
+    float eye_target_l  = joint_interface->get_target_position(JointInterface::ID_EYES_LEFT_LR);
+    float eye_target_r  = joint_interface->get_target_position(JointInterface::ID_EYES_RIGHT_LR);
+    float eye_target_ud = joint_interface->get_target_position(JointInterface::ID_EYES_BOTH_UD);
 
     //min/max bounds:
     float left_min  = OMR_LIMIT_TRIGGERS_NECK_SACCADE * joint_interface->get_joint_min(JointInterface::ID_EYES_LEFT_LR);
@@ -87,9 +91,9 @@ void GazeMotionGenerator::set_gaze_target(GazeState new_gaze_target){
     float ud_max    = OMR_LIMIT_TRIGGERS_NECK_SACCADE * joint_interface->get_joint_max(JointInterface::ID_EYES_BOTH_UD);
 
     if (
-        (eye_pos_l < left_min) || (eye_pos_l > left_max) ||
-        (eye_pos_r < right_min) || (eye_pos_r > right_max) ||
-        (eye_pos_ud < ud_min) || (eye_pos_ud > ud_max)){
+        (eye_target_l < left_min) || (eye_target_l > left_max) ||
+        (eye_target_r < right_min) || (eye_target_r > right_max) ||
+        (eye_target_ud < ud_min) || (eye_target_ud > ud_max)){
         //the eyeball gets close to OMR, activate a neck compensation motion:
         neck_saccade_omr = true;
     }else{
diff --git a/src/server/neck_motion_generator.cpp b/src/server/neck_motion_generator.cpp
index 4928936..e6fdcea 100644
--- a/src/server/neck_motion_generator.cpp
+++ b/src/server/neck_motion_generator.cpp
@@ -133,6 +133,8 @@ void NeckMotionGenerator::calculate_targets(){
         requested_neck_state = requested_gaze_state;
     }
 
+
+    requested_neck_state.dump();
     //get targets: this is the sum of stored neck target and up-to-date offset:
     float neck_pan_target  = requested_neck_state.pan  + requested_gaze_state.pan_offset;
     float neck_tilt_target = requested_neck_state.tilt + requested_gaze_state.tilt_offset;
