|
40 | 40 | % |
41 | 41 | % Optional useful functions to implement in future: |
42 | 42 | % |
43 | | - % - oldlevel = Eyelink(‘Verbosity’ [,level]); |
44 | | - % |
45 | | - % Set level of verbosity for error/warning/status messages. ‘level’ optional, new |
| 43 | + % - Set level of verbosity for error/warning/status messages. ‘level’ optional, new |
46 | 44 | % level of verbosity. ‘oldlevel’ is the old level of verbosity. The following |
47 | 45 | % levels are supported: 0 = Shut up. 1 = Print errors, 2 = Print also warnings, 3 |
48 | 46 | % = Print also some info, 4 = Print more useful info (default), >5 = Be very |
49 | 47 | % verbose (mostly for debugging the driver itself). |
| 48 | + % |
| 49 | + % oldlevel = Eyelink(‘Verbosity’ [,level]); |
| 50 | + % |
| 51 | + % - Tag the ET data outout |
| 52 | + % |
| 53 | + % Eyelink('command', 'add_file_preamble_text', 'Recorded by EyelinkToolbox demo-experiment'); |
| 54 | + % |
| 55 | + % - Set parser (conservative saccade thresholds) |
| 56 | + % |
| 57 | + % Eyelink('command', 'saccade_velocity_threshold = 35'); |
| 58 | + % Eyelink('command', 'saccade_acceleration_threshold = 9500'); |
| 59 | + % |
| 60 | + % - Drift correction |
| 61 | + % |
| 62 | + % EyelinkDoDriftCorrection(el); |
| 63 | + % |
| 64 | + % success = EyelinkDoDriftCorrection(el); |
| 65 | + % if success~=1 |
| 66 | + % Eyelink('shutdown'); |
| 67 | + % cleanUp() |
| 68 | + % return; |
| 69 | + % end |
| 70 | + % |
| 71 | + % - Tag the recording, in the past caused delays during the presentation so I avoided to use it |
| 72 | + % |
| 73 | + % Eyelink('message', 'Trial 1'); |
| 74 | + |
50 | 75 |
|
51 | 76 |
|
52 | 77 | if ~cfg.eyeTracker.do |
|
66 | 91 | % and control codes (e.g. tracker state bit and Eyelink key values). |
67 | 92 | el = EyelinkInitDefaults(cfg.screen.win); |
68 | 93 |
|
69 | | - % calibration has silver background with black targets, sound and smaller |
| 94 | + % Calibration has silver background with black targets, sound and smaller |
70 | 95 | % targets |
71 | 96 | el.backgroundcolour = [192 192 192, (cfg.screen.win)]; |
72 | 97 | el.msgfontcolour = BlackIndex(cfg.screen.win); |
|
75 | 100 | el.calibrationtargetwidth = 0.5; |
76 | 101 | el.displayCalResults = 1; |
77 | 102 |
|
78 | | - % call this function for changes to the calibration structure to take |
| 103 | + % Call this function for changes to the calibration structure to take |
79 | 104 | % affect |
80 | 105 | EyelinkUpdateDefaults(el); |
81 | 106 |
|
|
113 | 138 | [el.v, el.vs] = Eyelink('GetTrackerVersion'); |
114 | 139 | fprintf('Running experiment on a ''%s'' tracker.\n', el.vs); |
115 | 140 |
|
116 | | - % make sure that we get gaze data from the Eyelink |
| 141 | + % Make sure that we get gaze data from the Eyelink |
117 | 142 | Eyelink('Command', 'link_sample_data = LEFT,RIGHT,GAZE,AREA'); |
118 | 143 |
|
119 | 144 | %% STEP 4 |
120 | | - % SET UP TRACKER CONFIGURATION |
121 | | - |
122 | 145 | % Setting the proper recording resolution, proper calibration type, |
123 | 146 | % as well as the data file content; |
124 | 147 |
|
125 | | - Eyelink('command', 'add_file_preamble_text', 'Recorded by EyelinkToolbox demo-experiment'); |
126 | | - |
127 | 148 | % This command is crucial to map the gaze positions from the tracker to |
128 | 149 | % screen pixel positions to determine fixation |
129 | 150 | Eyelink('command', 'screen_pixel_coords = %ld %ld %ld %ld', 0, 0, 0, 0); |
130 | 151 | Eyelink('message', 'DISPLAY_COORDS %ld %ld %ld %ld', 0, 0, 0, 0); |
131 | 152 |
|
132 | | - % set calibration type. |
| 153 | + % Set calibration type. |
133 | 154 | Eyelink('command', 'calibration_type = HV5'); |
134 | 155 |
|
135 | 156 | if cfg.eyeTracker.defaultCalibration |
136 | 157 |
|
137 | 158 | % Set default calibration parameters |
138 | | - |
139 | | - |
140 | | - % you must send this command with value NO for custom calibration |
141 | | - % you must also reset it to YES for subsequent experiments |
142 | 159 | Eyelink('command', 'generate_default_targets = YES'); |
143 | 160 |
|
144 | 161 | else |
145 | | - % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
146 | | - % CUSTOM CALIBRATION |
147 | | - % (SET MANUALLY THE DOTS COORDINATES, HERE FOR 6 DOTS) |
148 | 162 |
|
149 | | - % you must send this command with value NO for custom calibration |
150 | | - % you must also reset it to YES for subsequent experiments |
| 163 | + % Set default calibration parameters |
151 | 164 | Eyelink('command', 'generate_default_targets = NO'); |
152 | 165 |
|
153 | | - % calibration and validation target locations |
154 | | - [width, height]=Screen('WindowSize', screenNumber); |
| 166 | + % Calibration target locations, set manually the dots |
| 167 | + % coordinates, here for 6 dots |
| 168 | + |
| 169 | + % [width, height]=Screen('WindowSize', screenNumber); |
| 170 | + |
155 | 171 | Eyelink('command','calibration_samples = 6'); |
156 | 172 | Eyelink('command','calibration_sequence = 0,1,2,3,4,5'); |
157 | 173 | Eyelink('command','calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
|
161 | 177 | 128,341, ... %width*0.1,height*1/3 |
162 | 178 | 1152,341 ); %width-width*0.1,height*1/3 |
163 | 179 |
|
| 180 | + % Validation target locations |
164 | 181 | Eyelink('command','validation_samples = 5'); |
165 | 182 | Eyelink('command','validation_sequence = 0,1,2,3,4,5'); |
166 | 183 | Eyelink('command','validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d',... |
|
169 | 186 | 640,614, ... %width/2,height*0.6 |
170 | 187 | 128,341, ... %width*0.1,height*1/3 |
171 | 188 | 1152,341 ); %width-width*0.1,height*1/3 |
172 | | - % % % % % % % % % % % % % % % % % % % % % % % % % % % % % |
173 | 189 |
|
174 | 190 | end |
175 | 191 |
|
176 | | - % % set parser (conservative saccade thresholds) |
177 | | - % Eyelink('command', 'saccade_velocity_threshold = 35'); |
178 | | - % Eyelink('command', 'saccade_acceleration_threshold = 9500'); |
179 | | - |
180 | | - % set EDF file contents (not clear what this lines are used for) |
| 192 | + % Set EDF file contents (not clear what this lines are used for) |
181 | 193 | el.vsn = regexp(el.vs, '\d', 'match'); % wont work on EL |
182 | 194 |
|
183 | | - % enter Eyetracker camera setup mode, calibration and validation |
| 195 | + % Enter Eyetracker camera setup mode, calibration and validation |
184 | 196 | EyelinkDoTrackerSetup(el); |
185 | 197 |
|
186 | | - % % do a final check of calibration using driftcorrection |
187 | | - % % You have to hit esc before return. |
188 | | - % EyelinkDoDriftCorrection(el); |
189 | | - |
190 | | - % % do a final check of calibration using driftcorrection |
191 | | - % success=EyelinkDoDriftCorrection(el); |
192 | | - % if success~=1 |
193 | | - % Eyelink('shutdown'); |
194 | | - % cleanUp() |
195 | | - % return; |
196 | | - % end |
197 | | - |
198 | 198 | % Go back to default screen background color |
199 | 199 | Screen('FillRect', cfg.screen.win, cfg.color.background); |
200 | 200 | Screen('Flip', cfg.screen.win); |
|
206 | 206 | Eyelink('Command', 'set_idle_mode'); |
207 | 207 | WaitSecs(0.05); |
208 | 208 | Eyelink('StartRecording'); |
209 | | - % % here to tag the recording, in the past caused delays during the |
210 | | - % % presentation so I avoided to use it |
211 | | - % Eyelink('message',['TRIALID ',num2str(blocks),'_startTrial']); |
212 | 209 |
|
213 | | - % check recording status, stop display if error |
| 210 | + % Check recording status, stop display if error |
214 | 211 | checkrec = Eyelink('checkrecording'); |
215 | 212 | if checkrec ~= 0 |
216 | 213 | fprintf('\nEyelink is not recording.\n\n'); |
|
219 | 216 | return |
220 | 217 | end |
221 | 218 |
|
222 | | - % record a few samples before we actually start displaying |
| 219 | + % Record a few samples before we actually start displaying |
223 | 220 | % otherwise you may lose a few msec of data |
224 | 221 | WaitSecs(0.1); |
225 | 222 |
|
|
0 commit comments