AvidOwl628
AvidOwl628

Reputation: 11

Tobii Eye Tracker 5 C API Callbacks

I have a Tobii Eye Tracker 5 and I'm using the C API. The concept validation tool works without troubles, I can print my devices serial id, gaze output frequency, and so on. The notification callback also works, but all of the other callbacks, e.g. for getting the gaze data are never executed.

I also get a warnings and fault notification, but with the fault text "ok". Also all of the status results are ok. I've copied the code from https://developer.tobiipro.com/c/c-sdk-reference-guide.html using find_all_eyetrackers.c and then for example calibrating_with_gaze.c with the printf moved to the beginning of the callback.

Any help/insights/thoughts would really be appreciated! :D

Minimal code example:

#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
#include "tobii_research_eyetracker.h"
#include "tobii_research_calibration.h"
#include "tobii_research_streams.h"
#include <windows.h>

void notification_callback(TobiiResearchNotification* notification, void* user_data) {
    printf("Notification callback: %" PRId64 "\n", notification->system_time_stamp);
}

void gaze_callback(TobiiResearchGazeData* gaze_data, void* user_data)
{
    printf("Gaze callback:\n");
    printf("Left eye gaze point: (%f, %f)\nRight eye gaze point: (%f, %f)\n",
        gaze_data->left_eye.gaze_point.position_on_display_area.x,
        gaze_data->left_eye.gaze_point.position_on_display_area.y,
        gaze_data->right_eye.gaze_point.position_on_display_area.x,
        gaze_data->right_eye.gaze_point.position_on_display_area.y);
}

void calibrating_with_gaze_example(TobiiResearchEyeTracker* eyetracker)
{
    TobiiResearchStatus status = tobii_research_subscribe_to_gaze_data(eyetracker, gaze_callback, NULL);
    status = tobii_research_screen_based_calibration_enter_calibration_mode(eyetracker);

    Sleep(6000);
    
    status = tobii_research_screen_based_calibration_leave_calibration_mode(eyetracker);
    status = tobii_research_unsubscribe_from_gaze_data(eyetracker, gaze_callback);
}

int main()
{
    TobiiResearchEyeTrackers* eyetrackers = NULL;
    TobiiResearchStatus result = tobii_research_find_all_eyetrackers(&eyetrackers);

    tobii_research_subscribe_to_notifications(eyetrackers->eyetrackers[0], notification_callback, NULL);
    calibrating_with_gaze_example(eyetrackers->eyetrackers[0]);
    tobii_research_unsubscribe_from_notifications(eyetrackers->eyetrackers[0], notification_callback);
    tobii_research_free_eyetrackers(eyetrackers);
}

Output:

Notification callback: 801117403012
Notification callback: 801117403325

(but no gaze_data)

I also tried the eye openess, time synchronization and eye image (although I thinks this one the device doesn't support, so it's expected to not work) callbacks, not of them where ever called in the code (no printfs printed and no breakpoints reached), also not when I include it in my rendering application's loop.

Upvotes: 1

Views: 122

Answers (1)

Siruj
Siruj

Reputation: 470

Unfortunately, even though Tobii provides the SDK and returns some basic data about the tracker, any additional information, such as the gaze data, is unavailable unless you purchase one of their supported eye trackers.

And if you plan to capture/store any of the gaze data, you'd have to agree to their separate license.

If you're wondering, the scenario is the same with the other SDKs they offer, such as the Python one. Even though their forums have been wiped, you can still find conversations on this matter via the Wayback Machine dating back to 2020.

Upvotes: 1

Related Questions