VRPN settings in external VR application

About the GUI application to design signal processing pipelines
Post Reply
ad3dia
Posts: 10
Joined: Sun Sep 09, 2012 6:53 am

VRPN settings in external VR application

Post by ad3dia »

Hello All,

I am facing a problem with my openViBE /VR application setup.

I created a simple VR application in Ogre3d which makes an object move to the left or to the right
depending on the class left or class right classification from an OpenViBE scenario. My scenario is very
similar to the Motor Imagery CSP scenario. There is a Graz visualizer in addition to my external VR application in the setup.

In the online scenario, I have two Stimulation outputs from the classifier processor (Class Label 1 = OVTK_GDF_Left, Class Label 2 = OVTK_GDF_RIGHT) that are inputs into a Button VRPN server with settings (Button 1 ON= OVTK_GDF_Left, Button 1 OFF= OVTK_GDF_End_Of_Trial; Button 2 ON: OVTK_GDF_Right, Button 2 OFF= OVTK_GDF_End_Of_Trial).

In my external VR application, a switch case is implemented where case (0) = left, and case(1) = right. It uses a VRPN button handler.
I have not implemented the VRPN code for analog handler because I am just using buttons.

The problem I am facing is:


Even when the Graz Vizualizer is showing left/right classifications correctly, the VR application gets left/right values in a sequence once.... LEFT RIGHT ..and then it stops getting values.
I am thinking maybe it has something to do with how fast the VRPN receives button values or maybe its not.

If I change Button VRPN Server settings to : Button 1 ON= OVTK_GDF_Left, Button 1 OFF= OVTK_GDF_Leftl; Button 2 ON: OVTK_GDF_Right, Button 2 OFF= OVTK_GDF_Right). I continuously keep getting LEFT RIGHT LEFT RIGHT LEFT RIGHT commands
in my VR application.

Not sure what I am missing here or doing wrong!

Any advice or suggestion will be awesome.

Thanks,
Ashish

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: VRPN settings in external VR application

Post by jlegeny »

Hello Ashish,

Your second implementation is correct (using the same stimulation for ON and OFF signals). This is because in this case the VRPN button acts as a toggle button, that is, it changes state everytime the given stimulation is received.

For your problem with receiving right/left/right/left sequence:
Have you checked (with stimulation listener box, for example) that the stimulations sent by the classifier are correct?
In the case the stimulations are correct, could you precise your implementation of vrpn handling in your code? My guess would be that you are using VRPN button's state member instead of the button member, but without the code I cannot be sure.

Cheers
Jozef

ad3dia
Posts: 10
Joined: Sun Sep 09, 2012 6:53 am

Re: VRPN settings in external VR application

Post by ad3dia »

Hello Jozef,
Thank you for the information.

I have a stimulation listener box that listens to stimulations from the classifier processor. I could not precisely find where
the logs are printed. Is it in the dist/log/openvibe-designer.txt? Or how do I use the log manager ? I could not find any documentations or help online.

As for the second part, you are right. I am using the button's state to make a selection. Here's my code for the vrpn process handler in my VR application:

///////////////////////To Process button values from VRPN \\\\\\\\\\\\

bool applicationVR::processVRPN(const Ogre::FrameEvent& evt){

left=false; right=false;


while (!vrpnHandle->buttonInfo.empty()){ //as long as there is a button value
std::pair < int, int>& buttonState= vrpnHandle->buttonInfo.front();

if (buttonState.second){ //if the button is on

//perform actions based on the value of buttons
switch(buttonState.first){
case(0):
//transVector.x -= 300;
left=true;
right=false;
std::cout<<"To the LEFT \n";
break;
case(1):
right=true;
left=false;
std::cout<<"To the RIGHT \n";
break;

}

}
vrpnHandle->buttonInfo.pop_front();

}


return true;
}


I have been stuck on this problem for a while now. Really frustrating. Hopefully, you can provide some insight into it.

Best,
Ashish

ad3dia
Posts: 10
Joined: Sun Sep 09, 2012 6:53 am

Re: VRPN settings in external VR application

Post by ad3dia »

Hi Jozef,
Actually I figured out the log manager part. I seem to be getting the correct OGTK_GDF_Left and OVTK_GDF_Right stimulations.
I guess then something must be wrong with my VR code which I have posted in the previous reply. May be you can see what I can't!

Thanks much,
Ashish

ad3dia
Posts: 10
Joined: Sun Sep 09, 2012 6:53 am

