-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTobii_calibration_with_psychtoolbox.m
More file actions
66 lines (53 loc) · 1.67 KB
/
Tobii_calibration_with_psychtoolbox.m
File metadata and controls
66 lines (53 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
global EXPWIN KEYBOARD SPACEKEY CENTER GREY Calib
%**************************
% Open Psychtoolbox window
%**************************
Screen('Preference','SkipSyncTests',1);
%Open settings for screen & tracker
%Calib=SetCalibParams;
%Window variables
CENTER = [round((Calib.screen.width - Calib.screen.x)/2) ...
round((Calib.screen.height -Calib.screen.y)/2)];
KEYBOARD=max(GetKeyboardIndices);
SPACEKEY = 32;%Windows system key code
%****************************
% Connect to eye tracker
%****************************
disp('Initializing tetio...');
tetio_init();
fprintf('Connecting to tracker "%s"...\n', eyetrackerhost);
%keyboard
tetio_connectTracker(eyetrackerhost)
%Wait until the synchronization of ET and Matlab clock is finished
tic;
while tetio_clockSyncState() == 0
pause(0.25)
if toc > 5
tetio_cleanUP()
error('Error: Unable to synchronize Eye Tracker and computer clocks, retrying');
end
end
%Get and print the Frame rate of the current ET
%tetio_setFrameRate(60);
fprintf('Frame rate: %d Hz.\n', tetio_getFrameRate);
%*********************
% TrackStatus
%*********************
TrackStatus(Calib);
%*********************
% Calibration
%*********************
disp('Starting Calibration workflow');
[pts, TrackError,calibplot] = HandleCalibWorkflow(Calib,Constants);
disp('Calibration workflow stopped');
Screen('FillRect',EXPWIN,GREY);
Screen(EXPWIN,'Flip');
%*********************
% Calibration finished
%********************
%tetio_cleanUp()
%Screen('Close',EXPWIN)
disp('Displaying point by point error:')
disp('[Mean StandardDev]')
TrackError
disp('Closing Calibration Software')