I am completely new to PsychoPy, so apologies if I’m asking obvious things, however nothing jumped out at me in the help files / forum searches / googling. What I’m hoping to find out is whether PsychoPy can solve my particular issue, and so would be worth investing a lot more time into working with the program in order to actually make it work.
I’m currently designing a series of experiments which are actually presented and controlled using a 3D gaming engine (Unity). This Unity-created experiment communicates via UDP with a helper app, coded in Python, for various purposes. In particular, event codes are sent from Unity to the Python app, which then forwards them to other experimental hardware.
Ideally, the code would be sent as close as possible to the beginning of the first screen refresh of the event, and if latency is unavoidable this should be as constant as possible. If I understand correctly, the standard solution implemented by various software packages (PsychoPy, Vision Egg, Eprime, etc) is to prime the code to be sent as soon as the next vertical refresh occurs. And in psychopy, this involves waitblanking being set to true, so that win.flip commands will essentially pause processing until this flip occurs.
So in the simplest case that I can see, Unity prepares a frame, sends the event code to Python, Python then waits until the next screen refresh and sends the code immediately after this.
However, to complicate matters, the Python app is also running various other threads, in particular checking for messages over a serial port which are coming in at 300hz, so much faster than a screen refresh (these are standard 60Hz monitors). If this is the case, am I going to get serious issues with waitblanking?
It does not strike me as a problem if the entire app “pauses” while waitblanking is doing its thing. Any incoming serial messages will be stored in the system buffer, and can be read once waitblanking is finished. It’s also not a problem if the other threads keep running as usual while just the thread handling the event code communication pauses to wait for the next blank. But… I am aware these are very dangerous waters, and I definitely lack some experience here, so any advice/comments would be appreciated.
On a related but side note: If I understand correctly, under the best of all possible circumstances, anyone using a consumer-grade monitor should expect up to 10ms jitter when using waitblanking (or any similar methods used by Vision Egg or Eprime or whatever). Is this correct? Can nothing be done without going back to CRTs?