Denavit–Hartenberg (DH) parameters are a convention used by robotics experts to mathmatically describe the size and range of a robot’s bones. Today we’re going to look at what they mean and how they’re used.

## What do these Denavit–Hartenberg numbers mean?

If you’re into this then I assume you already know about matrixes and how a robot has a local origin matrix. In the geef above you can see the local origin when DHBuilderApp is selected, and the location of each joint matrix as they are selected. The D-H values for J0 build on the robot’s local origin and J1 builds on top of J0 and so on.

So starting from J0, how do we get to J1?

• D is the distance along J0 Z axis to translate. (25cm)
• R is the distance along J0 X axis to translate.
• Theta is the angle to rotate around the J0 Z axis.
• Alpha is the angle to rotate around the J0 X axis. (90 degrees)

There is no option for Y axis, and this is very deliberate. If you need a Y axis, rotate theta 90 degrees and use X. Another part of the convention (I am told) is that 6DOF robot arms – once set up – use only the Theta value when they’re in motion. These restrictions combined can lead to some strange and unusual matrix locations – but they work!

For example, J0 is pointing Z sideways. Remember that the parameters describe how to get to J0. Changing Theta will rotate J0 around the local origin. Changing J1 Theta will rotate the bicep around J0.

This video might help:

## Denavit–Hartenberg matrix math

To keep my brain from frying I used degrees wherever a human can see a number and deep in the code I convert those to radians. I build each joint matrix in Java like this:

``````/**
* Set up the pose based on D-H parameters, then update the worldPose.
* Equivalent to T(n) = TransZ(d) * RotZ(theta) * TransX(r) * RotX(alpha)
*/
public void refreshPoseMatrix() {
double t=theta.get();
double a=alpha.get();
Matrix4d m = new Matrix4d();

m.m00 = ct;
m.m01 = -st*ca;
m.m02 = st*sa;
m.m03 = r.get()*ct;
m.m10 = st;
m.m11 = ct*ca;
m.m12 = -ct*sa;
m.m13 = r.get()*st;
m.m20 = 0;
m.m21 = sa;
m.m22 = ca;
m.m23 = d.get();
m.m30 = 0;
m.m31 = 0;
m.m32 = 0;
m.m33 = 1;

//System.out.println(letter.get() + "="+m);
setPose(m);
}``````

## D-H Shortcut

Robot Overlord 1.6.0 has a DHBuilderApp featured in the gif above. It makes it easy to load the STL bone designs of your robot (name each one after the appropriate joint letter), set up your D-H parameters, and then press the “start test” button. While the test is running you can use forward kinematics to twist and turn your arm. You can even move the End Effector Target object and your model will automatically move to try and match the target pose.

## Final thoughts

Find out more about D-H parameters on Wikipedia.

As always like, share, subscribe, and tell your friends. See you next time!