WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-27-2016, 09:09 AM
VizMars VizMars is offline
Member
 
Join Date: Jan 2016
Posts: 40
Listen for events in maximum frequency

Hello,

I want to check as often as possible whether a custom events occurs.
Will calling the function (that checks for the event) in a separate thread via vizact.onupdate or calling it within a while(TRUE)-loop in a separate thread do the trick? Or are they equivalent, or is their a better solution?
Reply With Quote
  #2  
Old 01-27-2016, 03:47 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you describe what the custom event is checking for?
Reply With Quote
  #3  
Old 01-28-2016, 01:11 AM
VizMars VizMars is offline
Member
 
Join Date: Jan 2016
Posts: 40
There a two events, one is checking for the 3D-position of a finger tip (Leap Motion) and the other one is checking for keypresses (RB-830 Response Pad). I need two parallel threads in order to be sure that the exact system time the events occur at is captured.
Reply With Quote
  #4  
Old 01-28-2016, 02:27 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
I'm not sure if there is a way to get the time of the Leap event at a rate faster than the Vizard main loop. How are checking the 3D position? Is this done through Leap Python code or using Vizard commands?

Try the attached example script which uses a Vizard module to get the Cedrus data. This was developed awhile back and I'm not sure it's compatible with the latest protocol. It provides the response time the Cedrus reports.
Attached Files
File Type: zip cedrusExample.zip (803 Bytes, 1111 views)
Reply With Quote
  #5  
Old 01-28-2016, 04:25 AM
VizMars VizMars is offline
Member
 
Join Date: Jan 2016
Posts: 40
I'm checking it trough Leap Python code.
I checked your script cedrusExample and it uses a vizact.onupdate function (self.__onupdate) to check for keypresses.

When I'm running a separate thread, is it faster to use a while(TRUE)-loop to check for the events or is vizact.onupdate faster?
Reply With Quote
  #6  
Old 01-29-2016, 08:24 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The vizact.onupdate command calls the update function at the frequency of Vizard's main loop. In the case of the Cedrus, the response time is based on what Cedrus sends to Vizard and is not limited by Vizard's loop.

Are you referring to a Vizard director function or something else when you run a separate thread?
Reply With Quote
  #7  
Old 01-30-2016, 02:45 AM
VizMars VizMars is offline
Member
 
Join Date: Jan 2016
Posts: 40
Yes, I'm referring to the director function.
I want to use it to check whether a Cedrus key is pressed or not as often as possible and then use this information in my main loop to stop the movement of an object, so the response time doesn't help me. And my idea was to log this event through the system time.
Reply With Quote
Reply

Tags
events, frequency, listener

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:51 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC