Home › Forums › Software Development › Headtracking on Tobii eye tracker 4C
- This topic has 21 replies, 5 voices, and was last updated 6 years, 7 months ago by Grant [Tobii].
- AuthorPosts
- 18/12/2017 at 16:10 #7705KenboParticipant
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?
18/12/2017 at 19:39 #7706Alex [Tobii]ParticipantDo you have Tobii EyeX or Tobii Eye Tracker 4C?
19/12/2017 at 07:36 #7711KenboParticipantI have The Tobii Eye Tracker 4C
20/12/2017 at 09:13 #7719ChouParticipantI also have same problem in Tobii Eye Tracker 4C ~~example of C code can’t work at all, it reprot TOBII_VALIDITY_INVALID
23/12/2017 at 23:34 #7729Grant [Tobii]KeymasterHi @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?
26/12/2017 at 05:17 #7732ChouParticipantYes 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.26/12/2017 at 05:51 #7733ChouParticipantI also try NuGet package 2.0.2.333 ,same as from http://developer.tobii.com/tobii-core-sdk/
https://files.update.tech.tobii.com/stream_engine/clients/c/2.0.2/consumer_stream_engine_windows_2.0.2.2335.zipdidn’t return any value in head track
26/12/2017 at 06:06 #7734ChouParticipantI 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?27/12/2017 at 14:10 #7737Grant [Tobii]KeymasterHi @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?
28/12/2017 at 07:37 #7739ChouParticipantSorry, 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~!28/12/2017 at 18:33 #7740Grant [Tobii]KeymasterHi @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.
31/12/2017 at 17:58 #7752Grant [Tobii]KeymasterHi @chouweizhong, any luck with the Unity SDK?
01/01/2018 at 03:42 #7755ChouParticipantSorry, new year vacation, I will try it as soon as possible when I back to school.
07/01/2018 at 05:49 #7773ChouParticipantHi, 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.08/01/2018 at 10:32 #7785Grant [Tobii]KeymasterHi @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.
- AuthorPosts
- You must be logged in to reply to this topic.