Psychopy - tobiiT120 eyetracker connection

186 views
Skip to first unread message

Vinuthna L

unread,
Aug 6, 2014, 1:24:13 AM8/6/14
to psychop...@googlegroups.com
Hi,


  I am trying to connect  psychopy to tobiiT120 eyetracker. I installed tobiiSDk and created an experiment in psychopy through builder. I am able to get the text messaages from experiment but how can I see the eyes in tobii screen and capture eye movements.

Jose Luis Da

unread,
Oct 28, 2014, 11:49:10 AM10/28/14
to psychop...@googlegroups.com
Hi Vinuthna, 

I am trying to connect a tobii X120 to a psychopy experiment and I have problems too. The experiment runs, I am using the stroop demo from the Psychopy resources, but the eyetracker is not connected.

Did you solve your problems connecting your machine to psychopy? If so, what did you do?

Thanks,
jl

El dimecres 6 d’agost de 2014 7:24:13 UTC+2, Vinuthna L va escriure:

Sol Simpson

unread,
Oct 29, 2014, 8:57:19 AM10/29/14
to psychop...@googlegroups.com
Are you trying to run the stroop_eyetracking demo?  If so can you provide more info on what steps you follow, what does work, and what the literal issue you have is?

When the program exits, is there any error output in the PsychoPy2 IDE console?

Thanks very much,

Sol

Da, Jose Luis

unread,
Oct 29, 2014, 9:51:39 AM10/29/14
to psychop...@googlegroups.com
Hi Sol, thank you very much for the answer!

Yes, we are trying to run the stroop demo, but we use Psychopy as a library of python, not as the standalone application. I have attached two files that contain the output of two procedures I did.

In the first one, we are just executing the command "python stroop_lastrun.py" in the terminal. The stroop stimulus works, but when I print the output of "eyetracker.isConnected()" it says False.

In the second file, I have followed the directions I found in the Tobii SDK to add the path of the SDK to the terminal I am using. Those directions involve executing the following commands:
set PYTHONPATH=C:\tobii-analytics-sdk-3.0.83-win-Win32
set PYTHONPATH=%PYTHONPATH%;C:\tobii-analytics-sdk-3.0.83-win-Win32\Python27\Modules 
With this second approach, two windows are created, one of those is the stroop stimulus, but the second one is completely blank and it freezes python making impossible to continue the stroop experiment.

I believe the errors I got come from the following lines
# Create an ioHubConnection instance, which starts the ioHubProcess, and informs it of the requested devices and their configurations.
    io=ioHubConnection(io_config)

What do you think? Do you have any advice? How do you run it? Do you think that it could be something wrong with the iohub library in my Psychopy installation? Do I have to change anything from the tobii_std.yaml file?

Any help will be very much appreciated!
jl

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/DWq2dixl7ek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/eef41903-0a2f-4a37-9c34-9bee184f3677%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

2_eyetracker_test_log_error_pythonpath_changed_to_add_SDK_path.txt
1_eyetracker_test_log_error_experiment_worked_but_eyetracker_not_connected.txt

Sol Simpson

unread,
Oct 29, 2014, 10:23:51 AM10/29/14
to psychop...@googlegroups.com
Hi jl,

1) You definitely need to setup the Tobii SDK as you did for the second test.

2) Delete any .hdf5 file that is in the test script directory; seems you have an old file that is incompatible with the newer version of iohub that is now running. That will fix the error you get shown in "2_eyetracker_test_log....txt".

3) Check your process list and make sure no unexpected instances of python.exe are running. If they are, kill them. What version of the psychopy package are you running BTW?

4) Regarding the two windows you mention, the second window is the tobii calibration graphics window. It should be displayed first, then after calibration is done, it should close and reveal the psychopy stroop window. Please let me know what you see (if anything) on the tobii calibration graphics window. Try pressing ESC to get that window to close if you see nothing so you can atleast finish the test without having to kill things.

5) You are using an X120? Does that use a network or USB interface to the psychopy computer? Does it support 120 Hz? In the tobii_std.yaml file, there is a line that tells the tobii to run at 120 Hz. You could try changing this to 60Hz if the tobii model you are using does not run at 120. This difference should just give a warning though, not cause an exception at runtime.

Please send updated terminal output text after factoring in the above. 

Thanks again,

Sol

Da, Jose Luis

unread,
Oct 29, 2014, 11:55:33 AM10/29/14
to psychop...@googlegroups.com
Hi Sol, thanks for your answer.

Here is an update to the modifications:

1) If we set the python path to add the Tobii SDK, as we did for the second test, does it matter that this SDK folder is in the C:\ folder and not in the site-packages within python27?

