WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Using viz.starttimer to run 100 times per second (https://forum.worldviz.com/showthread.php?t=4917)

Ryan 01-15-2014 12:44 PM

Using viz.starttimer to run 100 times per second
 
I need to have something run approximately 100 times per second, but using
viz.starttimer(0,0.01,viz.FOREVER) or viz.starttimer(0,0.001,viz.FOREVER) does not seem to work. I only seem to be able to have this run about 20 times per second, no matter how small I make the second parameter.

Is there another way?

Thanks

Jeff 01-15-2014 02:10 PM

The timer runs in Vizard's main loop which is in sync with display updates. If the frame rate is 60 then the fastest timer expiration is 1/60 of a second.

What is the frame rate shown in Vizard (press F4) and what do you want to update at 100 times/sec?

Ryan 01-15-2014 02:32 PM

We have a haptic device that is linked to an object that is moved around and are tracking the coordinates of that object for analysis.

I'm not at that computer now but I believe the refresh rate is 60.

Would I be guessing right to assume that part of the problem might be that my computer isn't fast enough to run through my code in less than 1/60 of a second? If it was faster, and could run through my code faster, I should be able to up my output from 20 per second to 60, correct?

Or, is there a better way to run a routine on a time interval like this that would allow me to execute my routine 100 times per second?

Thanks.

Ryan 01-16-2014 01:03 PM

Sorry I was a little confused.

I checked the frame rate by pressing F4 and found that depending on what I'm running the frame rate is different. I have one module where the frame rate is around 2.5, another where it is about 6, and another where it is around 20. All of these modules do the same types of things. They allow a user to move objects around through a haptic device (phantom omni).

It might be okay if we can't get the rate up to 100, but we need it as fast as we can get it.

I haven't been able to determine the reason why one module is running much faster than the other two. Any ideas?

Jeff 01-17-2014 04:02 PM

The frame rates you're getting are very low. If you go to Reference > Basic Concepts > Real Time Performance Concerns in the Vizard Help you'll see a description of Vizard's render stats. These stats can help determine what's causing the frame rate to drop.

fordprefect 01-22-2014 08:24 AM

To answer the other part of your question - if you use the default for the second parameter you will get an execution with each frame, no matter what the frame rate is, which as Jeff said is the fastest you can get from this command:
Code:

viz.starttimer(0, numRepeats = viz.FOREVER)
or
viz.starttimer(0, viz.FASTEST_EXPIRATION, viz.FOREVER)

Best Regards,
Walter


All times are GMT -7. The time now is 10:44 PM.

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