Re: VRPN settings in external VR application

Post by ad3dia »

Hi Jozef,
I also found out that the log is spitting out this message in intervals:

<Player::can not reach realtime> 58 second(s) late...

I am not sure if it has to do with the VR application not getting LEFT/RIGHT stimulations in real time.

Thanks,
Ashish

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: VRPN settings in external VR application

Post by jlegeny »

Hello Ashish,

are you using some framework to use the VRPN events? In the implementation described in the OpenViBE to external application tutorial here: http://openvibe.inria.fr/vrpn-tutorial- ... plication/ I use callbacks rather than looping on the VRPN handle.

I suggest you look at the tutorial to see how the VRPN link works. In your case the std::pair<int, int> is most probably inverted i.e.: the first member contains the button's state and the second uses the button number.

In a case of a flip button (i.e.: the ON and OFF stimulations are the same) the state will switch from 0 to 1 all the time resulting in the behaviour you have described.

---

By default, the Stimulation Listener displays messages on the Debug log level which, by default, are only logged and not displayed. You can change the log level in the box' settings.

---

If the player cannot reach realtime then there is a high probability that the stimulations to the application will be sent later, as VRPN is a realtime framework and does not work with simulated time.

ad3dia
Posts: 10
Joined: Sun Sep 09, 2012 6:53 am

Re: VRPN settings in external VR application

Post by ad3dia »

Hi Jozef,

Thank you for replying back. This problem is really killing me :( . But, here's what I have done so far as you asked:

Yes, I am using the exact same implementation as in the tutorial for VRPN except that I have compiled the code in an external MS Visual Studio project and exported the necessary functions into a different class with a different name for the VRPN implementation. My OGRE application is part of the same project and it uses this VRPN class to get button values.

I checked the std::pair<int, int> for the buttons. It seems to be okay i.e. button.first= button and button.second = state.

"In a case of a flip button (i.e.: the ON and OFF stimulations are the same) the state will switch from 0 to 1 all the time resulting in the behaviour you have described."

-I wanted a left or right movement of a VR object. So I thought this would be okay setting. Is there another setting that will work better?

I changed the Stimulation listener setting to "Information". It is now displaying the stimulations in the log manager. Seems to
be correctly and continuously displaying stimulation in the log manager as follows:

-------------------------
[ INF ] At time 24.969 sec <Box algorithm::Stimulation listener> For input 0 with name Stimulation stream 1 got stimulation 769[OVTK_GDF_Left] at date 24.688 sec and duration 0.000 sec
[ INF ] At time 24.969 sec <Box algorithm::Stimulation listener> For input 0 with name Stimulation stream 1 got stimulation 769[OVTK_GDF_Left] at date 24.750 sec and duration 0.000 sec
[ INF ] At time 25.031 sec <Box algorithm::Stimulation listener> For input 0 with name Stimulation stream 1 got stimulation 770[OVTK_GDF_Right] at date 24.813 sec and duration 0.000 sec
[ INF ] At time 25.031 sec <Box algorithm::Stimulation listener> For input 0 with name Stimulation stream 1 got stimulation 770[OVTK_GDF_Right] at date 24.875 sec and duration 0.000 sec
[ INF ] At time 25.031 sec <Box algorithm::Stimulation listener> For input 0 with name Stimulation stream 1 got stimulation
-------------------------------------------------


The thing that surprises me is that I have tried my scenario with a keyboard simulator and it works fine when keyboard input is used via. VRPN to move left or right. In the keyboard the OVTK_StimulationId_Label_01 & OVTK_StimulationId_Label_02 are used as the stimulation codes.
But when I use the BCI to perform the same task, the left/right behaves as I mentioned above i.e. LEFT RIGHT LEFT RIGHT continuously..

Any advice is greatly appreciated.

Thanks much,
Ashish

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: VRPN settings in external VR application

Post by jlegeny »

Hello Ashish,

could you send me your test scenarios so I can look at them? This problem is indeed weird and I do not know how it could work with the keyboard stimulator if the output is exactly the same (also note that the keyboard stimulator sends a stimulation on both keypress and keyrelease)

Cheers
Jozef

uahmed
Posts: 49
Joined: Fri Dec 21, 2012 12:43 pm
Contact:

Re: VRPN settings in external VR application

Post by uahmed »

Hi all, I am getting the same problem as well.... can you please help.. I keep getting the stimulation continuously, I checked that via stimulation listener too.

Thanks.

Post Reply