Kinematics of a RR Robot

#serial-kinematic robot #kinematics #trigonometric function

Table of Contents

The kinematics of a planar serial kinematic robot with two revolute joints (also called planar RR robot) is quite simple. We will use two approaches" a simple geometric derivation and the concatenation of homogeneous transformation matrices.

The planar RR robot is depicted in the image below, where $F_i$ denotes the frame of the $i^\text{th}$ coordinate system with $e_x$ and $e_y$ as its axes. I am a bit lazy here because those vectors should get three indexes. However, the provided images and the context make it clear. This robot has link lengths denoted by $l_i$ for the $i^\text{th}$ link. Each link has a relative joint $q_i$. For the sake of simplicity, we assume that no self-collision is possible and, the joints are not restricted (i.e., no joint limits). Therefore, $q_i \in \mathbb{S}^1$, where $\mathbb{S}^1$ is a unit circle.

exeyF0exeyF1exeyF2q1l1q2l2

Kinematics provides the pose of the robot with respect to the joint angles. The pose is a list of translational and rotational values. Here, the pose has two translational values and one rotational value. The translational values, i.e., $x$ and $y$, define a vector from the base frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize 0}$ to the end-effector frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize EE} = \mathcal{F}_2$. The rotational value, i.e., $\phi$, is the rotation from $\mathcal{F}\raisebox{-0.25em}{\footnotesize 0}$ to $\mathcal{F}\raisebox{-0.25em}{\footnotesize EE}$. All values of the pose are defined with respect to the base frame $\mathcal{F}_0$. Therefore, the pose $\boldsymbol{X}$ is $$ X = \begin{bmatrix} x \\ y \\ \phi \end{bmatrix} \tag{1} , $$ where the three indices are omitted. The order is a mere convention and, I am not aware of any benefits over other permutations. Sometimes, you can find the use of transpose operator, which is another convenient notation. However, it should be noted that $\boldsymbol{X}$ is not a vector in the sense of being a proper vector.

Trigonometric Relationships

The key in finding the kinematics is to identify suitable triangles or other geometric objects. For the RR robot, we can find two such right triangles, where the hypotenuse has the length of the link and, where each of the catheti is aligned with one of the axes of base frame $\mathcal{F}_0$. The following image simplifies the structure of the RR robot. It shows a stick figure of it.

<sodipodi:namedview id=“namedview1” pagecolor="#ffffff" bordercolor=“currentColor” borderopacity=“0.25” inkscape:showpageshadow=“2” inkscape:pageopacity=“0.0” inkscape:pagecheckerboard=“0” inkscape:deskcolor="#d1d1d1" inkscape:document-units=“mm” inkscape:zoom=“0.1799523” inkscape:cx=“1903.2821” inkscape:cy=“166.71084” inkscape:window-width=“1920” inkscape:window-height=“1011” inkscape:window-x=“0” inkscape:window-y=“32” inkscape:window-maximized=“1” inkscape:current-layer=“layer1” />

The left image shows the relation of the joint angles to the angle within the right triangle. In general, I recommend drawing pictures with positive angles and values. The first one is simply $q_1$, whereas the second one is slightly more complicated. It is $q_1 + q_2$, see the left image for a visualization. This sum is also the orientation of the end-effector denoted by $\phi$. Therefore, we visually derive one part of the pose.

Now, we can find the contributions of each link weighted with a trigonometric function to the $x$ and $y$ coordinates of the end-effector. The image in the middle depicts the contribution due to the first right triangle, whereas the image on the right illustrates the contribution due to the second right triangle. With that, we can sum the sine functions for the $y$ value and, we can sum the cosine functions for the $x$ value.

The pose $\boldsymbol{X}$ is the result of this visual analysis and given by $$ X = \begin{bmatrix} x \\ y \\ \phi \end{bmatrix} = \begin{bmatrix} \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ q_1 + q_2 \end{bmatrix} \tag{2} . $$ Geometry helps a lot and, for this simple example, finding the pose is quite straightforward. For more complex structures, we might want to use homogeneous transformation matrices. Let’s try the vector-matrix machinery for this example.

Transformation Matrices

It is a planar problem. In this case, the transformation matrix of $SE(2)$ is given by $$ T\left(\phi, x, y\right) = \begin{bmatrix} \cos\left(\phi\right) & -\sin\left(\phi\right) & x \\ \sin\left(\phi\right) & \cos\left(\phi\right) & y \\ 0 & 0 & 1 \end{bmatrix} \quad\in\mathbb{R}^{3 \times 3}, $$ where $\phi$ is a rotation along the normal axis of the plane and, $x$ and $y$ are displacements along the $e_x$ and $e_y$ axes, respectively.

