FSettingValueAutoCast function and other questions

Making & changing box plugins and external apps
Post Reply
DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

FSettingValueAutoCast function and other questions

Post by DarkPatate »

I have a question about the FSettingValueAutoCast function. I don't found its page in the documentation.

What this function returns for a stimulation ? If I well understand, a Stimulation is defined by three things: the code, the date and the name. If it's right, the FSettingValueAutoCast function returns which ones ?

Thanks in advance.
Siméon.

[EDIT]
I have two questions more (a question and a problemn, more precisely). The function for initializate an Encoder/Decoder is :

Code: Select all

m_oSignalDecoder.initialize(*this, 0);
What is the meaning of the 0? The Output/Input id ? Because I don't find the answer here: http://openvibe.inria.fr/tutorial-1-imp ... ssing-box/

And I have a probleme to compile my box, the compiler throws an error :

Code: Select all

/home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp: In member function ‘virtual OpenViBE::boolean OpenViBEPlugins::SignalProcessing::CBoxAlgorithmSchmittTrigger::process()’:
/home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp:182:35: error: no matching function for call to ‘OpenViBEToolkit::TSignalEncoder<OpenViBEPlugins::SignalProcessing::CBoxAlgorithmSchmittTrigger>::encodeHeader(int)’
    m_oSignalEncoder.encodeHeader(0);
                                   ^
/home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp:182:35: note: candidate is:
In file included from /home/simeon/Logiciels/openvibe-1.0.0/toolkit/include/toolkit/ovtk_all.h:35:0,
                 from /home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.h:8,
                 from /home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp:1:
/home/simeon/Logiciels/openvibe-1.0.0/toolkit/include/toolkit/codecs/encoders/ovtkTEncoder.h:62:21: note: OpenViBE::boolean OpenViBEToolkit::TEncoderLocal<T>::encodeHeader() [with T = OpenViBEToolkit::TCodec<OpenViBEPlugins::SignalProcessing::CBoxAlgorithmSchmittTrigger>; OpenViBE::boolean = bool]
   OpenViBE::boolean encodeHeader()
                     ^
But I did the same thing as the tutorial.

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

Re: FSettingValueAutoCast function and other questions

Post by jtlindgren »

Hi DarkPatate,

the tutorial is out of date in this regard, and we should update it to 1.0 when we have the time.

In the new codec interface, initialize takes the input connector number for decoders
and output connector numbers for encoders. The encodeHeader() no longer needs
this number.


Best,
Jussi

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Ok, I'll test later :-)
Thanks!

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Hello,
after almost one month, I could change my code. But another error was coming :

Code: Select all

[ 97%] Built target openvibe-acquisition-server
CMakeFiles/openvibe-plugins-contrib-signal-processing.dir/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp.o: dans la fonction « OpenViBEToolkit::TBoxAlgorithm<OpenViBE::Plugins::IBoxAlgorithm>::processInput(unsigned int) »:
/home/simeon/Logiciels/openvibe-1.0.0/contrib/plugins/processing/signal-processing/src/schmittTrigger/ovpCBoxAlgorithmSchmittTrigger.cpp:58: définitions multiples de « ioIndexes »
CMakeFiles/openvibe-plugins-contrib-signal-processing.dir/src/ovp_main.cpp.o:/home/simeon/Logiciels/openvibe-1.0.0/openvibe/include/openvibe/plugins/ovIPluginObject.h:53: défini pour la première fois ici
collect2: error: ld returned 1 exit status
make[2]: *** [contrib/plugins/processing/signal-processing/libopenvibe-plugins-contrib-signal-processing.so.1.0.0] Erreur 1
make[1]: *** [contrib/plugins/processing/signal-processing/CMakeFiles/openvibe-plugins-contrib-signal-processing.dir/all] Erreur 2
make: *** [all] Erreur 2
I don't understand, the “...Trigger.cpp:58: définitions multiples de « ioIndexes »”, ioIndexes is only defined in ovpCBoxAlgorithmSchmittTrigger.h (outside the class). Moreover, in cpp file, on line 58, there are only the uninitialize function. Maybe it's another problem of version ?

Thanks in advance,
Siméon.
Attachments
ovpCBoxAlgorithmSchmittTrigger.h
(10.54 KiB) Downloaded 467 times
ovpCBoxAlgorithmSchmittTrigger.cpp
(10.96 KiB) Downloaded 476 times

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

Re: FSettingValueAutoCast function and other questions

Post by jtlindgren »

It looks like a problem with the global variable. I'd advice against using one. Consider putting it as a member instead.

Happy hacking,
J.

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Indeed, that was the problem, thank you !

[EDIT] But my box doesn't work. If I don't find find the solution, I'll be back ;-)

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Hello,
I have some difficulties to make my box working. I don't understand how the data are structured, because the online tutorial is different than the comment code generated by the SkeletonGenerator.

I understand the data as in the enclosed PNG file, is it right ? For me, the chunk are like the packet in TCP protocol. They are processed separately.

How can I get and set the data of a channel, to check the ith value, or modified it.

The designer give me the error :

Code: Select all

