Question about visual feedback connection

Come here to discuss about OpenViBE in general!
Post Reply
AnnaV
Posts: 3
Joined: Fri Apr 16, 2021 6:19 am

Question about visual feedback connection

Post 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

Thomas
Posts: 69
Joined: Wed Mar 04, 2020 3:38 pm

Re: Question about visual feedback connection

Post 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

AnnaV
Posts: 3
Joined: Fri Apr 16, 2021 6:19 am

Re: Question about visual feedback connection

Post 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

Thomas
Posts: 69
Joined: Wed Mar 04, 2020 3:38 pm

Re: Question about visual feedback connection

Post 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

Post Reply