Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Advice sought for setting up Opensesame/pygaze for use with Tobii X2-60 eye tracker

edited December 2015 in OpenSesame

Greetings compadres,

With extreme apologies for not having done some more homework before now, I'd like to ask if anyone has had success in integrating a Tobii X2-60 within an Opensesame experiment, and if so, if there was anything specific that needed doing to set up for the device to communicate successfully?

I'm trying to get a Tobii X2-60 working with Opensesame, in any way, shape or form, as soon as possible - I have one working day left before annual leave to try and and make some progress on this if at all possible. Naturally, I am at home at the moment so don't have the eye tracker to hand, but am trying in vain to try and get something sorted for tomorrow. In my last 30 mins today, I set up the X2-60, got it working with Tobii studio, got Opensesame installed on the PC and very briefly tried to run the eye-tracking template after selecting Tobii as the eye tracker in the pygaze init component. Unsurprisingly it didn't work, but I had to leave two minutes after testing it - apologies for not giving an adequate elaboration of "it didn't work" but I had no real time to investigate it. The experiment simply exited after trying to open the canvas, and OS didn't appear to report any errors. Setting the eye tracker to "dummy" worked 'fine'.
I would presume I have to get the tobii python bindings copied to the appropriate directory on the PC, which is running windows (much to my chagrin) so that will be my fist step tomorrow.

So, if anyone has any advice, it will be most gratefully received. Either way, I'll be trying to play catchup over xmas so I can get things moving as soon as I am back. Again, apologies for not thoroughly searching/researching first and asking later. If I'm successful tomorrow, I'll post an explanation and change to solved in case of future help with others.

Seasons greetings and thanks in advance for any replies.

neon

Comments

  • edited 8:49AM

    Hello everyone,

    Further to the above, I've taken another look at the Tobii eye tracker and pygaze plugin in opensesame, still to no avail. This is what I have done so far:

    1. Installed Openesesame 3.0.4
    2. Copied the python bindings (in a folder called tobii, containing a directory called eye_tracker_io, and init.py) from the Tobii analytics package to the OpenSesame directory
    3. Copied the pygaze example experiment, and set pygaze_init to use a tobii eyetracker.

    When I run the experiment with xpyriment backend, It stops immediately after showing the "preparing experiment" screen. The debugger doesn't seem to report anything important:

    Starting experiment as ExperimentProcess-6
    Expyriment (Python 2.7.10)
    Main file: C:\Program Files (x86)\OpenSesame\opensesame.exe (6a8b7f)
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    openexp.sampler._legacy.init_sound(): mixer already initialized, closing
    experiment.run(): experiment started at Wed Dec 23 14:46:58 2015

    When I run with psychopy backend, same result except debugger reports:

    Starting experiment as ExperimentProcess-7
    FreeType import Failed: Freetype library not found
    openexp._canvas.psycho.init_display(): waitblanking = True
    openexp._canvas.psycho.init_display(): monitor = testMonitor
    openexp._canvas.psycho.init_display(): screen = 0
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    openexp.sampler._legacy.init_sound(): mixer already initialized, closing
    experiment.run(): experiment started at Wed Dec 23 14:50:00 2015

    I suspect I have done something wrong with copying the tobii Python bindings. Have I put them in the correct place? There were other files in the tobii analytics zip folder. There is a directory called 'python27', and inside that are directories 'modules' and 'samples'. Inside the 'modules' directory there are a bunch of files (tetio.pyd and some DLLs) which I copied to the toplevel of the Opensesame directory, and a directory called 'tobii' which contains init.py and eyetracker.io; I copied this directory also to the top level of the Opensesame directory.

    This was educated guesswork (having read another thread where someone discussed using another tobii eye tracker with OpenSesame), so if I have not done the correct thing, I'd be really grateful if someone could shed some light!

    Thanks in advance!

    neon

  • edited 8:49AM

    Hi Neon,

    Judging by the number of apologies in your first post, you probably realize that asking for last-minute advice one day before a deadline is not a great idea!

    That being said, @esdalmaijer has a description of how to install the Python bindings for Tobii here:

    When applying this to OpenSesame, the main thing to know is that the OpenSesame program folder is in the Python path; therefore, instead of copying libraries to (say) C:\Python27\Lib\site-packages, you would simply copy them to the OpenSesame program folder.

    I don't have any experience with Tobii myself, but this may help you to get started.

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 8:49AM

    Hi folks,

    Thanks, Sebastiaan - I had previously taken a brief look at the link you sent, which was indeed helpful.

    As you suggested, I had copied the libraries to the top level of the OpenSesame folder, but was still unsuccessful (same symptoms as described above).
    I should get some more time over the next couple of days to work on this, so hopefully will be able to find a solution, and will post any discoveries.

    Unfortunately I'm not very familiar with debugging in Python so will be trying to get to speed on this as soon as possible! It makes it more difficult that there don't appear to be any error messages (although maybe I'm missing something!) so I will have to dig deeper.

    Of course, any suggestions from anyone else very gratefully received.

    Thanks so much to all,

    Neon

    PS. Yes, requesting last-minute advice was not my best moment :-s . I probably I should have emphasised that it was a 'self-imposed' deadline (or not metioned it at all!)

  • edited 8:49AM

    Hello everyone,

    I've been able to pick up from where I got to before xmas with the above. I've made some progress but I have run in to a problem again unfortunately.

    So, when I run the eyetracking template (after selecting tobii as the eye tracker), the project terminates after trying to start, with the error:

    ImportError: No module named Image

    (which the traceback shows eminates from "\dist\pygaze_eyetracker\libtobii.py", line 66)

    I assume the module Image is is part of PIL, which appears to be included in the install -- I am using the single-file installer for OpenSesame3.05.
    When I run 'print(modules())' from the debug window is says (amongst the other module info):

    PIL is available (version is unknown)

    Does anyone have any thoughts on what might be causing this problem? If no one has any clues on this, I was thinking of trying to download everything and run from source - does this sound like a good/bad idea?

    Thanks very much in advance for any comments or suggestions.

    Neon

  • edited 8:49AM

    Hi Neon,

    This is due to an incorrect import of PIL. Previously, PIL contained a hack that allowed imports like this:

    import Image
    import ImageDraw
    

    But the safe, and in some installations only, way to do it is like this:

    from PIL import Image
    from PIL import ImageDraw
    

    If you edit libtobii.py and change these import statements, this error should go away. Let me know.

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 8:49AM

    Thanks, Sebastiaan - success :-)

    As the pygaze plugin contains byte compiled files when you use the one-file OpenSesame installer (Windows ver), I removed the libtobii.pyc file, and replaced it with an edited version of the source file (with the changes that you suggested), which I downloaded from github.

    Restarting OpenSesame, the eye tracker template seemed to work fine, which I was very pleased about! Now I just have to work on interpreting the results file and porting over some experiments...

    Please let me know if this wasn't the best way of going about things with the libtobii file! If it does sound reasonable, I'll make a post with details of everything I did to get things up and running.

    Thanks,

    Neale

Sign In or Register to comment.