Hi @francis
If you want to program just a rotation, you have to keep in mind that the last 3 elements in the pose array are of a rotation vector type. We cannot, or at least very difficultly, interpret this. When we want a rotation, we think in the “RPY” type.
This means that, if you want a rotation of 179deg around your y-axis of your chosen TCP (your Y-axis points outward of the tool flange), then you can accomplish this by doing these steps:
-
A rotation of 179deg, transform it to radians:
rot_rad_rpy = [0, d2r(179), 0] -
This “rot_rad_rpy” as we interpret is, is of the type “RPY”. So we need to transform it “Rotation vector”:
rot_rad_rotvec = rpy2rotvec(rot_rad_rpy) -
At this point, we have a rotation, of the type “rotation vector”. Now all that is left, is to tell the robot to use this rotation around your TCP, which you already did correctly in your code:
new_pose = pose_trans ( get_actual_tcp_pose(), p[0, 0, 0, rot_rad_rotvec[0], rot_rad_rotvec [1], rot_rad_rotvec[2] ] )
When you try this, you will see that the robot will turn correctly.
Keep in mind that this is a rotation around your TCP Y-axis. If you kept the TCP as default (so Z pointing outward), then in the first step you would need to do: rot_rad_rpy = [0, 0, d2r(179)]
If you have any questions, feel free to contact me.
Kind regards
Dieter