OpenViBE forum

The OpenViBE community
It is currently Fri Feb 21, 2020 1:07 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Jan 18, 2014 5:55 pm 
Offline

Joined: Tue Nov 26, 2013 3:43 pm
Posts: 22
Hi,

I'm trying to send stimulations from external application to acquisition server but it doesn't work as expected: stimulations don't appear in "signal display" box. I've followed:

http://openvibe.inria.fr/send-stimulati ... on-server/

and read:

viewtopic.php?f=5&t=4961

  • I'm using OpenViBE in version 0.17.0 on Ubuntu 12.04.
  • I've compiled it by executing: ./linux-install_dependencies and ./linux-build.
  • I've set "AcquisitionServer_ExternalStimulations = True" in personal configuration file.

Do you have any idea what may be wrong?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2014 9:02 am 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 778
Location: INRIA Rennes, FRANCE
Take 'network-acquisition.xml' scenario and get it to run. You should see a signal when acquisition server is sending data. Now launch 'openvibe-external-stimulation-connection-example.sh'. You should now see a stimulus in the display. If so, just follow the code of that example app. If there is no stimulus that way, there's a problem.


Happy hacking,
Jussi


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2014 4:36 pm 
Offline

Joined: Tue Nov 26, 2013 3:43 pm
Posts: 22
It works, thanks! I'm not really sure what I did that it started to work but i tried:
  • installing openvibe 0.16.2,
  • reinstalling openvibe 0.17.0,
  • enbling and disabling "EnableExternalStimulations" in Acquisition Server Properties,
  • restarting openvibe,
  • trying your test.

After reinstallation of version 0.17.0 I had disabled "EnableExternalStimulations" by default. I enabled it but stimulations still didn't work. I closed all OpenViBE windows and after that I got stimulations on "signal display".
I'd like to note that in "Edit->Preferences" I have now "AcquisitionServer_ExternalStimulations" set to false and external stimulations work.
Besides that in version 0.16.2 acqusition server is periodically sending (it's own?) stimulations with value 0 (screen in attachemnt).


Last edited by pwierzgala on Tue Jan 21, 2014 10:41 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2014 4:44 pm 
Offline

Joined: Tue Nov 26, 2013 3:43 pm
Posts: 22
Forgot about screenshot :]


Attachments:
Screenshot.png
Screenshot.png [ 37.27 KiB | Viewed 10988 times ]
Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 21, 2014 8:25 am 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 778
Location: INRIA Rennes, FRANCE
Periodical stimulations happen because you have selected such an option in the driver.

Use CSV Writer box to produce a CSV file, and you'll see what the reader expects. Note the weird practice with the mandatory last column.

Code:
Time (s);Channel 1;Channel 2;Channel 3;Channel 4;Sampling Rate
0.000000;1.698815;1.305434;-1.408991;-0.466583;512
0.001953;1.735544;1.177482;-1.865364;-0.517466;
0.003906;1.756200;0.998269;-2.263588;-0.300512;
0.005859;1.760030;0.782073;-2.551195;0.152289;
0.007813;1.746574;0.545681;-2.692383;0.742552;


Cheers,
Jussi


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 21, 2014 10:45 am 
Offline

Joined: Tue Nov 26, 2013 3:43 pm
Posts: 22
You are right. I didn't open driver properties before so I didn't see that option. Everything is clear now. Thanks for help very much!


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 28, 2016 9:24 am 
Offline

Joined: Mon Jun 27, 2016 8:34 pm
Posts: 4
Hi,

I have exactly the same problem. I want to send stimulations from a self programmed game to OV via TCP tagging. The suggestion of jtlindgren works. But If I use the provided tcp-tagging python script example, the stimuli don't appear in the display or anywhere else. I hope someone here can help me with this.

My system:
Win 7 64 Bit
openvibe 1.2.0
The game is written with the pygame library

Best,
David


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 29, 2016 7:33 am 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 778
Location: INRIA Rennes, FRANCE
Hi Klaro, there might be a bit of confusion there. The external stimulation connection example uses the previous technique of 'External Stimulations' whereas 'TCP Tagging' is our new recommended approach. I'll ping our expert about the tcp tagging python example.

TCP Tagging doc in general,

http://openvibe.inria.fr/tcp-tagging/

Cheers,
Jussi


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 29, 2016 12:20 pm 
Offline

Joined: Mon Jun 27, 2016 8:34 pm
Posts: 4
Oh okay. I thought this was completely replaced with TCP tagging. However, if I would use external stimulations, I need to do this in C++, right? Thanks for asking your expert. I would prefer the TCP tagging solution with python since all my code is based on python. So please let me know :). Thanks.

This is what I do right now:
I acquire the signals from the generic oscillator.
In the designer I use the network-acquisition.xml example.
After I started the acquisition server and designer, I execute the example script tcp-tagging-client.py

Code:
import sys
import socket
from time import time, sleep

# host and port of tcp tagging server
HOST = '127.0.0.1'
PORT = 15361

# Event identifier (See stimulation codes in OpenVibe documentation)
EVENT_ID = 0x00008205

# Artificial delay (ms). It may need to be increased if the time to send the tag is too long and causes tag loss.
DELAY=0

# transform a value into an array of byte values in little-endian order.
def to_byte(value, length):
    for x in range(length):
        yield value%256
        value//=256

# connect
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

for i in range(100):
    # create the three pieces of the tag, padding, event_id and timestamp
    padding=[0]*8
    event_id=list(to_byte(EVENT_ID, 8))

    # timestamp can be either the posix time in ms, or 0 to let the acquisition server timestamp the tag itself.
    timestamp= list(to_byte(int(time()*1000)+DELAY, 8))

    # send tag and sleep
    s.sendall(bytes(padding+event_id+timestamp))
    sleep(1)

s.close()


Now I would expect, that the stimuli are displayed but they aren't.

Best,
klaro


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 30, 2016 10:00 am 
Offline

Joined: Fri Nov 14, 2014 1:06 pm
Posts: 40
Hi klaro,

I think the problem you have is related to the fact that 'bytes' is different in python2 and python3.
The example script was written for python 3. All you have to do is to replace bytes by bytearray. This should work for both python 2 and python 3.
The example script will be changed accordingly so that other people don't face the same problem.

Thanks !


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 30, 2016 11:38 am 
Offline

Joined: Mon Jun 27, 2016 8:34 pm
Posts: 4
Hi nfoy,

thank you so much. It works now :).

Best,
klaro


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maël Soucaze.