PDA

View Full Version : Implement LabJack


ursi
12-17-2009, 02:43 PM
Hi, I'm new in working with vizard and not that familiar with python yet.

What we want to do is to send an event trigger out of vizard (keydown event) to a data collection program so that we can synchronize our recordings with the event occurred in our virtual world.

As far as I know, using LabJack to send a voltage signal out would be the best solution and so to directly connect with the AD transducer.
May you help me implementing LabJack in our 'World' code?

What we want to do is to move the room relative to the global system on a keydwon event. So, for our data analysis we need know the exact time of this event relativ to our data recordings:

--------------------
def onkeydown(key):
if key == 't':
# ANIMATION PATH (to move the room itself)
...
...
vizact.ontimer(0.1,pathFWBWs.play)

# HERE WE WANT TO SEND OUT OUR TRIGGER EVENT TO LABJACK...

viz.callback(viz.KEYDOWN_EVENT,onkeydown)
--------------------

Thank's for your help!

Jeff
12-18-2009, 01:31 PM
Here is a link for using Labjack with python code.

http://labjack.com/support/labjackpython

ursi
01-04-2010, 10:49 AM
We have LabJack U12, what's about this device? Can we just replace ue9 by U12 in the following code?

For UE9:
>>> import ue9
>>> d = ue9.UE9()
>>> d.commConfig()
{'IPAddress' : '192.168.1.209'
...,
}

ursi
01-07-2010, 01:54 PM
Hi, thank's for the link.

I tried to import u12 with the following code:
-----------
import u12
d = u12.U12()
d.eAnalogOut(2.2, -1)
-----------

But vizard can not find the module u12. Where can I find this module?

The eAnalogOut function is defined here (Link from LabJack support):
http://github.com/labjack/LabJackPython/blob/master/src/u12.py#L81

Thank's for your help!

Jeff
01-07-2010, 03:14 PM
The link you gave is for the u12.py module. You could either copy that code and save it as u12.py or you could follow the link for download source on that page and save a zipped file with all the labjackpython related files including u12.py