Shift On and Shift Off

I have an application where I have a layer of waypoints in the same plane. Is there a way to take a chunk of waypoints in my code, and temporarily add the same cartesian value in the base frame to each pose?

Below is an example snippet of my polyscope code:

MoveL
waypoint1
waypoint2
waypoint3
waypoint4

One way I can do what I want (very long if you have a bunch of points that all need to change the same amount) is by doing:

x = waypoint1
x[2] = .2
movel(x)

But… the above method is super long and tedious if I have many way points on many different planes to do… I also need a bunch of unnecessary variable names and lines of code.

I wish there was a way to do:

If plane 1,
Shift following points in z direction +.2 with respect to the base frame
waypoint1
waypoint2
waypoint3
waypoint4
Turn off shift points

In the above method, my points would retain their original value after the shift in points is switched off.

Any help would be tremendously appreciated!!!

Another way I thought of doing this was storing the shift in a variable and then writing moveL commands in script… but I don’t know if syntax exists for this method…

x = .2
movel(waypoint1, waypoint1[2] = x)

So like move to waypoint1, but modify waypoint1 z value to temporarily be equal to x.

How about shifting the planes? You should likely have a fair amount less planes than waypoints. :slight_smile:
Assign the plane to a variable and add a variable offset to the required coordinate(s). Then you can change the variable offset to shift all planes at once?

You can take a look here: Move with Offset - #22 by m.hammerton
There’s another thread very similar to yours, as far as I can tell.

Thanks! From the link you sent, I found a single line of code that does what I want:

movel(pose_trans(waypoint1,p[0,0,offset,0,0,0]))

HOWEVER, it does still require me to write a line of code for EACH waypoint that I want to offset…

It seems like creating a plane would be way more efficient. How can I set a plane to a variable and then offset it? I didn’t see code for this at all.

Also, is there a way to group waypoints in an offset using path_offset_enable/set/disable? I ran into controller errors when I tried to write code for this… :frowning:

Might not have been the best explanation from me. :slight_smile: You should be able to choose a plane in an Assignment-command. Then you can do something like:
YourPlane := p[YourPlane[0],YourPlane[1],YourPlane[2],YourPlane[3],YourPlane[4],YourPlane[5]]

This allows you to alter each coordinate to your liking. For example:
YourPlane := p[YourPlane[0],(YourPlane[1]+Y_Offset),YourPlane[2],YourPlane[3],YourPlane[4],YourPlane[5]]

Y_Offset being a variable or a value, of course.

I don’t know about the path_Offset function, I’m afraid. :slight_smile:

efn! THANK YOU! I was able to do exactly as you said. I made two planes, one that was my reference plane (stays the same) and then an ‘adjusted plane’. My ‘adjusted plane’ was always equal to the reference plane in an assignment, but with an added z-shift depending on what I wanted to do in my code.

THANKS! This saved me a bunch of time, but ultimately made my code way simpler than I thought it would become.

That’s good to hear. :slight_smile: Good idea with the reference plane and adjustable plane, too!

Glad I could help.

For future reference, the e-Series e-learning track on UR-Academy has a nice module introducing feature coordinates.

https://academy.universal-robots.com/free-e-learning/e-series-e-learning/e-series-pro-track/

This doesn’t cover adjusting those planes programmatically however. If you need to apply the same offset each time as seems to be the case above, the easiest way to do this without getting into pose_trans() scripting, would be to create two identical features in Polyscope, then use the Edit function to offset one of them in the desired direction.

1 Like