# Collision recovery using Until expression

**URL:** <https://forum.universal-robots.com/t/collision-recovery-using-until-expression/24275>\
**Category:** General Application Help: How do I?\
**Created:** [October 6, 2022, 1:37pm UTC](https://forum.universal-robots.com/t/collision-recovery-using-until-expression/24275 "2022-10-06T13:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciakr](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@ciakr](https://forum.universal-robots.com/u/ciakr)\
**Post date:** [October 6, 2022, 1:37pm UTC](https://forum.universal-robots.com/t/collision-recovery-using-until-expression/24275/1 "2022-10-06T13:37:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ciakr](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@ciakr](https://forum.universal-robots.com/u/ciakr)\
**Post date:** [October 6, 2022, 7:41pm UTC](https://forum.universal-robots.com/t/collision-recovery-using-until-expression/24275/2 "2022-10-06T19:41:29Z")

</div>

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](https://forum.universal-robots.com/t/sensitivity-of-until-contact/19521) for more information.
