OpenViBE forum

The OpenViBE community
It is currently Tue Oct 23, 2018 5:11 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Mar 05, 2015 9:35 am 

Joined: Sun May 04, 2014 12:25 pm
Posts: 1
Hello everybody,

I have written a script in python but for some reason OpenViBE lags when I run the script and I get an output like
[WARNING] <Player::can not reach realtime> 1 second(s) late...

I thought the problem was an infinite loop or so in my code, so I added debug info but it turns out OV seems to stuck between two OVBox.process() calls.
Here are the relevant parts (I hope!) of my code
   def process(self):
      print "new process"
      while len(self.input[0]):
         print 'start loop'
         buff = self.input[0].pop()
         if(type(buff) == OVSignalHeader):
            self.signalHeader = buff
            print 'init'
         elif(type(buff) == OVSignalBuffer):
            numpyBuffer = np.array(buff).reshape(tuple(self.signalHeader.dimensionSizes))
            prediction = best_cca() # returns either of [7,9,11,13,15,-1]
            self.send_stimulation(prediction, buff)
            print "sent stimulation", prediction
         elif(type(buff) == OVSignalEnd):
            outputEnd = OVStimulationEnd(buff.startTime, buff.endTime)
            print 'end'
      print 'end process'
   def init(self):
      outputHeader = OVStimulationHeader(

   def send_stimulation(self, prediction, buff):
      if prediction > 0: stim = OpenViBE_stimulation['OVTK_StimulationId_LabelStart'] + prediction
      else: stim = OpenViBE_stimulation['OVTK_StimulationId_NonTarget']
      stimSet = OVStimulationSet(buff.startTime, buff.endTime)
      stimSet.append(OVStimulation(stim, buff.endTime, 0.))

with an output like
new process
end process
new process
start loop
sent stimulation 7
end process
[WARNING] <Player::can not reach realtime> 1 second(s) late...

This doesn't happen systematicly, but every five predictions or so... Does anybody know what mistake I have made?

Reply with quote  
PostPosted: Mon Mar 09, 2015 8:29 am 

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 760
Location: INRIA Rennes, FRANCE
Hi Oettam,

one suspicious thing I see is that you're calling init from process(). This likely shouldn't be done.

To debug this, what I'd do is that I'd take the hello world example script

class MyOVBox(OVBox):
        def __init__(self):

        def initialize(self):
                # nop

        def process(self):
                # print something

        def uninitialize(self):
                # nop

box = MyOVBox()

and check that it runs properly. Then, line by line, start modifying it towards your script and see where the problem appears for the first time.

Happy hacking,

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

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.