Revision 6d13138a src/server/eye_motion_generator.cpp
src/server/eye_motion_generator.cpp | ||
---|---|---|
34 | 34 |
|
35 | 35 |
using humotion::server::EyeMotionGenerator; |
36 | 36 |
|
37 |
// saccade detection threshold in deg/s |
|
38 |
const float EyeMotionGenerator::SACCADE_SPEED_THRESHOLD = 15.0; |
|
39 |
|
|
40 | 37 |
//! constructor |
41 |
EyeMotionGenerator::EyeMotionGenerator(JointInterface *j) : |
|
42 |
GazeMotionGenerator(j, 3, 1.0/Server::MOTION_UPDATERATE) { |
|
38 |
EyeMotionGenerator::EyeMotionGenerator(JointInterface *j, Config *cfg) :
|
|
39 |
GazeMotionGenerator(j, cfg, 3, 1.0/Server::MOTION_UPDATERATE) {
|
|
43 | 40 |
} |
44 | 41 |
|
45 | 42 |
|
... | ... | |
58 | 55 |
humotion::Timestamp timestamp) { |
59 | 56 |
// get distance to target: |
60 | 57 |
float distance_abs = fabs(target - current_position); |
58 |
|
|
61 | 59 |
// get max speed: factor can be found in encyc britannica: |
62 | 60 |
// "linear.... being 300° per second for 10° and 500° per second for 30°" (max=700) |
63 |
float max_speed = fmin(700.0, 10.0*distance_abs + 200.0); |
|
61 |
float max_velocity = fmin(700.0, 10.0*distance_abs + 200.0); |
|
62 |
|
|
63 |
// scale and limit max speed |
|
64 |
max_velocity = max_velocity * config->scale_velocity_eye; |
|
65 |
max_velocity = fmin(max_velocity, config->limit_velocity_eye); |
|
66 |
|
|
64 | 67 |
// max accel: use data from: |
65 | 68 |
// "Speed and Accuracy of Saccadic Eye Movements: |
66 | 69 |
// Characteristics of Impulse Variability in the Oculomotor System" |
67 | 70 |
// http://www-personal.umich.edu/~kornblum/files/journal_exp_psych_HPP_15-3.pdf [table 2] |
68 | 71 |
float max_accel = fmin(80000.0, 1526.53*distance_abs + 10245.4); |
69 | 72 |
|
73 |
// scale and limit max acceleration |
|
74 |
max_accel = max_accel * config->scale_acceleration_eye; |
|
75 |
max_accel = fmin(max_accel, config->limit_acceleration_eye); |
|
76 |
|
|
70 | 77 |
// feed reflexxes api with data |
71 | 78 |
reflexxes_set_input(dof, target, current_position, current_velocity, |
72 |
timestamp, max_speed, max_accel);
|
|
79 |
timestamp, max_velocity, max_accel);
|
|
73 | 80 |
} |
74 | 81 |
|
75 | 82 |
//! calculate joint targets |
Also available in: Unified diff