View Full Version : Reading sensor data via UDP

08-24-2010, 10:47 AM
I have an EEG system I'd like to use to send data to vizard over our network. The issue is that the only way to do this is by having the software associated with our system send UDP packets. We've tried using a combination threading and UDP in python to parse the packets, however it seems to run very slowly in vizard. The other option we are considering is creating our own sensor plugin using visual C++ that would handle the network communication in it's own thread. The assumption is that this might be a more reliable way for vizard to read the data streaming in. Can anyone verify that this might be the correct way to proceed?

Essentially the flow of the data looks something like this:

EEG System --> BCI2000 Software ---> Network (UDP) ---> Vizard

Unfortunately UDP is our only option and we are trying to find the most reliable method of transmitting the data to vizard. We are using a dedicated switch to minimize latency and packet loss. When our UDP thread runs in vizard it's just incredibly laggy compared to when running in python without vizard. We've been printing the packets to the command window as they come in to get an idea of the timing, which I understand is not optimal. Perhaps someone could suggest a better way of measuring any delay that might be caused by the vizard engine as well.

Thanks much.

08-24-2010, 10:51 AM
Try adding the following line to your script:viz.directormode(viz.DIRECTOR_FAST)
This essentially tells Vizard to allow Python threads to run while rendering the scene, which should give more time for your Python thread to run.

If this doesn't help, then there might be some other issue with your code. In this case it would help if you posted some of your code.