Moving the robot arm via TCP/IP/URscript in the tool coordinate system


I am creating a screwdriving solution for our UR5e robot where we will be doing the tightening only in one direction - parallel to the robot base axis. This means the screwdriver/tool TCP will always be pointing in the “Z”-direction/towards the table the robot is mounted on.

I will send movement commands to the robot from a text-file where the screw coordinates are defined from a common origin. Then I will define some point in the robot coordinate system as the same origin as in the text-file. This way I should be able to tell the robot to move to a specific coordinate [x_text-file + robot_origin_x, y_text-file + robot_origin_y, z_text-file + robot_origin_z] when I want to tighten a specific screw.

The question is: how do I actually tell the robot to move within the TCP x,y and z-axis? I have tried various move-commands, but either they do nothing or the robot moves to an “arbitrary position”

One example I found on the net suggested me to use “movel(pose_trans(get_actual_tcp_pose(),p[0.1,0,0,0,0,0]),b, c)” but this really didnt move the robot to a wished position.

For example the following command in Python does nothing - it only returns a return value in Windows Prompt

pose = "p[0.7, -0.1, -0.03, 0.824, -3.026, 0]"
s.send(("movej(pose, a = 0.01, v=0.001)"+"\n").encode("utf8"))

s.send((“movej(pose, t = 15)”+“\n”).encode(“utf8”))
s.send((“movej(pose, a = 0.01, v=0.001)”+“\n”).encode(“utf8”))