This is example 8. This example demonstrates the following:
-
Starting the drift-check procedure explicitly
This example is based on example 6. With an additional call for starting the drift-check procedure.
Source code
Source file: example8.c
processInput()
The following single character commands are implemented here:
q
: quit
o
: open/close device
u
: show/hide control window
x
: toggle show gui on setup mode
X
: toggle show gui on data mode
i
: enter idle mode
s
: enter setup mode
z
: enter data mode
d
: start drift-check procedure
D
: drop drift-check results
m
: toggle show mode-change events
When you press d
then eyevec_start_drift_check()
will be called causing the
eye-tracker to run the drift-check procedure.
static int processInput(EyeVec* eyevec, ClientData* clientdata, int ch)
{
.
.
.
else if (ch == 'd') {
bool ignore;
err = eyevec_start_drift_check(eyevec, 0.3, 0.3, &ignore); (1)
printError("eyevec_start_drift_check()", err);
}
else if (ch == 'D') {
err = eyevec_drop_drift_check(eyevec); (2)
printError("eyevec_drop_drift_check()", err);
}
.
.
.
}
1 | Start drift-check procedure at logical screen position <0.3, 0.3>. |
2 | Drop latest drift-check results. |
Running
After a succesful build run the program:
-
Press
x
to calleyevec_set_show_gui_on_setup_mode()
. This sets the show-gui-on-setup-mode flag to make the user-interface show on setup mode enter. If however you prefer to keep the user-interface visible at all times while testing pressu
to calleyevec_show_control_window()
. If you don’t want to calleyevec_show_control_window()
explicity but do want the user-interface to show when in data mode, pressX
to calleyevec_set_show_gui_on_data_mode()
. This sets the show-gui-on-data-mode flag to make the user-interface show on data mode enter. -
Press
o
to calleyevec_open()
. Eye-tracker should go from off mode to idle mode. -
Press
s
to calleyevec_enter_setup_mode()
. Eye-tracker should go from idle mode to setup mode and the user-interface should appear. Now perform a baseline measurement and calibration in the user-interface. -
In the user-interface press
Esc
or click Proceed make the eye-tracker go from setup mode to data mode (callingeyevec_enter_data_mode()
would also work). The user-interface should disappear (unless you pressedu
orX
in step 1). -
Press
d
to calleyevec_start_drift_check()
. Eye-tracker should go from data mode to drift-check mode, run the drift-check procedure, and then return to data mode. -
Press
q
to quit.
You can also run a drift-check from setup mode, but that is mainly for testing, not useful in an experimental context. |
Output might look like this (empty lines added for clarity):
eyevec_create_thread(): OK
eyevec_initialize(): OK
Type q to quit, ? for help.
[x]
eyevec_set_show_gui_on_setup_mode(true): OK
[o]
eyevec_open(): OK
onModeChange:
eventtime: 1750590439633129
oldmode: TRACKER_MODE_OFF
newmode: TRACKER_MODE_IDLE
[s]
onModeChange:
eventtime: 1750590441826613
oldmode: TRACKER_MODE_IDLE
newmode: TRACKER_MODE_SETUP
eyevec_enter_setup_mode(): OK
onModeChange:
eventtime: 1750590451795581
oldmode: TRACKER_MODE_SETUP
newmode: TRACKER_MODE_SETUP_BASELINE
onModeChange:
eventtime: 1750590455125406
oldmode: TRACKER_MODE_SETUP_BASELINE
newmode: TRACKER_MODE_SETUP
onModeChange:
eventtime: 1750590458632726
oldmode: TRACKER_MODE_SETUP
newmode: TRACKER_MODE_SETUP_CALIBRATION
onModeChange:
eventtime: 1750590469220769
oldmode: TRACKER_MODE_SETUP_CALIBRATION
newmode: TRACKER_MODE_SETUP
onModeChange:
eventtime: 1750590473787051
oldmode: TRACKER_MODE_SETUP
newmode: TRACKER_MODE_DATA
[d]
onModeChange:
eventtime: 1750590477641995
oldmode: TRACKER_MODE_DATA
newmode: TRACKER_MODE_DRIFT_CHECK
eyevec_start_drift_check(): OK
onModeChange:
eventtime: 1750590479668783
oldmode: TRACKER_MODE_DRIFT_CHECK
newmode: TRACKER_MODE_DATA
[q]
eyevec_cleanup(): OK
eyevec_destroy_thread(): OK
If the
auto-apply-drift-correction
eye-tracker setting is set (the default), then a succesful drift-check will
result in
eyevec_apply_drift_check_gaze_offset()
being called. If this settings is false then you can choose to analyze the
drift-check results in onModeChange()
and call the function contingent on the
reported drift-check error.