I want to turn the position around the TCP like in jog mode does
The first try was to add the value to the position:
$TOOL = TOOL_DATA[1]
$BASE = BASE_DATA[3]
e6pOffsetPos.B = e6pOffsetPos.B + 50
PTP e6pOffsetPos C_DIS
Then I tried the geometric operator ":"
$TOOL = TOOL_DATA[1]
$BASE = BASE_DATA[3]
f = {X 0.0, Y 0.0, Z 0.0, A 0.0, B 50.0, C 0.0}
PTP e6pOffsetPos:f C_DIS
TOOL_DATA[1]={X -22.5370,Y 145.857,Z 177.617,A 0.0,B 0.0,C 0.0}
somehow I know that the geometric operator works if I change A, B, C of $TOOL correctly. Direction to the grap object. That means a diferent orientation does need other A, B, C of $TOOL and its not very intuitive to get it...
is there a easier way to do this or to understand this?
You are really close! KUKA uses the Euler ZYX system to calculate the TCP orientation. This means that three rotations happen in a specific sequence to achieve the final orientation. The order is:
hence, Euler ZYX.
In order to do a rotation, similar to how TOOL TCP jog operates, you need to do a frame transformation from your current position to the target position. If you want to rotate about the current B axis, it takes more than just a B adjustment of POS_ACT to get there, because the B rotation is only a part of a sequence of rotations where you end up.
So our main program should have some code like this:
Now lets write code to support that function. I make a math_library.src:
mat_to_rot, and rot_to_mat are used to convert between a 3x3 rotation matrix and A,B,C angles. I won't go into detail about rotation matrices, but they are fundamental for doing rotation math like this. I know this is a huge mouthful, and there are probably better ways, but I've never had any regrets adding this code to a global math library and throwing it on my robots just in case.