# How does Fanuc calculate its Forward Kinematics, on a m20ia robot?

• Hello,

Recently I tried to write a python code to calculate forward kinematics of a m20ia Fanuc robot, but I always get different cartesian values than there is on the TP.

I am pretty sure my code is correct but I am not sure at all of the joints value I use and the method of forward kinematics of the robot.

I am using the same DH table of the robot (found in the system variable) and the joints values (found in the position panel of the TP).

Anyone knows if there is some parameters, that I don't know, that are used to do forward kinematics in the teach other than the DH parameters and the Joints values?

• ## 95devilsJul 10th 2023

• Isn't that only when doing inverse kinematics?

when you have the cartesian coordinates and you want the joints values.

In my case I have the joints values that already define the robot position.

• How far are you off? Are you aware of Fanuc's representation of J3 is not relative to the previous joint, but relative to the angle of how far away it is from the XY Plane?

Check out the Fanuc position converter I wrote here! Now open source!

Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

• To build my DH table I search on the robot in the system variable, to get the the same DH table that the robot use.

I found on an other post that J3=J3+J2 and J2=-J2.

Using the same joints values and the DH parameters found in \$Param.Group[1], I get :

- Robot : x = 1062.652, y = 275.386, z = 893.017, rx = 179.926, ry = -62.092, rz = 14.611

- PC : x = 779.989, y = 860.000, z = 319.036, rx = -61.01, ry = -58.72, rz = -115.34

• Whats the difference of those frames? Is it always the same difference no matter what? How does the difference chance when moving a single axis? Is translational/orientational difference constant? ...

This are questions I would ask myself as well.

Fubini

• I actually would start with simple values for the angles (like all are set to 0).

In a next step set J2 to 90

Or as I said earlier have a look to RoboDK

• After taking account of the correct value of the joints (j2 = -j2 and j3=j3+j2) and making the dh table that fit the most my robot, when I compare my result on Python and in RoboDK, I get the following :

If the joints values are 0° :

- PC and RoboDK are the same trans and Rot ;

Else :

- Translation are the same on Python and RoboDK but for Rotation I have Python_rx = RoboDK_rz and Python_rz = -RoboDK_rx and Python_ry = -RoboDK_ry

Here is the DH table that I use after some corrections (for the Fanuc m20ia/35M):

Tr on X-axisRot on X-axisTr on Z-axisRot on Z-axis
000theta[0]
150math.pi/20theta[1]+math.pi/2
79000theta[2]
150-math.pi/2-860theta[3]
0math.pi/20theta[4]
0-math.pi/2-100theta[5]
0math.pi00
• Oh! oups I had an error in my code when calculating the Euler angles. To get the Euler angles I calculate the arc tangent of the ratio between part of my rotation matrix.

Now I always get the same values between my code and RoboDK, but my real robot has totally different values.

• After some verification, I found that my DH table is different between my robot and my code. Is there some hidden correction in the robot to get a better kinematics?

• Can you give me the axes values for this position:

- Robot : x = 1062.652, y = 275.386, z = 893.017, rx = 179.926, ry = -62.092, rz = 14.611 ?

I just want to double check and then give you the dh parameters you are looking for.

(dh parameter for standard dh transformation - not dhm transformation)

• Note that since Fanucs place their origin at the intersection of J1 and J2, you can ignore the 330mm from the base to J2.

Thanks to Nation now I know why the 525mm in this case does not count!

But I have another question:

In your post #12 I found this line:

 Joint 3 DH parameters 90 20 0 θ3-θ2+90

I have to use p[2]+p[1] instead of your p[2]-p[1]+90 to get correct pose

p[2]+p[1]: axis 3 horicontal

p[2]-p[1]+90: axis 3 vertical

What do I miss?

• Can you give me the axes values for this position:

- Robot : x = 1062.652, y = 275.386, z = 893.017, rx = 179.926, ry = -62.092, rz = 14.611 ?

I just want to double check and then give you the dh parameters you are looking for.

(dh parameter for standard dh transformation - not dhm transformation)

On the real robot, or in simulation?

I haven't tried in simulation yet, but on my real robot I always reach a singularity when I try to go to these coordinates.

• I am a little bit confused now.

How did you got your values then (I expected from Robot).

In order to double check I would need tool and base, then the axes readings and the correponding position.

I just did the math - no robot.

Using RoboDK I got the axes readings for the given position and the just recalculated the position using my dh parameters

• Oh sorry, I made a mistake (by exchanging two values between them).

Here are the joints value you want on my robot :

J1: 14.529

J2: -0.046

J3: -0. 11

J4: 0.001

J5: -27.896

J6: 0.037

J2/J3 interaction: -0.058

• Ok, I tried your DH table on different coordinates and it work pretty well, Thank you very much.

But can you explain me how did you come up with those DH parameters? I specifically do not understand why you use -theta[3] and -theta[5], is this to take account of a correction of Fanuc?