[ ERROR ] At time 0.000 sec <Box algorithm::(0x69147b45, 0x17d69263) aka Trigger> Caller tried to set a 0-dimensional matrix. Only 2-dimensional matrices are supported (e.g. [rows X cols]).
[ ERROR ] At time 0.062 sec <Box algorithm::(0x69147b45, 0x17d69263) aka Trigger> Buffer database reports an error. Its possible that the inputs given to the Signal Display are not supported by it.
Trigger is the display block just after my block. The process function code is almost the same as in my previous message.

Thanks in advance for your answers!
Attachments
openvibe.png
openvibe.png (35.49 KiB) Viewed 20536 times

gserrier
Posts: 71
Joined: Tue Apr 01, 2014 8:22 am

Re: FSettingValueAutoCast function and other questions

Post by gserrier »

Hi,

About the comparison with TCP is close to the reality. All chuncks are independent from each other, and mark with a timestamps (that replace the sequence number).

If the stream type is a signal (which derived from Streamed Matrix), the matrix is 2-dimensional [N x M] with N the amount of channel, and M the amount of sample by channel. In the case of the streamed matrix you can have a matrix of any dimension that you want.

In your code, when you encode the header, the matrix of your encoder is 0-dimensional. So OpenViBE prevent you from doing such operation. Before calling the header encoding, you should set to the right dimension your matrix.

nb:
If you are just modifying a signal without modifying it's deep structure, you can avoid heavy data manipulation (copy/paste) by using the set target reference mechanism, which work like this:

Code: Select all

m_oOutputMatrixEncoder.getInputMatrix().setReferenceTarget(m_oInputMatrixDecoder.getOutputMatrix());
With this mechanism, the matrix of both coder/decoder become a "shared" memory. So you don't need to copy/paste the matrix or even to set the dimension of the matrix.
Be aware that any modification to this matrix will lead to the modification of both matrix (as there are the same), so the previous value will be lost. So depending of your transformation, this mechanism should not be use.

Guillaume

PS: I do not know if your code is up to date, but you init the two encoder by binding them to the same output.
PSS: if you are using the version of the codec toolkit you are using, you just need to use the line

Code: Select all

m_oSignalDecoder.decode(i);

instead of

Code: Select all

m_oSignalDecoder.decode(ioIndexes.inputSignal, i);

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Thank you for your answer, the problem is solved!

To solve it, I used the

Code: Select all

m_oOutputMatrixEncoder.getInputMatrix().setReferenceTarget(m_oInputMatrixDecoder.getOutputMatrix());
, but if I don't want (not for this case) use it, how I "should set to the right dimension [my] matrix" in the header?

Two other questions: how throwing a stimulation?
And, what is the difference between stimulation and stimulations? Because, in the designer, the output of my box is a stimulation and the triangle is green and not purple as the others stimulations. However I used this type id:

Code: Select all

OV_TypeId_Stimulations
.

Thanks in advance!
Siméon.

[EDIT] Another question, does the epoching box influence the size of chunk?

gserrier
Posts: 71
Joined: Tue Apr 01, 2014 8:22 am

Re: FSettingValueAutoCast function and other questions

Post by gserrier »

Hi
DarkPatate wrote: but if I don't want (not for this case) use it, how I "should set to the right dimension [my] matrix" in the header?
Before calling the encodeHeader method, you will need to get the InputMatrix of the encoder and then, set the amount of dimensions and the size of each dimension of the matrix according to your needs.
DarkPatate wrote: Two other questions: how throwing a stimulation?
And, what is the difference between stimulation and stimulations? Because, in the designer, the output of my box is a stimulation and the triangle is green and not purple as the others stimulations. However I used this type id:

Code: Select all

OV_TypeId_Stimulations
.
Stimulation = One single stilumation / Stimulations = stimulation stream
The encoder of the stimulation stream has a StimulationSet. Each stimulation in this set is send when you use the markOutputAsReadyToSend primitive. Here is a example of how to fill it

Code: Select all

ip_pLabelsStimulationSet->setStimulationCount(1);
ip_pLabelsStimulationSet->setStimulationIdentifier(0, l_oStimulationIdentifier.toUInteger());
ip_pLabelsStimulationSet->setStimulationDate(0, l_ui64EndTime);
ip_pLabelsStimulationSet->setStimulationDuration(0, 0);
DarkPatate wrote: [EDIT] Another question, does the epoching box influence the size of chunk?
Yes, the size of a chunck will be modify. According to the code, it became SamplingRate * EpochDuration

Guillaume

DarkPatate
Posts: 47
Joined: Tue Apr 07, 2015 11:31 am

Re: FSettingValueAutoCast function and other questions

Post by DarkPatate »

Thanks for your answer :-)

But, I didn't well understand your explanation of the throwing stimulation(s?) method. What is the class of this objet : ip_pLabelsStimulationSet ? To check in the documentation the fonctions parameters. And how to get it from the skeleton code.

Thanks in advance,
Siméon.

gserrier
Posts: 71
Joined: Tue Apr 01, 2014 8:22 am

Re: FSettingValueAutoCast function and other questions

Post by gserrier »

Hi, sorry for the late reply

ip_pLabelStimulationSet is an object of the class TParameterHandler<IStimulationSet *>
http://openvibe.inria.fr/documentation/ ... ml#details => A TParameterHandler is a wraper around data type to help the manipulation of them. By using the operator '->', which is overload, you get a direct access to the data handle. (casting also work).

Here is the documentation of IStimulationSet http://openvibe.inria.fr/documentation/ ... onSet.html


Guillaume

Post Reply