Collision recovery using Until expression

I am placing a hollow cylindrical part onto a pin at a regrip station. It is possible for the part to be gripped such that it will not go onto the pin, i.e. the part crashes into the pin. I want the robot to detect the collision and discard the part when this happens.

Right now, I call zero_ftsensor() immediately before the MoveL during which the collision detection should occur. I use an “Until expression” for this movement, moving the part onto the pin Until force()>30.

When I run the program, the first time a collision happens, the robot does exactly what I want: It detects contact, retracts, and discards the part. The problem is, after that first collision, it seems to detect a collision on every subsequent iteration, retracting and discarding every part every time. I set up a thread to monitor the value of force(), and I never see it go anywhere near my set limit of 30 N.

Any ideas what I’m doing wrong?

Follow up:

Based on an information I read in another thread, I added another “Until” to my move. When I included “Until Waypoint reached”, the program worked as I intended. I still do not really know why it behaved as it did without the additional Until, but at least I know how to get the result I am looking for.

See this thread for more information.