Hi kalimeras61 and also other interested people.
I will explain how the ikine works with one example.
All the angles are in degrees !
My robotconfig has these values (in mm):
H = 165
E = 155
F = 155
G = 85
The servo’s of this robot has following ranges:
servo: min and max in degrees
sv1: -90 and 90
sv2: 0 and 135
sv3: -150 and 0
sv4: -90 and 90
The target position is the following:
px= 65,6393583641561
py= 5
pz= 165,785186268066
And thegripper makes 164,6 degrees with the positive Z axis !
Z_angle= 164,6
Question: find values theta1,theta2,theta3 and theta4
Solution:
With px and py you can find theta1:
theta1 or phixy= 4,35602560258367
Now you have to find the wristposition pxw,pyw,pzw:
pxw= 43,1322919852168
pyw= 3,28555100629763
pzw= 247,733295627966
This wristposition must be 85 mm from the target position px,py,pz.
If you check this, you see that: linkdist= 85
Now we have to find the first three angles: theta1, theta2 and theta3
We already know theta1. theta1 is 4,356 or -175,644 degrees
Next we calculate theta3:
theta3 is 144,945 or -144,945
Now we have to calculate theta2. Theta2 has to be calculated in respect of theta1 and theta3. So we have 8 combinations:
column1=theta1,column2=theta3,column3=theta3
column4=theta4 is zero for now. This will be filled in later
----- first 3 angle solutions---------
4,356 -10,076 144,945 0,000
4,356 -10,076 144,945 0,000
4,356 134,870 -144,945 0,000
4,356 134,870 -144,945 0,000
-175,644 -169,924 -144,945 0,000
-175,644 -169,924 -144,945 0,000
-175,644 45,130 144,945 0,000
-175,644 45,130 144,945 0,000
In this matrix every uneven row is the same. But this is for later.
Now that we know theta1,theta2 and theta3, we can calculate theta4 for each row:
----- ALL angle solutions---------
4,356 -10,076 144,945 150,530
4,356 -10,076 144,945 -150,530
4,356 134,870 -144,945 64,524
4,356 134,870 -144,945 -64,524
-175,644 -169,924 -144,945 150,530
-175,644 -169,924 -144,945 -150,530
-175,644 45,130 144,945 64,524
-175,644 45,130 144,945 -64,524
This matrix gives all possible robotconfigurations. The 8 rows are only in the case of a 6 DOF robot. But here we have only 4 DOF.
So now we have find the rows from where the forward transformation is close to the target point. If the this distance is smaller than 0,1 mm then
we have a correct POSSIBLE robotconfiguration.
When we apply this method we become next situation:
----- Calculated results ---------
4,356 -10,076 144,945 150,530
4,356 134,870 -144,945 -64,524
-175,644 -169,924 -144,945 -150,530
-175,644 45,130 144,945 64,524
The 4 rows that we become here are the 4 real possible configurations of the robot. But in practice the servo’s that are used have their ranges (see above).
This means that only a few solutions (or 1 solution) will be the PRACTICAL solution !!
So when we check these angles with the servo ranges we see that only row 2 is the exact solution:
4,356 134,870 -144,945 -64,524
In the case that there are two (or more) solutions. My program takes always the first chosen row.