Calculates left x velocity, left y velocity, right x velocity and right y velocity from queue of samples.
- Parameters
-
[in] | slen | Sample model to use for velocity calculation. Acceptable models are FIVE_SAMPLE_MODEL , NINE_SAMPLE_MODEL , SEVENTEEN_SAMPLE_MODEL and EL1000_TRACKER_MODEL . |
[out] | xvel | Left and right x velocity. Expects an array of 2 elements of floats. The array is filled with left and right velocity values. Upon return of this function xvel[0] contains the left x velocity data and xvel[1] contains right x velocity data. If velocity cannot be calculated for any reason(eg. insufficient samples, no data) MISSING_DATA is filled for the given velocity. |
[out] | yvel | Left and right y velocity. Expects an array of 2 elements of floats. The array is filled with left and right velocity values. Upon return of this function yvel[0] contains the left y velocity data and xvel[1] contains right y velocity data. If velocity cannot be calculated for any reason(eg. insufficient samples, no data) MISSING_DATA is filled for the given velocity. |
[out] | vel_sample | Velocity for sample. Expects a FSAMPLE structure to fill in the sample, the velocity is calculated for. |
Example:
4 int main(int argc, char ** argv)
6 if(open_eyelink_connection(0)) // connect to tracker
11 eyecmd_printf("link_sample_data = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS"); // tell the tracker to stuff the sample with
12 if(start_recording(0,0,1,0)) // start recording failed.
14 close_eyelink_connection();
18 if(!eyelink_wait_for_block_start(100, 1, 0)) // wait for block start
21 close_eyelink_connection();
26 UINT32 st = current_time();
27 while(current_time()-st<10000) // record for 10 seconds
32 if(check_recording()!=0)
34 close_eyelink_connection();
35 return -4; // recording aborted.
37 eyelink_calculate_velocity_x_y(FIVE_SAMPLE_MODEL,xvel,yvel,&fs);
38 printf("%lu %f %f %f %f\n",fs.time,xvel[0],yvel[0], xvel[1], yvel[1]);
39 pump_delay(100); // we check the velocity every 100 ms.
42 close_eyelink_connection();