I am doing a scanning project with a UR5e and the speed of the robot is affecting my measurements. I need to somehow get a constant speed out of this robot. I have tried a moveP and speedl command and get about the same results. I am trying to move in a straight line along the Y+ axis from one point to another at a constant speed of 0.08 meters per second. It should be well within the capability of the robot to hold that speed. However, I am seeing a fluctuation from 0.076 to 0.083 meters per second. Can anyone out there suggest a way to improve the speed control of this robot so I can get a good measurement.
If this is not possible does anyone know a way to generate an encoder pulse out? I am tempted to use a thread and read TCP speed and toggle an output based on the rate it is going. Has anyone tried this?
Here is what I have tried to correct this. I created a script to move using a speedl command at 0.08 mm/s in the Y axis. I put a variable in the Y-axis speed location. In a thread, I am using get actual TCP speed to determine how fast I am moving and I am changing that variable to correct for the speed difference. My issue now is I get run away speed changes. One time it even moved up diagonally. I could use a little help troubleshooting the scripts. Here is the script for making the move:
while timer_scan < 16.5:
speedl([0,Y_speed,0,0,0,0],1.2)
thread_run1 = 1
end
stopl(1.2)
Here is the thread script:
Define the target speed in m/s
target_speed = 0.08 # 80 mm/s
while thread_run1:
# Get the current Y_speed
current_speed = get_actual_tcp_speed()
current_Y_speed=current_speed[1]
# Check if Y_speed is not at the setpoint
if current_Y_speed != target_speed:
# Adjust Y_speed to the setpoint
Y_speed = Y_speed + (target_speed-current_Y_speed)
end
# Sync to the controller's frequency
sync()
end # This is the end statement for the while loop