# Setting up variable waypoints

**URL:** <https://forum.universal-robots.com/t/setting-up-variable-waypoints/28163>\
**Category:** Technical Questions\
**Created:** [April 27, 2023, 8:53pm UTC](https://forum.universal-robots.com/t/setting-up-variable-waypoints/28163 "2023-04-27T20:53:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![caleigh.m](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@caleigh.m](https://forum.universal-robots.com/u/caleigh.m)\
**Post date:** [April 27, 2023, 8:53pm UTC](https://forum.universal-robots.com/t/setting-up-variable-waypoints/28163/1 "2023-04-27T20:53:02Z")

</div>

Hello!  
I am attempting to consolidate multiple very similar machine tending programs into one program. The only difference between each program is essentially two waypoints. I want to have the program prompt the operator to enter in the part number that will be run on the machine and based on that input the two waypoints are changed through the use of variable inputs. Essentially for example if part = X then the waypoint would be [1, 2, 3, 4, 5, 6] and if the part = Y then the way point would be [1, 2, 7, 4, 5, 6].

Every variable assignment method I try just causes the robot to either move forward as far as it can, move upwards as far as it can etc instead of going to the waypoint position value.

---

<div class="post-metadata">

**Author:** ![efn](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@efn](https://forum.universal-robots.com/u/efn)\
**Post date:** [April 28, 2023, 7:18am UTC](https://forum.universal-robots.com/t/setting-up-variable-waypoints/28163/2 "2023-04-28T07:18:29Z")

</div>

It sounds like you’re on the right track. 🙂

If part = x  
Var\_Pos := p[0.00,0.01,0.02,0.03,0.04,0.05]  
Elseif part = y  
Var\_Pos := p[0.00,0.01,0.02,0.07,0.04,0.05]

Sounds to me like you’re using the wrong unit in your variable position. The coordinates in variables are in metres. “1” will be 1 meter in the respective axis.  
Or you’re using a wrong feature. Make sure to use the correct feature and read the coordinates in that frame.

An alternative way to do it is to make two waypoints in the start of your program, and then just assign them to a variable position.  
To keep the robot from executing the waypoints, you can put them in an “if 1 = 2” or similar:

BeforeStart  
If 1 = 2  
WaypointPartX  
WaypointPartY

RobotProgram  
If part = x  
Var\_Pos := WaypointPartX  
Elseif part = y  
Var\_Pos := WaypointPartY

Or even more simple, you can put the “if” where the waypoint actually is and not need variable waypoints:

RobotProgram  
‘Program up until the different waypoints’  
If part = x  
WaypointPartX  
Elseif part = y  
WaypointPartY

Hope this is useful to you. 🙂

---

<div class="post-metadata">

**Author:** ![caleigh.m](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@caleigh.m](https://forum.universal-robots.com/u/caleigh.m)\
**Post date:** [May 1, 2023, 12:49pm UTC](https://forum.universal-robots.com/t/setting-up-variable-waypoints/28163/3 "2023-05-01T12:49:18Z")

</div>

Ah that was my issue, I was putting in the position coords in mm instead of m. Thanks!
