# How to stop the robot at some displacement given some external condition and take that data

**URL:** <https://forum.universal-robots.com/t/how-to-stop-the-robot-at-some-displacement-given-some-external-condition-and-take-that-data/17559>\
**Category:** General Application Help: How do I?\
**Created:** [November 11, 2021, 9:24pm UTC](https://forum.universal-robots.com/t/how-to-stop-the-robot-at-some-displacement-given-some-external-condition-and-take-that-data/17559 "2021-11-11T21:24:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon86510813](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@anon86510813](https://forum.universal-robots.com/u/anon86510813)\
**Post date:** [November 11, 2021, 9:24pm UTC](https://forum.universal-robots.com/t/how-to-stop-the-robot-at-some-displacement-given-some-external-condition-and-take-that-data/17559/1 "2021-11-11T21:24:13Z")

</div>

I would like to advance the robot in one movement to a point, and through the information from an external sensor (analog input) stop the robot. So I would also like to take this current position after the stop. I would do this at three different points and I would like to create a plan with those three points. Can anyone help me on what functions to use?

---

<div class="post-metadata">

**Author:** ![bba](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/bba/32/555_2.png) [@bba](https://forum.universal-robots.com/u/bba)\
**Post date:** [December 8, 2021, 8:12pm UTC](https://forum.universal-robots.com/t/how-to-stop-the-robot-at-some-displacement-given-some-external-condition-and-take-that-data/17559/2 "2021-12-08T20:12:47Z")

</div>

Hi,  
This can certainly be done but is complicated. I would contact your distributor and see if you can hire them or a system integrator to assist with a task like this. The other approach is go to a certified training course on UR (Core + Advanced) and that should give you the background you need.

---

<div class="post-metadata">

**Author:** ![anon90860240](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@anon90860240](https://forum.universal-robots.com/u/anon90860240)\
**Post date:** [December 10, 2021, 6:23am UTC](https://forum.universal-robots.com/t/how-to-stop-the-robot-at-some-displacement-given-some-external-condition-and-take-that-data/17559/3 "2021-12-10T06:23:42Z")

</div>

Hello,  
I might try to use an “Add Until” to your Waypoint at the bottom of your Waypoint command screen. From the Until command screen you would click “I/O Input”, then select the analog input and chose the value at which you want your robot to stop. After that you could add and Assignment (variable), open the expression editor (yellow box) and select the function get\_actual\_tcp\_pose(). Once you’ve done this with your three different points, you could use those variables as Waypoints (select Variable Position in command screen drop down, upper left corner). Your robot will then go through these waypoints. You may need to update your software to get the “Add Until” option in your Waypoint command screen. Make sure to follow the instructions when you download the software update(s). Depending on how old the Polyscope version is, you may have to install each update sequentially before you can jump ahead to the most recent.  
Shameless plug, Olympus Controls/Applied Automation have dozens of UR experts on staff. 🙂

Lance Price  
Sr Robotics Sales Specialist  
OR, WA, ID, MT