2) We have now deleted the hdf5 file. Now, the errors do not appear. (But see attached for new errors)

3) We are running the version PsychoPy-1.81.00-py2.7.egg. It is in the folder "C:\Python27\Lib\site-packages" and the demos we tried have worked.

4) The tobii calibration graphics window is completely blank. I do not know which of the windows is created first, but the tobii calibration graphics does not allow me to see the other one. The tobii eyetracker does not show any infrared light until we press a key, space for example, while the blank tobii calibration graphics window is on top. If we press ESC right after the SPACE bar, the two windows close and the infrared lights turn off. If we wait to press the ESC key after the SPACE bar (30 seconds to 2 minutes), the blank window does not close (we have to kill the cmd terminal), instead it is the other window, the stroop window, the one that closes.

5) The Tobii X120 works at 120Hz. We have not tried to change it to 60Hz.

In the attached files, we have attached the yaml config files we used. 
tobii_std.yaml - is the one we used for the outputs 3 and 4.
iohub_config2.yaml - we used for the output 5 

The outputs differ in the following ways:
In the 3.txt, we pressed the SPACE bar and right after the ESC key.
In the 4.txt, we pressed the SPACE bar and we wait 1 minute  for the ESC key.
In the 5.txt, we changed the config file to iohub_config2.yaml and it crashed immediately.


It is also possible that there is an error in the config yaml file.


Thank you very much
jl




4_eyetracker_test_log_error_pythonpath_add_SDK_path_delete_hdf5_window_close_after_SPACE_ESC_wait_1min.txt
iohub_config2.yaml
tobii_std.yaml
5_eyetracker_test_log_error_pythonpath_add_SDK_path_delete_hdf5_iohub_config2_yaml_window_closed_automatically.txt
3_eyetracker_test_log_error_pythonpath_add_SDK_path_delete_hdf5_window_close_after_SPACE_ESC.txt

Sol Simpson

unread,
Oct 29, 2014, 8:08:17 PM10/29/14
to psychop...@googlegroups.com
Hi again,

1)  If we set the python path to add the Tobii SDK... does it matter that this SDK folder is in the C:\ folder ...?

It does not matter where the Tobii SDK is in your file system. What matters is that its location is added to your python path, as you did in the second example.

4) The tobii calibration graphics window is completely blank. 

