Discussion

Left ArrowBack to discussions page
RamonSanchezRamonSanchez Posts: 14 Apprentice
Hello all,

I am trying to program a timer on a UR10. Since our cycle uses two robots, I would like to program the timer only in the second robot (close to the end of the cycle) to the same point one cycle later, as the program will be running in a continuous loop.
I have already set a cycle counter by using the following code:

In the BeforeStart, I have the following:
count=0
addcount:=False

In the robot program I've got:
addcount:=False
.

.

.
addcount:=True
Wait=0.01
addcount:=False
.
.

And then I created a thread with the following code:
If addcount:=True
  count:=count+1
Wait=0.01

For now it seems to be working correctly. Is there any way I could use something similar for a timer? Maybe instead of time:=time+1 it would be something like 0.01 or 0.008?

Thanks!

Best Answers

  • RamonSanchezRamonSanchez Posts: 14 Apprentice
    edited April 13 Accepted Answer
    I was thinking something like this but I am not sure (I am unable to test it right now).

    BeforeStart
    timer:=0
    stoptimer==true

    RobotProgram
    .
    .
    timer:=0
    Wait=0.01
    stoptimer==false
    .
    .
    Thread2
    While stoptimer==false
      timer:=timer+.008
    sync()

Comments

Sign In or Register to comment.
Left ArrowBack to discussions page