LabView Box Development

Making & changing box plugins and external apps
Post Reply
traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

LabView Box Development

Post by traviskv »

Hello, all.

I am using OV v1.2.2 and trying to feed classifier output data to LabView via the TCP write function in OV. As of now, raw data fed into LabView from OV results in strange string entries. I would like to be able to write a box similar to the matrix display one (in that the matrix display box takes the probability stream and displays it as a probability between two choices) that outputs the translated stream data. Is this a feasible idea? If so, could anyone point me in the right direction?

I'm somewhat familiar with the skeleton generator, but I am not sure how to implement the boxes. I've got an IDE editing software and I am aware that I need to add the plugin information to an ovp_main.cpp file, but I am not sure how to access this file.

Thank you for your time.

-Travis

Thibaut
Posts: 144
Joined: Wed Oct 31, 2018 9:14 am

Re: LabView Box Development

Post by Thibaut »

If possible, go to the latest version of OpenViBE. Then, to code new boxes. You have to build your OpenViBE from the sources.
http://openvibe.inria.fr/build-instructions/
For the creation of new boxes, follow the documentation:
http://openvibe.inria.fr/documentation- ... umentation
Especially with the tutorials
http://openvibe.inria.fr/tutorial-1-imp ... ssing-box/
and
http://openvibe.inria.fr/tutorial-3-how ... -included/
Then you can take back the existing box and make the modicifications that interest you.

traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

Re: LabView Box Development

Post by traviskv »

Thank you for your reply.

I am using an Emotiv headset with legacy drivers (SDK v2.0.0.20) and, to my understanding, this limits me to using OV v1.2.2

Is my understanding correct? Does this limit me to developing in OV v1.2.2?

traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

Re: LabView Box Development

Post by traviskv »

I am going to go ahead and assume I need to develop in OV v1.2.2

I am familiar with those tutorials and I am trying to follow along, however I am quite inexperienced when it comes to developing applications in C++. I've obtained MS Visual Studios 2013 Express and I am using that as my editing/compiling software.

Now, I've got tons of questions in regards to the capability of boxes: the data types, encoders and decoders. Could anyone help me better understand the data leaving the classifier? My goal is to translate the output into a single digit value that will indicate the command being used.

Also, which ov_main.cpp file am I to add the header for the new box? I've noticed that there is more than one.

Thank you!

-Travis

jtlindgren
Posts: 778
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: LabView Box Development

Post by jtlindgren »

Hi Travis, writing boxes takes a bit of time getting familiar with the tutorials, playing around, getting intuition about specific questions.

I dont remember from the topof my head, but ov 1.2.2 Acquisition Server might be compatible with later versions of Designer. Simply install both versions on the same comp and try. If you can get signal and stimulations from the Acquisition Client box, it probably works.

Boxes can be registered in the ov main that corresponds to the dll library that will contain the compiled code. Thibaut recently wrote a related tutorial which he links to, above. That should help.


Cheers,
Jussi

traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

Re: LabView Box Development

Post by traviskv »

That is the conclusion I've come to, that learning to code in C++ may be a bit too much for me at this point. I am now focusing on developing in MATLAB using the "Matlab Scripting" box.

I've successfully extracted the "matrix_data" variable from "Probability values" of the Classifier box. "matrix_data" contains the probabilities of an incoming signal between the two choices registered with the Classifier. I've written a simple script to convert these values to a whole integer and then stored in a new variable called "score".

Now, I am trying to send the values stored in "score" to LabView via OV or MATLAB. My first attempts to do this involved opening a TCP connection within the matlab_Process.m script, but I received an error message in OV's command window. I tried to open the TCP connection in the matlab_Initialize.m script and it returned the same error in the OV command prompt.

Is it possible to pass the modified OV matrix_data (the value of the MATLAB "score" value) back to OV to be sent to LabView via the TCP write box? Is there a away of modifying the output of the box so that it is the value of the "score" variable?

Thank you for your time!

jtlindgren
Posts: 778
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: LabView Box Development

Post by jtlindgren »

Which error did you get? ;)

There should't be any reason I know of why you couldn't open tcp sockets from matlab scripts.

You can also output data from matlab scripts (score) to designer. See the tutorial scenarios we bundle.

Alternatively some hackery with simple dsp might be able to compute the same value, but you need to be a bit clever to split the matrix to two or more streams. Although not pretty, this can be achieved using several spatial filter boxes at the same time.

Cheers,
Jussi

traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

Re: LabView Box Development

Post by traviskv »

A MATLAB buffer error. I've attached a screenshot of it. I'm able to open a TCP client session on MATLAB, but for some reason fwrite() and write() are returning errors.

Are you referencing the tutorials available online under the topic of MATLAB? This is how you establish the box output, correct?

[box_out] = OV_setStreamedMatrixOutputHeader(box_in, output_index, nb_dim, dim_sizes, dim_labels) or something along these lines.

Would I replace the "dim_labels" variables with score? I've attempted to do this, but the entire structure seems to be getting sent through the TCP writer and I have yet to figure out how to decode that in LabView.

The spatial filter and DSP method sounds very interesting. Is the streamed matrix data composed of the channels mentioned above? box_in, output_index, nb_dim, and so on?

Thank you again for your time!

Travis
Attachments
openvibematlaberror.JPG
openvibematlaberror.JPG (72.65 KiB) Viewed 1501 times

traviskv
Posts: 15
Joined: Thu Aug 02, 2018 12:42 am
Location: USA

Re: LabView Box Development

Post by traviskv »

The lines I'm using in matlab_Initialize.m:

u = udp('localhost',5678)

fopen(u)

The line I'm using in matlab_Process.m:

fwrite(u,score)

These lines function perfectly fine while in MATLAB, however they do not function correctly when being accessed by OV. I believe that the object 'u' (the UDP client) is not being transferred correctly from the Initialize to Process files.

I tried putting the fopen(u) line in the Process.m file, but I received the same buffer error.

Post Reply