## Denavit Hartenberg Frame Assignment Sheet

**Calculating the Forward Kinematics is often a vital first step to using a new robot in research. While there are some good tutorials available online, up until now there hasn't been a simple step-b****y-step guide for calculating Forward Kinematics. In this post, we provide a simple guide along with some tips on calculating the kinematics of any robotic manipulator.**

**Calculating kinematics is a cornerstone skill for robotics engineers.** As we've discussed previously, kinematics can sometimes be a pain. However, being told to "go and calculate the Forward Kinematics" is almost robotics research shorthand for "go and get familiar with this robot".** It's the vital first step when using any new robot in research, particularly for manipulators. **

Even though I had learned the theory of kinematics in university, it wasn't until I had calculated various kinematic solutions for a few real research robots that the whole process started to feel intuitive. Even then, because I was not calculating kinematics every day I had to go back to my notes to "remind myself" how to do it every time.

**It would have been really helpful to have a step-by-step guide to remind myself which stages to go through**, without having to read through hundreds of pages of academically written equations in text books. A sort of kinematics "cheat sheet" would have been useful. **This post is exactly that sort of cheat sheet.** For now, we'll primarily focus on the Devanit-Hartenberg (DH) approach to Forward Kinematics, as it's the most common, and we'll get to Inverse Kinematics in a future post.

**We hope you find it useful! **

## Step 1: Get a Pencil and Paper

It can be tempting to jump straight for the computer when starting out with a new robot. However, even if the robot looks like a "standard" 6R manipulator **I always sit down with a pencil and paper to draw out the kinematic diagram**. This simple task forces you to carefully consider the actual physical configuration of the robot, avoiding false assumptions which can wreak havoc later on during coding.

There are various ways to draw a kinematic chain. Pick whichever style you prefer. I favor simple cylinders for the revolute joints and lines for the links. Do a Google Image Search for "kinematic diagram" and see some of the different styles available.

**As you draw, work out which way each joint moves and draw this motion as double-ended arrows onto the diagram. **

## Step 2: Figure Out Your Axes

The next key step is to draw the axes onto each joint. **The DH approach assigns a different axis to each movable joint. **

If you set up your axes correctly then working with the robot will be easy. Set them up incorrectly and you will suffer countless headaches. These axes will be required by simulators, inverse kinematic solvers and even other researchers (nobody wants to solve a Forward Kinematic solution if someone else has already done it).

**The z-axis should lie on the axis of rotation, for a revolute joint, or axis of extension, for a prismatic joint.** Have a look at this video to see how to set them up. **The x-axis should lie ****along the "common normal"****, which is the shortest orthogonal line between the previous z-axis and the current z-axis **(seriously, watch the video).

Personally, I draw the axes using the following coloring: **z-axis (blue)**, **x-axis (red)** and **y-axis (green)**. This is the coloring scheme that's used in the RViz visualizer from ROS. Back in my undergraduate days, our lecturer made an axis "sculpture" out of three colored straws stuck into a sphere of blue-tack to explain the theory to us. Though this might seem a bit "playschool," it can sometimes actually be helpful as you can position the sculpture next to the physical robot to make sure you've got the axes pointing in the right direction. For a virtual version of this, check out this interactive tool.

## Step 3: Remember Your End Effector

**The goal of calculating the Forward Kinematics is ****to be able to calculate the end effector pose from the position of the joints. **

Most Forward Kinematic tutorials will generalize the end effector as a single distance from the final joint. This is fine for a simple "open-close" gripper. However, as modern grippers are often more complicated than this, it's worth considering how the end effector operates. The Robotiq 3-Fingered Adaptive Gripper, for example, has a few different gripping modes. Each mode will correspond to a slightly different desired end effector pose. **You should consider the end effector carefully when formulating the kinematic model.**

## Step 4: Calculate the DH parameters

Denavit-Hartenberg parameters are often required to enter the robot model into a simulator and start performing any sort of analysis on it.

