There is not a time function on the robot. Here's how you to it though. Place a thread in the program and in that thread you place the following.
time=time+.008
sync()
The sync command takes up a time slice of robot time which is processing at 125 Hz or 8 milliseconds. Then in your program you can get the time at the start of a process and the end by simply referencing this value. we do cycle timers by simply setting time to 0 at. The start of the process and then grabbing the time at the end of the process. I also do similar things for wait timers when I want the robot to wait for instance both a time or an input to happen. An instance of this is wenfite a camera for a feature verification. The camera gives us an OK input if the feature is present but nothing if it's not present so I want to wait for either the output to fire, good part, or a specific time to expire, bad part. So we do something like
I=0
goodPart= False
Loop I<3 or digital_input_0 not true
I=I+.008
sync()
if i<3
goodPart = True
That will cause the program to wait for either the timer to exceed 3 seconds or the input to fire. Once the loop ends if the time is less than 3 seconds then the input must have fired so we have a good part
Hello everyone.
I'm trying to measure the cycle time of a process using a UR10.
My idea was to get the time at the start and at the end of the process and calculate the elapsed time with it.
The problem is that it seems there is no function that returns the time ( or at least I couldn't find it in the script documentation ). I was trying to overcome this problem connecting to the real time interface and read the timestamp from there, but then again, there is not a function to read binary floats.
Any ideas on how to get the time?
We want to be able to do it only with the robot. We want to avoid using an external computer to ask for the time.
Simply measuring the time with a clock is not acceptable as it is needed to obtain precision values.