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

1 Like

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: 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.

Hi Daniel,
I think my reply is a bit late,

if you want to align your tool z axis to your base y axis you can do this with theses line in a script :

def Yalign (Wp):
rpy = rotvec2rpy([Wp[3],Wp[4],Wp[5]])
rv = rpy2rotvec([d2r(90),rpy[2],d2r(0)])
Wp[3] = rv[0]
Wp[4] = rv[1]
Wp[5] = rv[2]
return Wp
end

this script only work in Base workspace,
d2r(90) and d2r(0) align you tool to Y in Base,
rpy[2] is your current tool Z orientation (rad), you can set it to 0 or another value (rad) if you want a specific tool Z orientation.

so if you want to use this script it look like :

P1 = Yalign(Wp1),
movel(P1, a=…, v=…)

Wp1 : your point that not align in Y
P1 : your new point that align in Y

Test it in a large area with low speed the first time,

don’t hesitate to contact me for more info

Yalign.script (226 Bytes)

I Hope this Help.

Hi Daniel,
I had the same question and your reply solved my issue completely. Works great.