From the error in 3 and 4 logs, it is not surprising you see nothing in the calibration window; the graphics drawing is crashing. ;(
I think the issue is that you seem to be using a demo project from the ECEM 2013 workshop, and the current version of the tobii config settings is not compatible with the version from summer 2013.  
If you try using the stroop eye tracking builder demo from the latest Psychopy release (1.81 or later), found in psychopy\demos\builder\iohub\stroop_eyetracking of the psychopy package, does it run OK?

iohub_config2.yaml - we used for the output 5 

So updating the tobii config gets around the missing stimulus attribute key issue (*), but the updated config file has the Keyboard device name as 'kb', not 'keyboard', which is what the tobii calibration code expects. This is a known bug that I really should fix some day. For now, just make sure that your keyboard device name is 'keyboard'  in the iohub config file your experiment is using . i.e.:

    - Keyboard:
        name: keyboard

That should fix the issue you find in log 5, maybe you will be good to go with that change.

Let me know if you are still having errors. 

Thanks very much,

Sol

As a side note, iohub /should/ be handling the error seen in logs 3 and 4 by using the tobii default config settings and picking up that missing setting. The default settings for a device are in a file in the source folder of the device in question. For the tobii that would be the psychopy\iohub\devices\eyetracker\hw\tobii\default_eyetracker.yaml file in the psychopy package. The fact you are getting an error suggests that I need to look into why that is not working in this case.

Da, Jose Luis

unread,
Oct 30, 2014, 11:00:31 AM10/30/14
to psychop...@googlegroups.com
Hi again Sol, thank you for your response.

Yes, we were using the stroop demo from the ECEM workshop, now we are using the one that comes with Psychopy 1.8, and this is what happens:
- The tobii calibration graphics window appears and it shows a message that says "Press SPACE for starting the calibration and ESC to close it" and it also shows three horizontal bars at the bottom (see attached image). (We hadn't seen this before. Progress!)
- On these horizontal bars, several circles appear and change their position when I rotate my head from side to side; thus the eyetracker is connected.
- When SPACE is pressed, nothing changes, the same window remains with the same message and the same moving dots. Importantly, no calibration protocol appears to begin. 
- Then, when ESC is pressed, this window closes, and the stroop stimulus window is visible with the instructions.

The files attached are output files we got and the image of the calibration window.
For the output file 7.txt, we used the new stroop demo (Psychopy v 1.8), its corresponding config yaml file, and we installed pygame.
For the output file 8.txt, we used another computer with the new stroop demo (Psychopy v 1.8). 


Thank you very much
jl 

2_eyetracker_test_log_error_pythonpath_changed_to_add_SDK_path.txt
8_different_computer_Win8_no_errors_but_no_calibration.txt
tobii_graphical_calibration_window.jpg

Sol Simpson

unread,
Nov 3, 2014, 2:09:52 PM11/3/14
to psychop...@googlegroups.com
Sounds like there is an issue in the iohub tobii calibration logic , likely caused from the changes to the iohub keyboard device and event field definitions in 1.81. I will look into this and get back to you soon. Sorry about the delay.

Sol Simpson

unread,
Nov 3, 2014, 5:02:51 PM11/3/14
to psychop...@googlegroups.com
I have (I think) fixed a bug that I introduced in psychopy 1.81 that is causing the tobii calibration issue you have found. 

Can you update your psychopy source in your site-packages to use the fix. Either use what is currently on https://www.github.com/isolver/psychopy, or wait until tomorrow and get the updated source from https://www.github.com/psychopy/psychopy once Jon accepts the pul request.

Let me know if this fixes the issue for you.

Thank you!

Sol

Da, Jose Luis

unread,
Nov 4, 2014, 11:59:05 AM11/4/14
to psychop...@googlegroups.com
Hi Sol, thank you for your time as it has really helped. 

The problem is solved! Now the calibration procedure works with no issues in the Stroop demo and also in the gcCursor demo, so thank you! What was the problem (if it is simple to explain)? 

FYI, a few demos did not work:
- When running the sample 'selectTracker', the calibration worked and no error appeared. However, after the calibration, when the experiment window asked for a SPACE to start a trial, the window froze and I had to kill the terminal.
- When running the sample 'validation.py', calibration worked but after the calibration window closed, nothing else appeared. The errors from the terminal are attached in the text file "10_validation....txt".

With regard to the structure of the code, is it necessary to write all of the code inside the 'run' method of the 'ExperimentRuntime' class (for example, see gcCursor)? Could I move that code into a 'main' function?

Again, thank you!
jl

--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/DWq2dixl7ek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
10_validation_psychopy1.81.02_output.txt

Sol Simpson

unread,
Nov 4, 2014, 6:28:07 PM11/4/14
to psychop...@googlegroups.com
Thank you for the update and the extra bug reports. ;)

The issues you have been fining stem from some changes that were made to the iohub keyboard device's event fields starting in version 1.81. These changes were made so that the iohub keyboard event 'key' field would basically match what psychopy currently provides for key name mappings, which makes sense from a long term POV. However the change was also incompatible with older scripts, and parts of iohub that internally used keyboard events. Apparently I did not update every iohub demo, and some parts of the iohub code itself, to work correctly with the new keyboard event format. ;(

I am away the next week, but will address the issues you have identified when I am back.

 is it necessary to write all of the code inside the 'run' method of the 'ExperimentRuntime' class (for example, see gcCursor)? Could I move that code into a 'main' function?

You can use the launchHubServer(....) function to get access to the same object as self.hub in the ExperimentRuntime class, and then use this within your script. The doc string for the launchHubServer() function (which is in psychopy/iohub/client/__init__.py file) should help explain how it can be used. When working with an eye tracker, it is easiest (I find) to still use the iohub_config.yaml file to define the device settings, and pass this file name as a kwarg to the  launchHubServer function. 

I can send further details when I am back next week if needed.

Thanks again,

Sol

Sol Simpson

unread,
Nov 11, 2014, 11:04:17 AM11/11/14
to psychop...@googlegroups.com
The following issues you found have now been fixed:

FYI, a few demos did not work:
- When running the sample 'selectTracker', the calibration worked and no error appeared. However, after the calibration, when the experiment window asked for a SPACE to start a trial, the window froze and I had to kill the terminal.
- When running the sample 'validation.py', calibration worked but after the calibration window closed, nothing else appeared. The errors from the terminal are attached in the text file "10_validation....txt".

Please give it a day or so before the code changes make it into https://www.github.com/psychopy/psychopy

Note that if using PsychoPy2 Standalone, you need to update the version of 'six.py' in the psychopy2 site-packages folder. See this post for more details.

Thank you.

On Tuesday, November 4, 2014 11:59:05 AM UTC-5, Jose Luis Da wrote:
Reply all
Reply to author
Forward
0 new messages