WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Listen for events in maximum frequency (https://forum.worldviz.com/showthread.php?t=5616)

VizMars 01-27-2016 10:09 AM

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?

Jeff 01-27-2016 04:47 PM

Can you describe what the custom event is checking for?

VizMars 01-28-2016 02:11 AM

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.

Jeff 01-28-2016 03:27 AM

1 Attachment(s)
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.

VizMars 01-28-2016 05:25 AM

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?

Jeff 01-29-2016 09:24 AM

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?

VizMars 01-30-2016 03:45 AM

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.


All times are GMT -7. The time now is 07:04 AM.

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