Pausing a running movement until it can continue again - urscript

When I have a linear movement running, I have a thread obtaining the force, and if the force exceeds, the original linear movement should be paused until that force is no longer there. I have tried using the command stopl in the force checking thread and I get an error “Another thread is already controlling the robot”. I could do that in the main thread, but is there even a way to execute a movel asynchronously so I could perform the force check there?

@filipe.jorge

I am an applications engineer with Universal Robots. I wrote an example program achieving the motion you describe. It is not the most difficult program I have written, but It does require some scripting experience to understand what this example program is doing.

I used 2 threads, one to track the force and one to give my the x value of the tcp position. The reason I am looking at the x value is because I’m using just a linear move in X to keep it simple. If your start and end position is not a single dimension you will have to expand the checks to the various degrees of freedom.

One very important note, is you have to lower the MoveL speeds and accelerations within the loop. This is because the robot is essentially “crashing” to find the part. I used a tool speed of 50mm/s and a tool acceleration of 500mm/s^2. I also recorded the joint to insure safety to the robot. The program isn’t close to approaching the limits of harming the joints at these settings.

Let me know if you have any further questions.

Best,
Josh

continuing_move.script (90.5 KB)
continuing_move.urp (2.4 KB)

Thank you jmil, I did something similar where the movement (movel or movej) is in another thread and that thread gets killed if the force is up to a certain point, it just seemed a bit extreme for me to suddenly stop the movement like that when I saw you had functions like stopl or stopj. I will take into consideration the speeds you provided for movements that require a safety like that, Thank you again.