# Home position of robot created using modified DH Parameters doesn't match the real robot

I have created a 6-DOF robot using RigidBodyTree() method and modified D-H parameters using robotics toolbox in MATLAB.

The modified DH parameters for the robot are as follows: I have followed the example here: https://www.mathworks.com/help/robotics/ref/robotics.rigidbodytree-class.html#bvet6e8

To bring the robot to its actual home position (position of the real robot when encoder values read 0), I have to pass specific theta (DH Parameter) values: [0 -pi/2 0 0 0 pi].

However, there are discrepancies in the joint values for home position of robot created using DH parameters and that of the actual robot.

For actual robot and its simulators, passing a joints value of [0 0 0 0 0 0] gets to the home position.

The visulaization of robot created using robotics toolbox using DH parameters and that of the simulator are shown below:   This creates problems during inverse kinematics. For the same home position (4X4 transformation matrix), the joint angles are different for real robot simulator and robot created using modified DH parameters ([0 0 0 0 0 0] vs [0 -pi/2 0 0 0 pi]).

The DH parameter method ignores theta values when creating robot. How can I match the home configuration of the robot to the real robot?

To bring the robot to its actual home position (position of the real robot when encoder values read 0), I have to pass specific theta (DH Parameter) values: [0 -pi/2 0 0 0 pi].

Correct; that's what it looks like in the last column of your table: The DH parameter method ignores theta values when creating robot. How can I match the home configuration of the robot to the real robot?

Write a simple adapter to convert to and/or from the configurations you want to use.

For example, you could do something like:

function outputAngles = ABBInverseKinematics(desiredPose, initialThetas)
rawOutputAngles = InverseKinematics(desiredPose);
outputAngles = rawOutputAngles + initialThetas;
end


Your problem ultimately just boils down to the fact that the default position in your robot's frame (all zeros) doesn't correspond to the default position in your DH frame (your theta list). They're only (and always) separated by the initial values, so you either add or subtract the initial values appropriately, for forward or inverse kinematics, and you're done.

• Thanks @Chuck for the answer! Your answer intutively seems correct, but after testing many scenarios, the adapter function seems to be something like this: outputAngles = rawOutputAngles + abs(initialThetas). It looks like just adding initialThetas doesn't match the simulator pose. I am guessing this has to do with -pi/2 ("negative" second joint angle) in the theta vector. I can't seem to find a logical explanation for this. Do you know why absolute value of angle result in correct pose?
– Rock
Jun 3, 2019 at 22:55
• There were cases when adding initial thetas to rawOutputAngles resulted in angles out of physical joint limits. This can be easily solved for joint 6 (-400 to +400 rotation) by subtracting 360 degrees. What about incase of joint 2? Its not a simple spherical joint
– Rock
Jun 3, 2019 at 23:03
• @Rock - You can clamp the joint values by doing something like clampedAngle = rawAngle - floor(rawAngle/360)*360; If your angle were -10 degrees, floor(-10/360) becomes -1, so you wind up with -10 - (-1*360) or -10 + 360 or 350. I'm not sure what you mean when you say joint 2 is "not a simple spherical joint" - do you mean not a revolute joint? If it's a prismatic joint then the theta value should be fixed, I believe; the distance d would vary. Regarding your absolute values issue, it might be a sign problem; try outputAngles = rawOutputAngles - initialThetas instead.
– Chuck
Jun 5, 2019 at 13:30