I am trying to understand how to draw coordinate system for forward kinematics. Figure is enter image description here

Could someone please explain how is the coordinate system drawn as per DH parameter? Basically when do we have to shift the origin of a frame and when not?

P.S: I mainly do not get how they drew frame 2. Why was it not shifted to frame 1's position?


1 Answer 1


The steps to define a frame for the DH parameters are the following:

  • $Z_n$ axis in the direction of motion of joint $n-1$
  • $X_n$ axis such that it is perpendicular to both $Z_n$ and $Z_{n-1}$ and runs from $Z_{n-1}$ to $Z_{n}$ (this defines the origin). The special case here is when both Z axes are parallel and thus there are infinite solutions. In this case, you just choose one.
  • $Y_n$ axis to complete the right hand rule

What this means is that frame $n$ moves with joint $n$ even though its $Z$ axis passes through the axis of $n+1$. This can be confusing. I'll go through each frame in your example which will hopefully make sense:

  1. Does not move. $Z_0$ goes through joint 1 $X$ goes anywhere you like perpendicular to $Z$ and $Y$ follows.
  2. $Z_1$ goes through joint 2. When it comes to $X_1$, we are in the special case. Take the $X_1$ currently drawn on your diagram and shift down so it intersects $Z_1$ lower than the joint 2. Is it still perpendicular to $Z_0$ and $Z_1$? Does it still run from $Z_0$ to $Z_1$? Yep. There are infinite choices at all the possible heights which are all valid. This particular choice makes sense because it places the origin right in the middle of joint 2. So if we wanted to know the pose of joint 2, we could just take the transform of frame 1. $Y$ follows as always.
  3. $Z_2$ goes through the axis of joint 3 (which is a linear axis). This is one reason why frame 2 could not be in frame 1's position, frame 2 must have a $Z$ passing through the axis of joint 3 and frame 1's position does not lie on this axis. For $X_2$, we are in the special case again. Again the choice to put $X_2$ at the origin of joint 3 makes it easier to identify the location of orientation of joint 3 without an extra transform.
  4. $Z_3$ goes through the axis of joint 4. Again we have a special case and again the choice makes things convenient.
  5. End-effector frame: Technically you could choose any $Z_4$ here, but your choice would influence where you can put your origin. If you choose $Z_4$ as parallel to $Z_3$, we get the special case again, and can easily place the origin at a particular point of interest. This is the most common method for the end-effector frame.

Some notes:

  • In some cases, you may want to choose a different end-effector $Z$, like if you had a camera on the end and cared more about the orientation of the line-of-sight. This would however constrain your origin to a particular position that may not be the 'location' of the camera.
  • When given a free choice with the $X$ axis, your choice does not affect any of the subsequent frames. You could slide the current $X$ choices up and down their $Z$ axes as much as you like and none of the rules would be broken.
  • There's actually another special case, whereby the $Z_{n-1}$ and $Z_n$ intersect. The $X$ axis is the normal to the plane they form, but it's direction is a free choice, so there are two solutions rather than the usual one (or special infinite).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.