Hello,
since it can be quite challenging to quickly change the speed slider on the pendant while trying out new programms or changes to existing ones I wanted to add an external potentiometer as an override like you typically have on cnc machines.
Therefore I followed the example shown here: Setting the speed slider from a program 15293 UR Support
And added a thread to my main programm:
Thread_2
ok=socket_open("127.0.0.1",30002)
Loop
RobotSetSpeed=floor(analog_in[0]*0,175*100)/100
If RobotSetSpeed>1
RobotSetSpeed=1
socket_send_string("set speed")
socket_send_string(RobotSetSpeed)
socket_send_byte(10)
Wait RobotSetSpeed! ≠ floor(analog_in[0]*0,175*100)/100
Doing it counter based like in the article did not really work for me as the speed change was very delayed.
While my script works well between 1-99% it stays on 0% once you drop the poti that law and does not go back up unless you change the speed slider on the teach pendant. It is probably because the programm is effectively paused on 0% and does not execute/evaluate the wait
statement. How can I resolve that? I still want to be able to completely pause the programm by turning it down to zero.
The second problem I encounter is that I immediately get a security stop when the poti/speed value is maxed out. “C271A1: Lowlevel-Realtime-Thread” because the runtime is too far behind.
It seems to be the if statement I added to top off the analog value at 1 the speed slider would sometimes jump to 101% otherwise. But I do not understand why. The wait should be unaffected by that, isn´t it?
Kind regards,
Martin