Using offset in a defined plane

Hello, I’m trying to move the UR10e robot from one position to another using an offset. I can achieve this in the robot’s base plane, but I’m having trouble applying the offset in a custom plane that I created. How can I make it work?

I believe this Atricle is what you are looking for in using features.

If you’re like me and the articles still leave you scratching your head, here’s a function I’ve written that I use A LOT for basic shifting with respect to other planes.

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

This function returns a pose, so I usually assign a variable to it. Just pass in the x, y, and z offset IN METERS, then pass the Feature you want to shift with respect to, and finally the pose you want to shift.

You’re right that it’s difficult figuring out how to do it. The correct way is to do as Eric is doing. :slight_smile:

If you want to do it in PolyScope without script, it will look like this:
image

This code will move the tool 2cm in the Y direction of the Tool feature. :slight_smile:

For just moving an offset relative to a feature you just need to use pose_trans. We have done this for years when defining planes and then wanting to pick along a grid on that plane for instance or pick from a camera position.

I don’t believe you need to do all of the pose_add, pose_inv math that is in those scripts just for a move.

From the article here is how we have always done this.

So the feature with regards to base pose would be the plane that you have defined and the pose with regards to feature would be the offsets you are trying to achieve. Realize that with this method the rotations would be relative to base frame, not the feature frame, that is one of the weird things about this but offsets would be in the plane you have defined. So if the plane is rotated relative to the base plane your translation offsets will be applied relative to that rotation just not rotational offsets.

1 Like

Would you look at that. :slight_smile:
I believe you’re right. At least for the example I presented.

This code will indeed shift the robot 10cm along the X axis of the Tool feature from its origin and also rotate 1.4 rad around the Z axis of the tool. So rotation works, too (not sure if that’s what you meant, @mbush).

If you use a custom plane instead of Tool, it should also work just fine, yeah. Just input the coordinates in the second expression for your desired position in the feature.

EDIT: Then again. My example might be necessary, if you use the get_actual_tcp, since the coordinates you’re getting are related to the base and not the custom feature.
How would you go about moving relative to the robot’s current position with just the trans(feature, pos)?
What is happening is the current position is first translated to the custom feature, before the offset is added. :slight_smile:

I tried using pos_add on an already translated position, which made it move weirdly. But I got it working now as intended.
Thanks for the help! :slight_smile: