bug? wait function has a 1ms error

10 years 2 weeks ago #29528388 by sd1074
I think I've found a bug.

Environment:
- Firmware ID: Roboteq v1.2 RCB100 08/24/2011
- Motor control utility Rev 1.2. 1-4-13
- Controller is in open loop mode for both channels

Here is the test code:
n=0
while True
	n++
	SetCommand(_VAR,0,n)
	wait(1) 'this line was varied between experiments (see below)
end while

I
- ran this piece of code on the notorcontroller for 10sec (was using an external clock)
- stopped it by clicking on the Stop button (so the measurements are not perfectly accurate, but still pretty good)
- checked the VAR value

I did this four times with diffrent wait function arg value. Here are my results:
wait lineFinale VAR valueAverage cycle period
no waitVAR=10491409.5us
wait(0)VAR=100780.99ms
wait(1)VAR=49552.02ms
wait(2)VAR=33922.95ms

As it can be seen from the results, wait(X) actually pauses the script for (X+1) ms rather then X ms as it should.

On a relevant note, the following code takes 1ms:
SetTimerCount(0,0)
while GetTimerState(0)=0
end while

whereas
SetTimerCount(0,1)
while GetTimerState(0)=0
end while
takes 2ms.

Please Log in or Create an account to join the conversation.

10 years 1 week ago - 10 years 1 week ago #29528394 by Griffin Baker
Replied by Griffin Baker on topic bug? wait function has a 1ms error
Please update to the latest firmware and try again.

dev.roboteq.com/dev1/index.php/support/downloads

Also update your version of Roborun+

Please Log in or Create an account to join the conversation.

10 years 1 week ago #29528395 by Griffin Baker
Replied by Griffin Baker on topic bug? wait function has a 1ms error
A value of 0 means the script must pause until the next 1m tick, which does result in a 1ms rate. A wait of 1 means pausing 1ms instead of starting at the next ms tick.

Thank you for your observation.

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds