Hello together,
if i want to control the speed of the UR5 by the value which i give to the analog input ? What is the best way to do it ?
I would you the get_analog_in(n) method but how i can control then the velocity?
Can this work?
Program
Robot Program
MoveJ
Waypoint_1
Waypoint_2
Waypoint_3
Wait: 0
Waypoint_4
Wait: 2.0
Waypoint_7
Waypoint_8
Waypoint_5
Wait: 2.0
Waypoint_6
Wait: 0
Thread_1
ok≔socket_open(“127.0.0.1”,30002)
analog_in≔get_analog_in(1)
Loop
socket_send_string(“set speed”)
socket_send_string(analog_in)
socket_send_byte(10)
Best
Sounds reasonable, but consider adding a sync()
command to the Thread-loop. And you probably need to include the get_analog_in()
inside the Loop, otherwise you would keep sending the same value.
Hi jbm. Thank you for the fast response. Im curious, why i have to add the sync() command in the thread loop ? And another thing is. What is the value range i get with get_analog_in() is it a float between 0.0 and 1.0 ?
and why i’m sending socket_send_byte(10)?
sync()
takes physical time, and hence relieves the thread from running away, consuming all processor resources.
Also, you probably do not need to adjust the speed slider at sub-millisecond precision, so adding some small delay could also work. I.e. 100 ms (sleep(0.1)
)
The return value of get_analog_in()
is explained in the URScript Manual.
The command needs a line feed
character to execute, why you are sending byte 10.
Hi jbm,
thank you for you answer