Universal Robots Forum

Force move until distance reached

I’m trying to apply a Force in a plane and have a nested Move Until distance is met statement. The robot (UR10E) seems to move in the plane for a random amount of distance and force. The robot is running a pneumatic tapping arm and using the screw driving command to tap a part. That works great. Then it reverses the motor and needs to lightly pull up to follow the tap as it reverses. I have tried using a waypoint directly above the hole and force move until waypoint is reached with the same issues. When using the tapping arm by hand it is effortless to lift up and down.

I think the issue is that you are commanding a move in the same direction your force is being applied. the robot cannot follow a move profile in a compliant direction.

Instead you could have a thread running to monitor position or force or velocity (assign them to a variable). You can then put a wait command in the force template that waits for the variable assigned to be equal to the chosen parameter to exceed a threshold.This allows the tool to gently pull up until the tap is free of the part.

Building on what Phil talked about, I recently wrote a short program that will attempt to apply a force until it reaches a certain distance or a timeout is reached (whichever comes first).
Force to distance.urp (2.3 KB) [Written in Polyscope 5.10]

In order to get it to work for your application, you’ll need to tweak the following settings:

  • Change the approach and start positions (if you need them)
  • Change your timeout in the “BeforeStart” to match the amount of time that you’d like to have (if you want that functionality)
  • Change your “Travel_Distance” variable to however long the distance should be
    To do this, I would first set a super long distance so that no matter what the robot reaches its timeout. After it has timed out, look in the “Variables” tab of the program to see what the value of “Distance_pose” is. It’s going to be an array of 6 numbers representing the robot pose, but most likely one of the first three values (representing the x,y,z of the tool) will probably be a lot bigger than the rest. I would then set your “Travel_Distance” to just under what you read
  • Similarly to the previous note, change the value of “Distance_pose” on line 32 of the code to represent the correct part of the array you’re comparing your travel distance against. In my example the robot was moving mostly in its x-direction, so I chose TD[0]
  • On line 24 I have an “If” statement that checks if the robot timed out and halts the program if it did. It’s up to you if you want that functionality but it gives some extra capability so the robot doesn’t hang forever. If you don’t want it, you can delete that “If” statement plus the “timer_1>Time_out” part of the “If” statement on line 32.