Universal Robots Forum

How to make TCP move along tool coordinate by script

Hi sir,

I want to move TCP along X, or Y or Z axis of tool coordinate by script. I know how to move TCP in base by script. The following is the function to move TCP in Z direction in base by script. Can anybody tell me what to do in tool coordinate instead of base coordinate?

def CUR_MoveZ(a, b, c):

Move up to safe postion after place

a is distance of m

b is acceleration of m/s^2

c is speed of m/s

pos = get_actual_tcp_pose()
movel(pos, b, c)


Hi @danielwu,

Please take a look at the pose_trans() command in the URScript manual. If you pass the result of get_actual_tcp_pose() to pose trans as the first argument, any X, Y or Z offsets specified in a pose as the second argument will be relative to the tool frame. You can then pass the result of this to your move command.

Or you could nest them all together in one line:

movel(pose_trans(get_actual_tcp_pose(),p[0.1,0,0,0,0,0]),b, c)