Revision f7954788

View differences:

cfg/humotion.cfg
54 54
add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
55 55
add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0)
56 56
add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0)
57
add_entry_bool(eye_group, "use_neck_target_instead_of_position_eye", "use neck target in difference calc instead of real position")
58

  
57 59

  
58 60
eyeblink_group = gen.add_group("eyeblink")
59 61
add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0)
include/humotion/server/config.h
59 59
    float scale_acceleration_eye;
60 60
    float limit_velocity_eye;
61 61
    float limit_acceleration_eye;
62
    bool use_neck_target_instead_of_position_eye;
62 63

  
63 64
    // parameters fo the breathing pattern
64 65
    float breath_period;
src/server/config.cpp
81 81
    // limit the maximum acceleration, value is given in deg/s^2
82 82
    limit_acceleration_eye = 80000;
83 83

  
84
    // calculate the overall target distance based on neck target instead of using the real neck
85
    // position
86
    use_neck_target_instead_of_position_eye = true;
84 87

  
85 88
    // parameters fo the breathing pattern
86 89
    // healthy adult human: 12-15 breaths/min (see e.g. "Ganong's review of medical physiology")
src/server/eye_motion_generator.cpp
82 82
//! calculate joint targets
83 83
void EyeMotionGenerator::calculate_targets() {
84 84
    // use the target values for a faster response
85
    float neck_pan_now  = joint_interface_->get_target_position(JointInterface::ID_NECK_PAN);
86
    float neck_tilt_now = joint_interface_->get_target_position(JointInterface::ID_NECK_TILT);
85
    float neck_pan_now  = 0.0;
86
    float neck_tilt_now = 0.0;
87

  
88
    if (use_neck_target_instead_of_position_eye) {
89
        // position calc based on target
90
        neck_pan_now = joint_interface_->get_target_position(JointInterface::ID_NECK_PAN);
91
        neck_tilt_now = joint_interface_->get_target_position(JointInterface::ID_NECK_TILT);
92
    } else {
93
        // position calc based on real position
94
        neck_pan_now =
95
                joint_interface_->get_ts_position(JointInterface::ID_NECK_PAN).get_newest_value();
96
        neck_tilt_now =
97
                joint_interface_->get_ts_position(JointInterface::ID_NECK_TILT).get_newest_value();
98
    }
87 99

  
88 100
    // calculate target angles for the eyes
89 101
    // right eye is dominant -> direct output
......
99 111
    // tilt
100 112
    float eye_tilt_target = requested_gaze_state_.tilt - (neck_tilt_now);
101 113

  
102
    if (0) {
103
        eye_pan_r_target = 0.0;
104
        eye_pan_l_target = 0.0;
105
        eye_tilt_target  = 0.0;
106
    }
107

  
108 114
    // check and take care of limits
109 115
    eye_pan_l_target = limit_target(JointInterface::ID_EYES_LEFT_LR, eye_pan_l_target);
110 116
    eye_pan_r_target = limit_target(JointInterface::ID_EYES_RIGHT_LR, eye_pan_r_target);

Also available in: Unified diff