To make it easier, we decompose the homogeneous transformation matrix into two simple transformations, i.e., pure rotation and pure translation. Since we deal with matrices, the order of the concatenation of pure rotation and pure translation matters. Thus, we can either rotate first and translate afterward, or vice versa. Both will provide different intermediate results. However, the end result should be the same.

Moving a frame along the kinematic structure should remind us of DH parameters. The two different ways of decomposition should further remind us that two different notations for DH parameters exist.

Rotate, then Translate

Imagine the configuration of the robot to be $q_1 = q_2 = 0$. To go from one frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize $i$}$ to another frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize $i+1$}$, we first rotate around the current frame, then we slide along the $e_x$ of the rotated frame. We rotate and translate by an amount of $q_i$ and $l_i$, respectively. We can see a simple pattern in the transformation matrix, i.e.,

$$ T_i\left(q_i, x_i = l_i, y_i = 0\right) = \begin{bmatrix} \cos\left(q_i\right) & -\sin\left(q_i\right) & 0 \\ \sin\left(q_i\right) & \cos\left(q_i\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & l_i \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} \cos\left(q_i\right) & -\sin\left(q_i\right) & \cos\left(q_i\right)l_i \\ \sin\left(q_i\right) & \cos\left(q_i\right) & \sin\left(q_i\right)l_i \\ 0 & 0 & 1 \end{bmatrix} \tag{3} . $$

The result is $$ T\left(q_1, q_2\right) = \begin{bmatrix} \cos\left(q_1\right) & -\sin\left(q_1\right) & \cos\left(q_1\right)l_1 \\ \sin\left(q_1\right) & \cos\left(q_1\right) & \sin\left(q_1\right)l_1 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\left(q_2\right) & -\sin\left(q_2\right) & \cos\left(q_2\right)l_2 \\ \sin\left(q_2\right) & \cos\left(q_2\right) & \sin\left(q_2\right)l_2 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} \cos\left(q_1 + q_2\right) & -\sin\left(q_1 + q_2\right) & \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2\right) & \cos\left(q_1 + q_2\right) & \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ 0 & 0 & 1 \end{bmatrix} \tag{4} , $$

where I use trigonometric identities to simplify the expressions.

Translate, then Rotate

Let’s express $T$ in Eq.(4) with unsimplified $T_i$ in Eq.(3). This leads to $$ T\left(q_1, q_2\right) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\left(q_1\right) & -\sin\left(q_1\right) & 0 \\ \sin\left(q_1\right) & \cos\left(q_1\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & l_1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\left(q_2\right) & -\sin\left(q_2\right) & 0 \\ \sin\left(q_2\right) & \cos\left(q_2\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & l_2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \tag{5} , $$ where I multiply an identity matrix on the left side to indicate a zero translation and on the right side to indicate a zero rotation. Obviously, both identity matrices do not change the result, i.e., Eq.(4) and Eq.(5) have the same simplified outcome.

For the sake of completeness, the pattern is slightly different. The transformation matrix is now defined by $$ T_i\left(q_i, x_i = l_{i-1}, y_i = 0\right) = \begin{bmatrix} 1 & 0 & l_{i-1} \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\left(q_i\right) & -\sin\left(q_i\right) & 0 \\ \sin\left(q_i\right) & \cos\left(q_i\right) & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} \cos\left(q_i\right) & -\sin\left(q_i\right) & l_i \\ \sin\left(q_i\right) & \cos\left(q_i\right) & l_i \\ 0 & 0 & 1 \end{bmatrix} \tag{6} . $$

We kinda go from $\mathcal{F}\raisebox{-0.25em}{\footnotesize $i-1$}$ to frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize $i$}$, but not really. Note that $x_i \not= l_{i}$ but $x_i = l_{i-1}$. Is this any good? For now, it might be a confusing interpretation of the matrix concatenation. However, we will see in a future post that this can be preferred way to derive a powerful algorithm.

Furthermore, since $l_{1-1} = l_0$ and $q_{2+1} = q_3$ are not explicitly given, we set them to zero. To do this makes sense. Think about it. Therefore, the previous concatenation is sandwiched with identity matrices.

Getting the Pose

The kinematics provides the pose of the robot with respect to the joint angles. Both present the same frame of the end-effector $\mathcal{F}_{2} = \mathcal{F}\raisebox{-0.25em}{\footnotesize EE}$ expressed in the base frame $\mathcal{F}\raisebox{-0.25em}{\footnotesize 0}$ and, strictly speaking, they do not present the pose. Let’s identify the $x$, $y$, and $\phi$ in Eq.(1) and in the corresponding Eq.(4). It is exactly $$ \begin{bmatrix} x \\ y \\ \phi \end{bmatrix} = \begin{bmatrix} \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ q_1 + q_2 \end{bmatrix} \tag{7} , $$ which should not surprise us. To be more confusing, the left-hand side of Eq.(7) is the pose $X$ and, the right-hand side of Eq.(7) is the kinematics $f\left(\boldsymbol{q}\right)$ with $\boldsymbol{q} = \left[q_1, q_2\right]^\top$.

