Alignment with ur script

Hi everyone,
as i leanred i have to accept some overshooting/positioning tolerance by using servoj() based movement.
To prevent kind of integrating these errors happening by lining up several script blocks i would like to ‘reset’ them by aligning the tool to the z-axis of the actual feature. Like it’s done with polyscope ‘align’-button, by a script.
Is there a way doing it via script?
Is my method using scripts to assemble a sequence of movements bad- is there a better way?

Thanks in advance!

Hi @mahler ,
maybe you can try something like this to align:

actual_pose = get_actual_tcp_pose()

actual_pose[3] = feature_pose[3]
actual_pose[4] = feature_pose[4]
actual_pose[5] = feature_pose[5]

movel(actual_pose)

align

Hi @mahler

I had the same problem but now I was able to figure it out.

You need to get the actual tool pose to your feature, you can do this with pose_trans(pose_inv(feature),get target_tcp_pose())
After that you convert your Rotation vectors to RPY, after that you set Rx=180 and Ry=0 and than convert it back to rotation vector and use it in a variable waypoint.

Hi Robpod and Geri,
thank You both for Solutions. I will try and use it solving my issue!
Best regards