Home Forums Software Development Headtracking on Tobii eye tracker 4C

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #7705
    Kenbo
    Participant

    Hi,

    I just playing around with the tobii free SDK on C, everthing seems to be working except the headtracking. I just copy paste the head tracking example of https://tobii.github.io/stream_engine/ in a new C template. When i have a breakpoint on the function head_pose_callback. I see that the function looking to the head_pose->position_validity, it return TOBII_VALIDITY_INVALID and it must have TOBII_VALIDITY_VALID to go through the function. Why it always returning TOBII_VALIDITY_INVALID?

    #7706
    Alex [Tobii]
    Participant

    Do you have Tobii EyeX or Tobii Eye Tracker 4C?

    #7711
    Kenbo
    Participant

    I have The Tobii Eye Tracker 4C

    #7719
    Chou
    Participant

    I also have same problem in Tobii Eye Tracker 4C ~~example of C code can’t work at all, it reprot TOBII_VALIDITY_INVALID

    #7729
    Grant [Tobii]
    Keymaster

    Hi @chouweizhong @kenbo, apologies for the delay in reply, I have tried to run the sample code:

    #include <tobii/tobii_streams.h>
    #include <stdio.h>
    #include <assert.h>
    
    void head_pose_callback( tobii_head_pose_t const* head_pose, void* user_data )
    {
        if( head_pose->position_validity == TOBII_VALIDITY_VALID )
            printf( "Position: (%f, %f, %f)\n",
                head_pose->position_xyz[ 0 ],
                head_pose->position_xyz[ 1 ],
                head_pose->position_xyz[ 2 ] );
    
        printf( "Rotation:\n" );
        for( int i = 0; i < 3; ++i )
            if( head_pose->rotation_validity_xyz[ i ] == TOBII_VALIDITY_VALID )
                printf( "%f\n", head_pose->rotation_xyz[ i ] );
    }
    
    static void url_receiver( char const* url, void* user_data )
    {
        char* buffer = (char*)user_data;
        if( *buffer != '\0' ) return; // only keep first value
    
        if( strlen( url ) < 256 )
            strcpy( buffer, url );
    }
    
    int main()
    {
        tobii_api_t* api;
        tobii_error_t error = tobii_api_create( &api, NULL, NULL );
        assert( error == TOBII_ERROR_NO_ERROR );
    
        char url[ 256 ] = { 0 };
        error = tobii_enumerate_local_device_urls( api, url_receiver, url );
        assert( error == TOBII_ERROR_NO_ERROR && *url != '\0' );
    
        tobii_device_t* device;
        error = tobii_device_create( api, url, &device );
        assert( error == TOBII_ERROR_NO_ERROR );
    
        error = tobii_head_pose_subscribe( device, head_pose_callback, 0 );
        assert( error == TOBII_ERROR_NO_ERROR );
    
        int is_running = 1000; // in this sample, exit after some iterations
        while( --is_running > 0 )
        {
            error = tobii_wait_for_callbacks( NULL, 1, &device );
            assert( error == TOBII_ERROR_NO_ERROR || error == TOBII_ERROR_TIMED_OUT );
    
            error = tobii_device_process_callbacks( device );
            assert( error == TOBII_ERROR_NO_ERROR );
        }
    
        error = tobii_head_pose_unsubscribe( device );
        assert( error == TOBII_ERROR_NO_ERROR );
    
        error = tobii_device_destroy( device );
        assert( error == TOBII_ERROR_NO_ERROR );
    
        error = tobii_api_destroy( api );
        assert( error == TOBII_ERROR_NO_ERROR );
        return 0;
    }

    The only issue I found was that I needed to add:

    #include <string.h>

    And therafter worked well using my Tobii Eye Tracker 4C in conjunction
    with Visual Studio 2015 after installing both the NuGet Tobii Stream packages.

    I assume the above mentioned code was the one you referred?
    If you could kindly provide more detail with respect to your IDE I can
    try to reproduce your error. Many thanks.

    Did you try running the headtracking samples with the Interaction API?

    #7732
    Chou
    Participant

    Yes I also use VS2015 with Tobii Stream packages 2.02 from http://developer.tobii.com/tobii-core-sdk/
    and same sample code, added #include <string.h>

    It’s work well when using eye tracking mod and gaze tracking mode(other sample code in stream_engine),
    but with head tracking,it did’t return value.

    #7733
    Chou
    Participant
    #7734
    Chou
    Participant

    I also found an interesting thing, every time I plug in my 4C it need be initialized by Tobii EyeX Interaction(Tobii.EyeX.Tray.exe)
    ,otherwise it didn’t work in any mode,even in gaze tracking. after start EyeX program, it begin to work(even then close that program it still work)
    So, I think if this is because problem when initialize 4C tracker that cause the head tracking didn’t work.
    Is that necessary to initialize 4C every time it works?
    Is their any other way to initialize 4C?

    #7737
    Grant [Tobii]
    Keymaster

    Hi @chouweizhong, thanks for the further details.. I am trying to find other cases of this issue.

    In the meantime, out of curiosity, do you have a head tracking enabled game that you can use to test that Head Tracking is actually working with your Tobii 4C Eye Tracker?

    #7739
    Chou
    Participant

    Sorry, I don’t have any game that can use head tracking, is there any other way to test my Tobii 4C Eye Tracker’s head tracking?
    Or you can suggest me any free game that can test this
    Thank you~!

    #7740
    Grant [Tobii]
    Keymaster

    Hi @chouweizhong, okay too bad.. hmm, certainly you can try to run the free Tobii Unity SDK @http://developer.tobii.com/tobii-unity-sdk/ which comes with intergrated support for head tracking.

    I know it’s not the SDK you want to target for, but it would be very helpful for us to know if the head tracking sample here also fails, many thanks.

    Don’t worry about setup, it’s relatively straight forward so I don’t anticipate you having problems in installing and running. Please let me know how it goes.

    #7752
    Grant [Tobii]
    Keymaster

    Hi @chouweizhong, any luck with the Unity SDK?

    #7755
    Chou
    Participant

    Sorry, new year vacation, I will try it as soon as possible when I back to school.

    #7773
    Chou
    Participant

    Hi, I have tried to use demo of Unity SDK;
    but it still not work at head tracking,

    I change the 3rd demo to this:

    //———————————————————————–
    // Copyright 2016 Tobii AB (publ). All rights reserved.
    //———————————————————————–

    using UnityEngine;
    using Tobii.Gaming;
    using UnityEngine.UI;

    /// <summary>
    /// Various settings and utilities to manage calibrations and the presence of the user
    /// </summary>
    /// <remarks>
    /// Referenced in the Eye Tracking Settings and Configuration example scene.
    /// </remarks>
    public class EyeTrackerSettingsMenu : MonoBehaviour
    {
    public Text TextViewUserPresenceStatus;
    public Text TextViewIsUserPresent;
    public Text TextViewDeviceStatus;

    void Update()
    {
    UpdateUserPresenceView();
    }

    /// <summary>
    /// Print the User Presence status
    /// </summary>
    private void UpdateUserPresenceView()
    {
    var userPresence = TobiiAPI.GetUserPresence();
    HeadPose headPose = TobiiAPI.GetHeadPose();
    TextViewUserPresenceStatus.text = userPresence.ToString();

    if (TobiiAPI.GetUserPresence().IsUserPresent())
    {
    TextViewIsUserPresent.text = headPose.Position.x + “, ” + headPose.Position.y + “, ” + headPose.Position.z;
    }
    else
    {
    TextViewIsUserPresent.text = “No”;
    }
    }
    }`

    User present is present, but value is NaN,NaN,NaN;
    I didn’t work at Unity before, but I think what I change has already working.
    But it didn’t return my head position.

    #7785
    Grant [Tobii]
    Keymaster

    Hi @chouweizhong, okay thank you for trying. This is certainly a very unusual issue which implies that there is likely
    some internal issue with your eye tracker and therefore necessitates a remote session and log collecting to diagnose, repair and possibly exchange the device if needs be.

    To that end, could you kindly get in touch with Tobii Tech Support directly @ https://help.tobii.com/hc/en-us/requests/new

    Thereafter they should be able to arrange a suitable time with you to connect with your system. My apologies for the inconvenience caused by this technical issue.

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.