# Calculate Position from a teached Waypoint and use in different Feature

**URL:** <https://forum.universal-robots.com/t/calculate-position-from-a-teached-waypoint-and-use-in-different-feature/35320>\
**Category:** URScript\
**Created:** [July 18, 2024, 1:42pm UTC](https://forum.universal-robots.com/t/calculate-position-from-a-teached-waypoint-and-use-in-different-feature/35320 "2024-07-18T13:42:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![l.krenzel](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@l.krenzel](https://forum.universal-robots.com/u/l.krenzel)\
**Post date:** [July 18, 2024, 1:42pm UTC](https://forum.universal-robots.com/t/calculate-position-from-a-teached-waypoint-and-use-in-different-feature/35320/1 "2024-07-18T13:42:51Z")

</div>

I want to calculate a position from a teached waypoint. The calculated position should be once shiftet in Z and once in X.  
The waypoint is teached not in base feature.  
If i calculate the pose, everything is working fine when operating in base feature.  
As soon as i use the calculated pose in a diferent feature, its off.

How can i use variable pos in different features?

---

<div class="post-metadata">

**Author:** ![wojciech.goral](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/wojciech.goral/32/7596_2.png) [@wojciech.goral](https://forum.universal-robots.com/u/wojciech.goral)\
**Post date:** [July 19, 2024, 10:35am UTC](https://forum.universal-robots.com/t/calculate-position-from-a-teached-waypoint-and-use-in-different-feature/35320/2 "2024-07-19T10:35:15Z")

</div>

Hi @l.krenzel,

Actually, each waypoint is stored in the script with reference to the base. If you use a different reference in the polyscope it is simply a transformation of that position by using the pose\_trans() function. Neverthless for URcontrol module which execute script - every position is related to base.

So, if you try to combine a little with pose\_trans() function you will for sure achieve what you want. Check the script manual for more info about this function.

I’d also recommend you create a program in which you reference several references (not just the base), save it, and take a look at what the .script file of that program looks like - this may help you understand how the pose\_trans() function is used.

Hope it helps!  
WG

---

<div class="post-metadata">

**Author:** ![l.krenzel](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@l.krenzel](https://forum.universal-robots.com/u/l.krenzel)\
**Post date:** [July 19, 2024, 11:22am UTC](https://forum.universal-robots.com/t/calculate-position-from-a-teached-waypoint-and-use-in-different-feature/35320/3 "2024-07-19T11:22:57Z")

</div>

Hi @wojciech.goral

i have already found my solution for my issue. I found a post in the forum which explained very good the usage of “pose\_inv” and “pose\_trans”. Just didn’t know that its alway reference to base, and how the “pose\_trans” hase to be used with feature and so.

I checked the script manual before, but for me the explenation there wasn’t helpful. Anyhow, problem Solved.
