Universal Robots Forum

TCP alignment with robot base axis

I am working with a UR10e. I am using a stereo camera to align the TCP with the plane in front of it. After this operation, the x-y plane of the TCP is parallel to the working plane, but the z-axis is keeping the same orientation it has at the beginning. Now, I want to change the TCP z-axis orientation to align the TCP y-axis with the base z-axis rotating only around the z-axis of the TCP to keep the TCP x-y plane parallel to the working plane. Any idea how to do that?

Thank you in advance

If you already have the TCP at the correct X,Y position, one option you have is to use pose_trans or pose_add to add the Z to the actual pose. Something similar to this example but with real pose values:

pose=p[100,200,300,2,3,1]
newpose = pose_trans(pose, p[0,0,0,0,0,d2r(zdegrees)])

If this doesn’t work as expected, another option is to transform the actual pose to joint values and then add the z value to the last joint and then move to that joint vector.

pose=p[100,200,300,2,3,1]
pinv = get_inverse_kin(pose)
zrot = d2r(desired_z_in_degrees)
newpose = [pinv[0], pinv[1], pinv[2], pinv[3], pinv[4], pinv[5]+zrot])

Also, I’ve found this on the forums: https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/simple-vision-system-23871/

Hope it helps!

Hi Roman!
Thank you for your fast response. I knew already the command pose_trans. I use it a few times in the robot algorithm so far. Following your example I can do:
pose = get_actual_tcp_pose()
newpose = pose_trans(pose, p[0,0,0,0,0,d2r(zdegrees)])

The problem is how to find the angle zdegrees in order to align the TCP y-axis with the base z-axis rotating only around the z-axis of the TCP to keep the TCP x-y plane parallel to the working plane.

I will try to explain better why do I need this. The robot starts the movements in a random position in front of a vertical working plane with random orientation and position. I use the stereo camera to align the x-y TCP plane with the vertical working plane. The used tool has a one-side asymmetry, so I need to approach the final point with a specific ‘z’ tool orientation. That’s why I want to align the TCP y-axis with the base z-axis.

I hope it is clear now. Thank you for your help.

Don’t translate around the tool, translate around your plane. The plane should have an origin pose that you can then use to move around relative to the plane. This will align the TCP to the plane. Make sure you know which way the Z axis of your plane points and ensure that it points in the same direction as the TCP z axis, if not you will need to rotate the plane around either the X or Y axis 3.14 radians to orient the two coordinates.