Direction Z move with using UR Script

Hi,

I have a UR10e robot and a distance sensor that sends me distance values (INT) from the PLC. I would like to use this distance information to move the robot downwards. For example, if I receive a distance value of 600 mm, I need to send the robot down by 580 mm. I can use directional movement with the expression ‘if the distance value is <= 20 mm’, but due to communication delays between the PLC, UR, and the sensor (caused by slower UR communication), sometimes I am not in the correct position. Therefore, I would like to directly input the distance into the ‘Directional movement in the Z-axis’ until the desired distance is reached. Unfortunately, it is not possible to input the expression into the ‘Until - Distance’ option.

Is possible to do that with script?

Example for Direction move with distance:
image

Hi, now I found this:

Is it correct or would it be better to use something else?
Thanks

Hi @m.mach,
you could also use function get_actual_tcp_pose(), which is more efficent then calculating kinematics.

2024-03-22 19-05-29

1 Like