Let’s go a bit fancy and consider $n$ links and $n$ revolute joints. Going from $$ X(n = 2) = \begin{bmatrix} \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ q_1 + q_2 \end{bmatrix} $$ for two links, i.e., $n = 2$, then $$ X(n = 3) = \begin{bmatrix} \cos\left(q_1 + q_2 + q_3\right)l_3 + \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2 + q_3\right)l_3 + \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ q_1 + q_2 + q_3 \end{bmatrix} $$ for three links, i.e., $n = 4$, to $$ X(n = 4) = \begin{bmatrix} \cos\left(q_1 + q_2 + q_3 + q_4\right)l_4 + \cos\left(q_1 + q_2 + q_3\right)l_3 + \cos\left(q_1 + q_2\right)l_2 + \cos\left(q_1\right)l_1 \\ \sin\left(q_1 + q_2 + q_3 + q_4\right)l_4 + \sin\left(q_1 + q_2 + q_3\right)l_3 + \sin\left(q_1 + q_2\right)l_2 + \sin\left(q_1\right)l_1 \\ q_1 + q_2 + q_3 + q_4 \end{bmatrix} $$ for four links, i.e., $n = 4$, we see a pattern emerging. The pattern for the angle $\phi$ is a sum of all joints, whereas the pattern for $x$ and $y$ is a sum of weighted links with a sum of previous and current joints. Without a proof, we can say with confident that $$ X(n) = \begin{bmatrix} \sum_{i = 1}^n\cos\left(\sum_{j = 1}^k q_j\right)l_i \\ \sum_{i = 1}^n\sin\left(\sum_{j = 1}^k q_j\right)l_i \\ \sum_{i = 1}^n q_i \end{bmatrix} $$ is the pose of planar robot with $n$ revolute joins. Rewriting it by pulling out the first sum, we get $$ X(n) = \sum_{i = 1}^n \begin{bmatrix} \cos\left(\sum_{j = 1}^k q_j\right)l_i \\ \sin\left(\sum_{j = 1}^k q_j\right)l_i \\ q_i \end{bmatrix} \tag{8} , $$ highlighting that the pose is the sum of its components. Think of extending the above sequence of images to $q_3$, $q_4$, $q_5$, and so on up to $q_n$. With this representation, you should be able to prove it using induction.

To Be Cover in the Future

For this blog post, you might have several followup questions. For example,

  • Is it important to point about that $q_i$ is a relative joint? Absolute joints? What is the different?
  • Can we use complex numbers instead?
  • How to derive the inverse kinematics?
  • What are the dynamics of this RR robot?
  • Two different ways to define Denavit–Hartenberg (DH) parameters?
  • Are you hinting on the recursive Newton-Euler algorithm?

Or, you might have questions regarding some stuff I intentionally skipped over. For example,

  • What does kinematics mean?
  • What are trigonometric identities?
  • What is an end-effector?
  • Why are three indexes necessary to describe a vector?
  • What is a unit circle $q_i \in \mathbb{S}^1$?
  • Why are we using homogeneous transformation matrices?
  • How to use transformation matrices?
  • What are DH parameters?

Sidenote:

I draw the first image of an RR robot in html… I’ll not do it again 🙈 So, I switched to inkscape and copy-pasted the code.

If a section of a text has too many $\LaTeX$ commands with underscores, consider switching to \mathcal{F}\raisebox{-0.25em}{\footnotesize 0} and \mathcal{F}\raisebox{-0.25em}{\footnotesize EE} instead of using for instance \mathcal{F}_0. I guess, it’s because of the many underscore characters and markdown breaks down 🙉 Also, sometimes $\KaTeX$ goes crazy if I use

$$
X = 
\begin{bmatrix}
x  \\\\ 
y \\\\ 
\phi
\end{bmatrix}
,
$$

Instead, you can use the following $\LaTeX$ code.

$$
X = 
\begin{bmatrix}
x  \\\\ y \\\\ \phi
\end{bmatrix}
,
$$

Edit:

Updated on Sep. 20, 2025: Caught some typos and grammar errors. Also, I changed the color of arrow heads, e.g., fill:none;stroke:#859900 to fill:#859900;stroke:#859900. A never-to-be-solved issue in inkscape 🙊 Okay, it turns out that this is a Safari browser problem.