**The best way to visualize the DH parameters is to watch this video** (it's the same video as in the previous step, but really watch it).

**The DH parameters break down each joint of the robot into four parameters, each taken with reference to the previous joint.** They are calculated in reference to the "common normal" described above. Note that if the previous z-axis intersects the current z-axis, which is often the case, the common normal has a length of zero.

- the distance between the previous x-axis and the current x-axis, along the common normal*d*- the angle around the z-axis between the previous x-axis and current x-axis.*θ***a (or r)**- the length of the common normal**α**- the angle around the common normal to between the previous z-axis and current z-axis.

**Go through each joint on your drawing and write down the DH parameters for each joint. Each joint should have one value which is a variable, representing the actuated joint.** For a more detailed explanation and some examples, I recommend this handout by Peter Corke or this chapter from Introduction to Robotics.

### Alternatives to the DH parameters

The DH approach is the most common approach to Forward Kinematics, but it's not perfect. One of its failings is that it doesn't handle parallel z-axes very elegantly. **There are various alternatives, including Screw Theory representations, Hayati-Roberts and other geometric modelings** (see this paper for a comparison). Although these may (or may not) be better approaches, most of the kinematic libraries below do accept the DH parameters and for that reason it's a reasonable approach to begin with.

## Step 5: Choose Your Library

**There are loads of kinematic software libraries and many of them do far more than just calculate Forward Kinematics.** Most of them include Inverse Kinematic solvers, dynamics, visualization, motion planning and collision detection, to name just a few features. **These libraries will transform your DH parameters into matrices, which are then multiplied together to calculate the relationship between joint positions and end effector pose.**

Of course, you can also quite easily "roll your own" Forward Kinematic library using your favorite programming language, if you're inclined that way. I've taken this approach myself, but apart from being a good learning exercise it didn't offer many more benefits than using an existing library.

**Some good development libraries include: Robotics Library, Orocos Kinematics and Dynamics Library, ROS MoveIt, OpenRave, RoboAnalyzer and the Matlab Robotics Toolbox.**

Even though you'll usually require Inverse Kinematics to actually control the robot, computing the Forward Kinematics is a necessary step to get familiar with any new robotic arm. If you found this post useful, make sure to bookmark it so you can find it when you next encounter a new robot.

*What is your favorite method of getting familiar with a new robot's kinematics? Do you prefer another method over the DH parameters? Have you got any questions on implementing Forward Kinematics in your research robot? Tell us in the comments below or join the discussion on LinkedIn, Twitter or Facebook.*

A video showing an animation explaining the assignment of DH parameters may be found at [2].

The default settings give a three-link anthropomorphic manipulator arm, so named because the joints map to a waist, shoulder, and elbow rotation:

(Here * indicates the moving joint variable, other parameters are constant.)

Anthropomorphic manipulator arms are often used in assembly lines for welding, painting, and construction.

The snapshots show, in order:

SCARA arm, the Selective Compliant Articulated Robot for Assembly, has two revolute joints and one prismatic joint:

SCARA arms are often used for pick and place tasks on conveyor belts.

A three-link cylindrical robot, an early robot model with one revolute joint and two prismatic joints:

One reason cylindrical robots were popular is because they have simple inverse kinematics that are specified in cylindrical coordinates.

A three-link planar revolute robot:

Three-link planar robots have a disc-shaped workspace that they can reach. The extra joint enables them to achieve desired angles of the end effector (the robot hand) in a subspace of the reachable workspace. This subspace is called the dexterous workspace.

A spherical wrist:

A spherical wrist can be used to achieve any desired orientation of the end effector. Often a spherical wrist is attached to the end of a three-link robot such as a SCARA, anthropomorphic manipulator, or cylindrical robot.The first three joints are used for position control and the spherical wrist is used for orientation control.

References

[1] M. W. Spong, S. Hutchinson, and M. Vidyasagar, *Robot Modeling and Control*, Hoboken, NJ: John Wiley & Sons, 2006.

[2] E. Tira–Thompson, prod. *Denavit-Hartenberg Reference Frame Layout* [Video]. (Jun 15, 2016) www.youtube.com/watch?v=rA9tm0gTln8.

## One thought on “Denavit Hartenberg Frame Assignment Sheet”