|
#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
Can you describe what the custom event is checking for?
|
#3
|
|||
|
|||
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.
|
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
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? |
#6
|
|||
|
|||
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? |
#7
|
|||
|
|||
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. |
Tags |
events, frequency, listener |
Thread Tools | |
Display Modes | Rate This Thread |
|
|