- 25/02/2015 at 20:41 #2616
I am new to Tobii’s development software and Forums so I am not sure if this is the right place for this question, but here goes. I am trying to use the Tobii Analytics SDK to allow my vb.net program to receive data from a PC EYE GO Tobii device and I am running into some problems.
I browse for the device via the EyeTrackerBrowser class and connect to it via IEyeTracker class and have managed to get thus far with no issues.(I assume this because I am receiving the PCEye Go device info and I am displaying it in a textbox and I am not triggering any connectionEerror events, so i am assuming it works properly. Additionally if I unplug the the PC Eye Go from the computer it only then triggers a connectionError event).
My problem starts when I try to start tracking the device to receive data from it using the IEyeTracker.startTracking() method. The program bugs out and I receive an error message saying “Tracker Exception 20000505”. The Tobii Analytics SDK Developers Guide says that the error means that, and I qoute: “The operation cannot be completed without further authorization.”
Anyone know what that means and/or what I am doing wrong over here? Is there a step I missed that I must do before I can begin tracking? Is it something else?
I will post all the code at the end of this post.
Thanks in advance for any help,
My Device’s Information that I am getting in the TextBox:
Product Id: PCEGO-03……
Given Name: PCEye_Go
Firmware Version: 126.96.36.199095.20140325.1225.root
And here is my code:
Option Explicit On Option Strict On Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Imports Tobii.EyeTracking.IO Public Class Form1 Dim connectedTracker As IEyeTracker Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Library.Init() Dim _browser As EyeTrackerBrowser = New EyeTrackerBrowser AddHandler _browser.EyeTrackerFound, AddressOf EyeTrackerFoundHandler Try _browser.StartBrowsing() Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub EyeTrackerFoundHandler(sender As Object, e As EyeTrackerInfoEventArgs) Try Dim currentDevice As String Dim info As EyeTrackerInfo = e.EyeTrackerInfo Dim sb = New StringBuilder() sb.AppendLine("Model: " + info.Model) sb.AppendLine("Status: " + info.Status) sb.AppendLine("Generation: " + info.Generation) sb.AppendLine("Product Id: " + info.ProductId) sb.AppendLine("Given Name: " + info.GivenName) sb.AppendLine("Firmware Version: " + info.Version) TextBox1.AppendText(sb.ToString) 'create connection 'info.Status connectedTracker = info.Factory.CreateEyeTracker() AddHandler connectedTracker.ConnectionError, AddressOf ConnectionErrorEventArgs AddHandler connectedTracker.GazeDataReceived, AddressOf GazeDataRecievedHandler 'start tracking connectedTracker.StartTracking() If TextBox1.Text <> "" Then currentDevice = TextBox1.Text End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub ConnectionErrorEventArgs(sender As Object, e As ConnectionErrorEventArgs) MsgBox(e.ErrorCode) End Sub Private Sub GazeDataRecievedHandler(sender As Object, e As GazeDataEventArgs) Try MsgBox(e.GazeDataItem.Timestamp) Catch ex As Exception MsgBox(ex.Message) End Try End Sub End Class27/02/2015 at 09:53 #2622Jenny [Tobii]Participant
The problem you see is a compatability problem. Since I do not know what kind of application you are implementing I will give you a summary of the options you have below.
The Analytics SDK is compatible with the following high tier research eye trackers: Tobii X60/120, Tobii T60/120, Tobii T60 XL, Tobii TX300 and the Tobii X1/X2.
The Tobii PC Eye Go eye tracker is compatible with the following SDK’s: Tobii TecSDK, Tobii EyeX SDK and Tobii Gaze SDK.
What SDK or eye tracker you need depends on what kind of application you want to develop.
The Analytics SDK license allows for developing analysis and research kind of applications that process data from Tobii hardware and software, where eye-gaze data may be stored locally and later be processed and analysed.
The Tobii TecSDK license allows for developing AAC (Augmentative and Assistive Communication) applications for Tobii hardware. For example, with this SDK you can create an eye controlled application that uses eye-gaze dwell to click on buttons.
The Tobii EyeX SDK and Gaze SDK licenses allow for developing eye-gaze interaction applications for Tobii hardware. This include AAC but exclude analytic applications. For example, with these SDK’s you can create an application or game that uses eye-gaze as an input for interaction (often in combination with keyboard, mouse or some other input device), and you may filter the eye-gaze data live dynamically to achieve the interaction you want, but you may not store and then later analyse the eye-gaze data. The EyeX SDK is the high-level SDK for eye-gaze interaction applications that should be able to co-exist with other gaze-enabled applications running simultaneously on the computer, the Gaze SDK is a low-level special purpose SDK for stand-alone applications.01/03/2015 at 22:54 #2634
Thank You very much for your reply. I have now begun developing a program which will be a specialized keyboard and i am using Eyex to make the buttons click-able using the EyeX tracker, to enable the user to type with his/her eyes using the EyeX Engine. The end game is to mimic the keyboards that come included with a MyTobii and the SonoKey. However I have run into a problem with my project.
I am writing the program in VB.net because the specialized keyboard has already been built in VB.net and I am just adding the EyeX eye tracking interface and usability to the program to enable the user to type with their eyes. I have successfully created an EyeXhost and a FormsEyeXHost and have been able to connect to the device and pull in data form it. I have tested this by successfully obtaining the users eye location using the CreateEyePositionDataStream() method amongst other methods I successfully tested.
My problems begin when I try to create and add a BehaviorMap() to my project and link the BehaviorMap to the EyeXHost and then add a button to the BehaviorMap and make the button clickable using the EyeX SDK.
I found the example in the developers manual how to do this in C# and have tried converting it to VB.NET but encounter an error in the Behaviormap.cs file of the EyeXFramework.dll. First when I run the program it gives me a warning saying that the behaviormap.cs source file is different from when the module was built. Then for some reason It throws a “NullReferenceException was unhandled by user” when trying to add behaviormap object I created to the “Components” container. The IContainer called “Components” is equal to null.
A little background about what I have done to get this far. The EyeXFramework only came in binary so in order to get a usable Dll file a could import as a reference in my program I built and ran one of the included example which created the EyeXFramework.dll file which I use in my program. Also the behaviorMap object was not added to the toolbox when I added the EyeXFramework.dll file to my project so I added one manually in the form code and designer.
I am including my code at the end of this post. Any help would be greatly appreciated.
Here is the Program Class:
Option Strict On Option Explicit On Imports EyeXFramework Imports Tobii.EyeX.Client Imports Tobii.EyeX.Framework Imports EyeXFramework.Forms Public Class Program Private Shared _eyeXHost As New FormsEyeXHost() Public Shared ReadOnly Property EyeXHost() As FormsEyeXHost Get Return _eyeXHost End Get End Property <STAThread> Private Shared Sub Main() _eyeXHost.Start() Application.EnableVisualStyles() Application.SetCompatibleTextRenderingDefault(False) Application.Run(New Form1()) _eyeXHost.Dispose() End Sub End Class
Here is the Form Code:
Imports EyeXFramework Imports Tobii.EyeX.Framework Imports EyeXFramework.Forms Public Class Form1 Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Program.EyeXHost.Connect(_behaviorMap1) _behaviorMap1.Add(Button1, New ActivatableBehavior(AddressOf OnButton1Activated)) End Sub Private Sub OnButton1Activated(sender As Object, e As EventArgs) Button1.PerformClick() End Sub End Class
And here is the form designer
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer Private _behaviormap1 As EyeXFramework.Forms.BehaviorMap 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(96, 93) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(284, 262) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) Me._behaviormap1 = New EyeXFramework.Forms.BehaviorMap(Me.components) End Sub Friend WithEvents Button1 As System.Windows.Forms.Button End Class02/03/2015 at 10:58 #2638Patrik [Tobii]Participant
The problem you’re experiencing is due to the fact that VB.NET project’s do not use regular Program.Main bootstrapping, but got it’s own application framework. If you put a break-point on line 16 (
_eyeXHost.Start()) you will se that the break-point is never hit.
To fix this you will have to do three things:
1. You’re not instanciating the components collection in your designer code. In the InitializeComponent method, add the following line at the top:
Me.components = New System.ComponentModel.Container()
2. Change the access modifier of the
Mainmethod in your
3. Turn off the VB.NET application framework and tell the compiler that the Main method is the application entry point. To do this, you open the project properties and untick the Enable application framework. After this is done, change Startup object from
Hope this helps.
/ Patrik02/03/2015 at 13:55 #2639
Thank you for your reply, i will try it as soon as possible. I have one question however. Is there any downside to disabling the built in application framework?02/03/2015 at 14:19 #2641Patrik [Tobii]Participant
You can read more about the built in application framework here. It should answer any questions you might have.
Patrik02/03/2015 at 14:20 #2642
Thank you for all your help.
- You must be logged in to reply to this topic.