# Move tcp relative to feature

**URL:** <https://forum.universal-robots.com/t/move-tcp-relative-to-feature/15492>\
**Category:** URScript\
**Created:** [July 15, 2021, 4:23pm UTC](https://forum.universal-robots.com/t/move-tcp-relative-to-feature/15492 "2021-07-15T16:23:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon89508448](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@anon89508448](https://forum.universal-robots.com/u/anon89508448)\
**Post date:** [July 15, 2021, 4:23pm UTC](https://forum.universal-robots.com/t/move-tcp-relative-to-feature/15492/1 "2021-07-15T16:23:01Z")

</div>

Hello, I need to move my robots TCP relative to a feature using URScript.  
For example, I need to move the TCP 0.2 meters in the Z direction relative to the feature.

I have tried using example b [here](https://www.universal-robots.com/articles/ur/programming/urscript-move-with-respect-to-a-custom-featureframe/). It’s close to what I want but I need to move based on where the TCP currently is.

I have tried using the URScript [here](https://forum.universal-robots.com/t/how-to-get-tcp-pose-in-feature-coordinates/495) to get the current TCP relative to the feature but I cannot get it to work the way I need.

I should be able to figure it out if I can get the TCP pose relative to the feature but I haven’t been successful in getting that.

Thank you in advance for the help!

---

<div class="post-metadata">

**Author:** ![anon89508448](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@anon89508448](https://forum.universal-robots.com/u/anon89508448)\
**Post date:** [July 15, 2021, 8:24pm UTC](https://forum.universal-robots.com/t/move-tcp-relative-to-feature/15492/2 "2021-07-15T20:24:50Z")

</div>

I have solved it, here is my solution:  
/\* Code \*/

PoseRelativeToFeature = pose\_trans(pose\_inv(FeaturePose), get\_actual\_tcp\_pose())  
MoveTCPRelativeToFeature = pose\_add(PoseRelativeToFeature, p[0.1, 0, 0, 0, 0, 0]))  
movel(pose\_trans(FeaturePose, MoveTCPRelativeToFeature))

/\* End code \*/

FeaturePose is the pose for the feature  
p[0.1, 0, 0, 0, 0, 0] makes us move 10cm in the X direction of the feature

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/system/32/1_2.png) [@system](https://forum.universal-robots.com/u/system)\
**Post date:** [July 17, 2021, 8:25pm UTC](https://forum.universal-robots.com/t/move-tcp-relative-to-feature/15492/3 "2021-07-17T20:25:34Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
