# MoveL Offset Relative to Waypoint

**URL:** <https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622>\
**Category:** URScript\
**Created:** [February 11, 2019, 7:17pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622 "2019-02-11T19:17:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon45084841](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@anon45084841](https://forum.universal-robots.com/u/anon45084841)\
**Post date:** [February 11, 2019, 7:17pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/1 "2019-02-11T19:17:59Z")

</div>

I would like to make a move relative to a waypoint. The offsets will be setup as variables. The idea is to call a moveL command referencing the waypoint then adding the offset to that waypoint.

Waypoint\_1 is set and calibrated  
Variable: Offset\_1 = [10,50,0,0,0,0]  
MoveL Relative to Waypoint\_1 with Offset\_1

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [February 12, 2019, 8:48am UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/2 "2019-02-12T08:48:28Z")

</div>

I don’t believe there is a way of doing this in polyscope commands, you would have to use URScript.  
Use the script file from you program which contains Waypoint\_1, to find it’s coordinates, then write something like:

```
offset_waypoint = p[waypoint_1[0]+offset_1[0], waypoint_1[1]+offset[1], ...., waypoint_1[5]+offset_1[5]]

```

Then you can call a moveL on `offset_waypoint`

There are a couple of ways of finding the script file of a program.if you are using URSim, then simply open the `.script` file from the robot’s programs folder in a text editor.  
If you’re on a real robot, then open a blank program, add a “Script Code” command, press “Edit” then “Open” and you’ll see the script files of all your programs.

---

<div class="post-metadata">

**Author:** ![dan.oconnor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dan.oconnor](https://forum.universal-robots.com/u/dan.oconnor)\
**Post date:** [October 21, 2021, 4:58pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/3 "2021-10-21T16:58:26Z")

</div>

Thanks, but this only seems to work in the base co-ordinate system, its not offsetting in the plane the waypoint is thought in. So If I have a waypoint thought in a feature plane and I want to offset 10mm in the x direction of that plane, Im struggling.  
Its super easy with other robots. I know I’m missing something obvious.

---

<div class="post-metadata">

**Author:** ![dan.oconnor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dan.oconnor](https://forum.universal-robots.com/u/dan.oconnor)\
**Post date:** [October 21, 2021, 7:51pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/4 "2021-10-21T19:51:44Z")

</div>

Ok I think I understand my issue, but would like to run it by anyone with prior experience.  
I was training all my waypoints at the top of the program in an “If” clause that would never run. I would train each point in a MoveJ in the Feature plane they were related to, then link these throughout the program and use a Move in the plane they were trained in.

This seems to be the route cause of my issue. I need to have the waypoint I want to offset trained in the Base Feature. I then need to pose\_trans my offsets w.r.t the frame and add these to the Base trained waypoint, then do a moveJ in the base frame.

I was trying to do all my moves in the relative feature plane the point was trained in. This had some wild results. Doing it all in base seems to work.

My only issue is it duplicates a point trained in a custom feature plane, this is done for calibration purposes, so all points in a feature plane can be adjusted based on a 3 point calibration.

Any comments on the above are welcome

---

<div class="post-metadata">

**Author:** ![anon32693620](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@anon32693620](https://forum.universal-robots.com/u/anon32693620)\
**Post date:** [October 25, 2021, 3:38pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/5 "2021-10-25T15:38:30Z")

</div>

One work around would be that you could find the offset in reference to the feature pose, subtract that found pose data from the feature pose, and then add the difference (the newly found offset) to the pose you are originally wanting to offset.

---

<div class="post-metadata">

**Author:** ![jeff2](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jeff2](https://forum.universal-robots.com/u/jeff2)\
**Post date:** [January 28, 2025, 11:45pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/6 "2025-01-28T23:45:58Z")

</div>

@dan.oconnor did you ever get this to work? I’m having this problem as well and its extremely frustrating because other robots make this so simple. Can you share any code?

---

<div class="post-metadata">

**Author:** ![eric.feldmann](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@eric.feldmann](https://forum.universal-robots.com/u/eric.feldmann)\
**Post date:** [January 29, 2025, 2:24pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/7 "2025-01-29T14:24:26Z")

</div>

Here’s the function I’ve cobbed together from stuff I’ve found on the forum over the years:

```auto
def shiftRelativeToFeature(x_offset, y_offset, z_offset, feature, poseToShift):
  return pose_trans(feature, pose_add(pose_trans(pose_inv(feature), poseToShift), p[x_offset, y_offset, z_offset,0,0,0]))
end

```

So here you pass in an x, y, and z offset, then pass it which Feature you want to use as the direction, then finally pass the pose you are shifting. In the original use case, they would have supplied 10 for x, 50 for y, and 0 for z. Then a Feature (could be Base, could be Plane\_1, etc) and finally they would have passed “Waypoint\_1\_p”. This function returns this result as a Pose allowing you to MoveL to the result. Just remember it’s all in METERS, so the original post with values of 10 and 50 are unreasonable.

---

<div class="post-metadata">

**Author:** ![jeff2](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jeff2](https://forum.universal-robots.com/u/jeff2)\
**Post date:** [January 29, 2025, 7:26pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/8 "2025-01-29T19:26:45Z")

</div>

Thank you for that quick reply, that’s a huge help. I tested it and it finally works. I can’t believe its still so difficult. Thanks again!

---

<div class="post-metadata">

**Author:** ![dan.oconnor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dan.oconnor](https://forum.universal-robots.com/u/dan.oconnor)\
**Post date:** [January 29, 2025, 9:50pm UTC](https://forum.universal-robots.com/t/movel-offset-relative-to-waypoint/3622/9 "2025-01-29T21:50:01Z")

</div>

@eric.feldmann hit the nail on the head, thats essentially what I ended up doing with a Plane. It would be so easy to add a quick feature to the GUI to do this. Other robots have either a simple command or a GUI feature, UR makes this nessesity a struggle.
