Page 1 of 1

Question about visual feedback connection

Posted: Mon May 17, 2021 6:12 am
by AnnaV
Hello!

I am creating a neurofeedback study at my university (I had posted already with questions about getting it started). We are nearly finished with the EEG signal pipeline! Basically, we are teaching people to control their alpha activity by moving a bar up and down on a screen.

I have created a bar in Unity that can move up and down, but have not added any script to control the movement (to unity or openvibe). So, I am hoping to find the easiest and best way to get openvibe to interact with unity. I had a look at the TCP boxes and am still a bit confused. I found the .xml for the tcp writer box, but the application that goes with it appears to be missing. Would using these boxes be the best way to go about this? It looks like there are a few ways to do this. I can see that if I use the external processing box with the file path to my unity application, it will open when I run my openvibe scenario, but that is as far as I have gotten.

Any help would be appreciated! I am very new to all of this.

Thanks,
Anna

Re: Question about visual feedback connection

Posted: Mon May 17, 2021 10:41 am
by Thomas
Hi Anna,

In order to connect Unity to OpenViBE, you can absolutely use the TCP writer box.
The program that goes with the tcp writer box scenario is called "openvibe-examples-openvibe-to-tcpip.cmd" and should be present in your install folder (by default in C:\Programmes\openvibe-x.x.x-64bit\).
The script launches an executable whose code is extras/applications/examples/openvibe-to-tcpip/src/tcpip-client.cpp. Of course this client is written in C++, but gives an idea on how to handle incoming data.

For C# TCP implementation, you can have a look at this implementation and add the OpenViBE specific to it.

Another option to communicate with Unity is to use the LSL protocol. You can use the LSL export box in order to send data to Unity.

Example of how to receive OpenViBE data in Unity can be found here.

Hope this helps,

Thomas

Re: Question about visual feedback connection

Posted: Thu May 20, 2021 12:48 am
by AnnaV
Hi Thomas!

(edited because we figured out what we did wrong initially)

Thanks so much for your reply. It does look like the TCP boxes are the way to go here. On the unity end, I added the TCPTestClient.cs script to my unity project object. I then set up the TCP boxes in OV (clock stimulator > TCP writer stimuli to TCP; and the EEG pipeline ending with TCP writer signal to TCP). I changed the ports to match as well and it looks like they are communicating!!

My new question now is whether there is a way for OV to send whole numbers to unity (instead of as a package)? Or will the unpackaging will need to be done from the unity end of things?
In the best case, we are hoping for OV to be able to send unity a whole number that will determine how much our feedback bar will move.

Thanks for all your help!
Anna

Re: Question about visual feedback connection

Posted: Wed May 26, 2021 9:07 am
by Thomas
Hi Anna,

If you want to send a floating point value to unity, rather than a stimuli, you can do it with the TCP Writer box by changing its input type.

To do so, right-click on the TCP Writer box and select inputs->input 1->configure...
In the configure menu, you can change the type to signal.

Note that after doing this, you need to feed the TCP Writer box with a signal and not stimulations anymore.
Please see the documentation page for the parsing of signal data.

Cheers,
Thomas