|
63 | 63 |
|
64 | 64 | % Get EyeLink setup information. |
65 | 65 | [el.v, el.vs] = Eyelink('GetTrackerVersion'); |
66 | | - |
| 66 | + fprintf('Running experiment on a ''%s'' tracker.\n', el.vs); |
| 67 | + |
67 | 68 | % Save EL setup version in cfg |
68 | 69 | cfg.eyeTracker.eyeLinkVersionString = el.vs; |
69 | 70 |
|
70 | | - fprintf('Running experiment on a ''%s'' tracker.\n', el.vs); |
71 | | - |
72 | 71 | % Make sure that we get gaze data from the Eyelink. |
73 | 72 | Eyelink('Command', 'link_sample_data = LEFT,RIGHT,GAZE,AREA'); |
74 | | - Eyelink('command', 'link_event_data = GAZE,GAZERES,HREF,AREA,VELOCITY'); |
75 | | - Eyelink('command', 'link_event_filter = LEFT,RIGHT,FIXATION,BLINK,SACCADE,BUTTON'); |
| 73 | + Eyelink('Command', 'link_event_data = GAZE,GAZERES,HREF,AREA,VELOCITY'); |
| 74 | + Eyelink('Command', 'link_event_filter = LEFT,RIGHT,FIXATION,BLINK,SACCADE,BUTTON'); |
76 | 75 |
|
77 | 76 | %% Calibration |
78 | 77 |
|
79 | 78 | % This command is crucial to map the gaze positions from the tracker to |
80 | 79 | % screen pixel positions to determine fixation. |
81 | | - Eyelink('command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0); |
82 | | - Eyelink('message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0); |
| 80 | + Eyelink('Command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0); |
| 81 | + Eyelink('Message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0); |
83 | 82 |
|
84 | 83 | % Set calibration type. |
85 | | - Eyelink('command', 'calibration_type = HV5'); |
86 | | - |
| 84 | + Eyelink('Command', 'calibration_type = HV5'); |
| 85 | + |
87 | 86 | if cfg.eyeTracker.defaultCalibration |
88 | 87 |
|
89 | 88 | % Set default calibration parameters. |
90 | | - Eyelink('command', 'generate_default_targets = YES'); |
| 89 | + Eyelink('Command', 'generate_default_targets = YES'); |
91 | 90 |
|
92 | 91 | else |
93 | 92 |
|
94 | 93 | % Set custom calibration parameters. |
95 | | - Eyelink('command', 'generate_default_targets = NO'); |
| 94 | + Eyelink('Command', 'generate_default_targets = NO'); |
96 | 95 |
|
97 | 96 | % Calibration target locations, set manually the dots |
98 | 97 | % coordinates, here for 6 dots. |
99 | 98 |
|
100 | 99 | % [width, height]=Screen('WindowSize', screenNumber); |
101 | 100 |
|
102 | | - Eyelink('command', 'calibration_samples = 6'); |
103 | | - Eyelink('command', 'calibration_sequence = 0,1,2,3,4,5'); |
104 | | - Eyelink('command', 'calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... |
| 101 | + Eyelink('Command', 'calibration_samples = 6'); |
| 102 | + Eyelink('Command', 'calibration_sequence = 0,1,2,3,4,5'); |
| 103 | + Eyelink('Command', 'calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... |
105 | 104 | 640, 512, ... % width/2,height/2 |
106 | 105 | 640, 102, ... % width/2,height*0.1 |
107 | 106 | 640, 614, ... % width/2,height*0.6 |
108 | 107 | 128, 341, ... % width*0.1,height*1/3 |
109 | 108 | 1152, 341); % width-width*0.1,height*1/3 |
110 | 109 |
|
111 | 110 | % Validation target locations |
112 | | - Eyelink('command', 'validation_samples = 5'); |
113 | | - Eyelink('command', 'validation_sequence = 0,1,2,3,4,5'); |
114 | | - Eyelink('command', 'validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... |
| 111 | + Eyelink('Command', 'validation_samples = 5'); |
| 112 | + Eyelink('Command', 'validation_sequence = 0,1,2,3,4,5'); |
| 113 | + Eyelink('Command', 'validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... |
115 | 114 | 640, 512, ... % width/2,height/2 |
116 | 115 | 640, 102, ... % width/2,height*0.1 |
117 | 116 | 640, 614, ... % width/2,height*0.6 |
|
123 | 122 | % Set EDF file contents (not clear what this lines are used for). |
124 | 123 | el.vsn = regexp(el.vs, '\d', 'match'); % won't work on EL |
125 | 124 |
|
| 125 | + fprintf('Waiting for calibration \n') |
| 126 | + |
126 | 127 | % Enter Eyetracker camera setup mode, calibration and validation. |
127 | 128 | EyelinkDoTrackerSetup(el); |
128 | 129 |
|
|
226 | 227 | % Initialize EL and make sure it worked: returns 0 if OK, -1 if error. |
227 | 228 | % Exit program if this fails. |
228 | 229 | elInit = Eyelink('Initialize'); |
229 | | - if ELinit ~= 0 |
230 | | - error('Eyelink is not initialized, aborted.\n'); |
| 230 | + if elInit ~= 0 |
| 231 | + error([newline 'Eyelink is not initialized, aborted.']); |
231 | 232 | end |
232 | 233 |
|
233 | 234 | % Make sure EL is still connected: returns 1 if connected, -1 if dummy-connected, |
234 | 235 | % 2 if broadcast-connected and 0 if not connected. Exit program if this fails. |
235 | 236 | elConnection = Eyelink('IsConnected'); |
236 | | - if ELconnection ~= 1 |
237 | | - error('Eyelink is not connected, aborted.\n'); |
| 237 | + if elConnection ~= 1 |
| 238 | + error([newline 'Eyelink is not connected, aborted.']); |
| 239 | + end |
| 240 | + |
| 241 | + % Initialize Eyelink system and connection: returns 1 when succesful, 0 |
| 242 | + % otherwise |
| 243 | + if ~EyelinkInit(0, 1) |
| 244 | + fprintf('Eyelink Init aborted.\n'); |
| 245 | + return |
238 | 246 | end |
239 | 247 |
|
240 | 248 | end |
|
0 commit comments