Course Menu

←Introduction Index Machine Learning→

Today's Topics

Course Materials

  • Slides
  • Video Lecture by Geri and Jan
  • Self-Test Questions:
  • Homework
  • Discuss Lecture

Lecture 2: Classical Robotics in a Nutshell

This lecture conveys the required robotics background to all class participants. It provides the students with the theoretical background required both to follow this lecture as well as to pursue basic robotics projects. Rather than replacing the excellent introduction to robotics by Oskar von Stryk, the contents are shaped for helping towards an understanding of robot learning. While it will by no means be sufficient for a future roboticist, it is aimed at giving a good intuition on the core topics of robotics.

The core lecture aim is to supply the students with the knowledge needed to build a basic robot simulator for a task at hand and to create tasks along with a controller. This aim requires the following pieces of knowledge:

  1. A basic understanding what a robot is, what relevant component it has and through what terms it can be described.
  2. Computing a visualization of a robot through "kinematics."
  3. Simulate the behavior of a robot for arbitrary motor commands using "dynamics."
  4. Describe the desired behavior of a robot ...
  5. ... and compute the motor commands needed to accomplish this behavior.

If you understand all of these components, it is time to continue with the lecture notes ... and to dig deeper into the literature.

Students are expected to test their knowledge after each section using the supplied questions for self-testing. While such self-test questions are ungraded and untracked, they do give the student an early indication on his or her level of understanding. Homework exercises will complement the self-test questions and supply bonus points.

This script is based on the iPython scribe notes of Philipp Becker, Dominik Dienlin, Pascal Klink and Javier De Velasco as well as on the visualizations of Boris Belousov. This lecturer feels highly indebted to these co-authors.

What is a robot?

L2_What_is_a_robot

Before we actually start manipulating robots we must first define what a robot is. Pretty much everyone not living under a rock for the past 50 years has a vague idea of what they are, especially because Hollywood (And thus people) is in love with robots. Just look at all these robots:

Ultron

Robots actually come from literature, the writer Karel Čapek coined the term and was continued by Isaac Asimov and other Science Fiction writers. The word described an artificial source of manual work.

Roomba

Now, what do all of these so-called robots have in common?

If you answered that they can all move (They have extremities) then you are correct and Jan will throw you (hopefully without killing anyone) a snickers.

Snicker

Robots are distinguished from a normal computer by the fact that robots can process information, be programmed and calculate numbers (just like computers) and they can interact directly with the real world through various extremities or actuators:

A computer is just an amputee robot. (G. Randlov)

Let's have a look at the actual names of the parts that make up a robot

 

Self test

Kinematics

L2_Kinematics

So we know from above that we want to get from the representation of our robot in the joint-space to the representation of our robot in the task-space. The good news here is, it is a purely geometrical problem to solve. And if we use cartesian coordiates to represent our robot in task-space - which normally is the case - we basically only need trigonometry besides addition and multiplication to solve this problem (naturally the formulas can get quite cumbersome for robots with many joints).

In this chapter we will do the forward kinematics for the SCARA robot we already saw in figures 3 and 5.


Forwards Kinematics

First of all let's calculate the position in the task-space from the position in our joint-space. For that we need to define a function $f$ so that $\mathbf{x} = f(\mathbf{q})$. To do that it is best to make some sketches of the robot from various perspectives:

Scara XY 1

Figure 8: Sketches of the SCARA robot projected into the xy-plane - $q_1$ and $q_2$ are the positions of the two revolute joints (in rad) - $r_1$ and $_2$ are the lengths of the links between the joints (in meters)

We will start with calulcating the position of the robot arm in the xy-plane. As already pointed out in figure 8 we cannot just calculate $\cos(q_1) r_1 + \cos(q_2) r_2$ to calculate $x_1$ of our position vector $\mathbf{x}$. This is because the coordinate system in which we express the joint position $q_2$ is rotated according to the joint position $q_1$. So to measure the joint position in the actual coordinate system, we need to sum both rotations up. Considering this, our forward kinematics for the xy-plane will look as follows:

$$\begin{align*} \begin{pmatrix} x_1\\ x_2 \end{pmatrix} = \begin{pmatrix} \cos(q_1) r_1 + \cos(q_1 + q_2) r_2\\ \sin(q_1) r_1 + \sin(q_1 + q_2) r_2 \end{pmatrix} \end{align*}$$

To finish the forward kinematics for our scara robot we will have to calculate the forward kinematics for the z-coordinate of the SCARA robot. Again we will first take a look at a sketch (this time it is not compliant to the joint representations from the chapter 'Terminology' - however, I could not come up with another good way of drawing it):

Scara XZ 1

Figure 9: A sketch of the SCARA robot projected into the xz-plane. $h_1$ and $h_2$ are the heights of the two revolute joints and $q_3$ is the position of the prismatic joint of the robot to which the end effector is connected

As we can see the forward kinematics for the z-coordinate of the robot is really easy. It is just $x_3 = h_1 + h_2 - q_3$. Bringing this all together we can now complete the forward kinematics for our SCARA robot:

$$\begin{align*} \begin{pmatrix} x_1\\ x_2\\ x_3 \end{pmatrix} = \begin{pmatrix} \cos(q_1) r_1 + \cos(q_1 + q_2) r_2\\ \sin(q_1) r_1 + \sin(q_1 + q_2) r_2\\ h_1 + h_2 - q_3 \end{pmatrix} \end{align*}$$

Differential forward kinematics

So until now we defined $f(\mathbf{q})$ such that $\mathbf{x}=f(\mathbf{q})$. But if we again take a look at figure 7 we see that the control stage of a robot can also consume $\mathbf{\dot{x}}$ and $\mathbf{\ddot{x}}$. Luckily we can quite easily find functions $g(\mathbf{q}, \mathbf{\dot{q}})$ and $h(\mathbf{q}, \mathbf{\dot{q}}, \mathbf{\ddot{q}})$ sucht that $\mathbf{\dot{x}}=g(\mathbf{q}, \mathbf{\dot{q}})$ and $\mathbf{\ddot{x}}=h(\mathbf{q}, \mathbf{\dot{q}}, \mathbf{\ddot{q}})$ if we are familiar with differentiation and especially the chain rule for differentiation. With the latter we can derive the abstract form of our functions $g$ and $h$:

$$\begin{align*} \dot{\mathbf{x}} &= g(\mathbf{q}, \mathbf{\dot{q}}) = \frac{d(f(\mathbf{q}))}{dt} = \underset{\mathbf{J}\left(\mathbf{q}\right)}{\underbrace{\frac{df(\mathbf{q})}{d\mathbf{q}}}}\underset{\mathbf{\dot{q}}}{\underbrace{\frac{df(\mathbf{q})}{dt}}}= \mathbf{J}\left(\mathbf{q}\right)\mathbf{\dot{q}} \\ \ddot{\mathbf{x}} &= h(\mathbf{q}, \mathbf{\dot{q}}, \mathbf{\ddot{q}}) = \frac{d(g(\mathbf{q}, \mathbf{\dot{q}}))}{dt} = \frac{\mathbf{J}\left(\mathbf{q}\right)\mathbf{\dot{q}}}{dt} = \frac{\mathbf{J}\left(\mathbf{q}\right)}{dt}\mathbf{\dot{q}} + \mathbf{J}\left(\mathbf{q}\right)\frac{\mathbf{\dot{q}}}{dt} = \dot{\mathbf{J}}\left(\mathbf{q}\right)\mathbf{\dot{q}}+\mathbf{J}\left(\mathbf{q}\right)\mathbf{\ddot{q}} \end{align*}$$

Note that $\dot{\mathbf{J}}\left(\mathbf{q}\right)=\frac{d\mathbf{J}(\mathbf{q})}{d\mathbf{q}} \mathbf{\dot{q}}$. Since we now have that, we can apply it to our Scara robot. However, we will just calculate the formula of $g$ here, since we need to work with tensors if we want to calculate $h$ (we need to calculate $\frac{d\mathbf{J}(\mathbf{q})}{d\mathbf{q}}$). Since we know that $\frac{d(\sin(x))}{dx} = \cos(x)$ and $\frac{d(\cos(x))}{dx} = -\sin(x)$ we get the following formula for $g$:

$$\begin{align*} g(\mathbf{q}, \mathbf{\dot{q}}) &= \mathbf{J}\left(\mathbf{q}\right)\mathbf{\dot{q}} \\ &=\begin{pmatrix} -\sin(q_1) r_1 - \sin(q_1 + q_2) r_2 & -\sin(q_1 + q_2) r_2 & 0 \\ \cos(q_1) r_1 + \cos(q_1 + q_2) r_2 & \cos(q_1 + q_2) r_2 & 0 \\ 0 & 0 & 1 \end{pmatrix} \mathbf{\dot{q}} \end{align*}$$

There is also a nice interpretation of the Jacobian $\mathbf{J}\left(\mathbf{q}\right)$. It transforms the joint space velocities to the task space velocities by calculating a weighted sum of them where the weight of each joint velocity is determined by the current joint positions.

In practice Jacobians are either derived analytically (just like we did) or geometrically (where you use geometric insight to get to the Jacobian). The former can be automatically derived by symbolic differentiation but can cause so called "representational singularities". The latter method does not have this problem but is a rather contrived method.


Singularities

Now that we know about differential forward kinematics, we need to think about some problems which can arise by using them. Those problem are called singularities. So what are singularities?

Formally speaking singularities are those joint positions $\mathbf{q}$ for which the columns of the Jacobian $\mathbf{J}(\mathbf{q})$ become linearly dependent. This means that the Jacobian becomes singular. This also directly gives us a method for checking whether our robot is currently in a singularity or not - we just have to check if $\det(\mathbf{J}(\mathbf{q})) = 0$ or not.

Intuitively speaking our robot looses one degree of freedom when entering a singularity. This is for example the case if a joint of the robot is fully extended - then we will not be able to extend it any further by sending motor commands towards it. Singularities can also occur if our robot has more degrees of freedom in the joint space than it has in the task space because then axes of the robot can become redundant. You can see an example for a robot with more degrees of freedom in the joint than in the task space if you look again at the robot on the left side in figure 2.

Ok so now we know about singularities and can detect them. But are they actually a problem? The answer is - yes they can be a problem. Some controllers for example use the inverse of the Jacobian in order to calculate their motor commands. So if the Jacobian is singular such a controller will have a hard time generating correct motor commands.


Devanit-Hartenberg Description

As already mentioned, deriving the forward kinematics function $f$ for a robot with many joints can get quite cumbersome and with that error-prone. So wouldn't it be nice if we had an easy step-by-step mechanism with which we could work our way from the robots base position to the end effector using the joint positions?

You know this question wouldn't be asked here if there wouldn't exist such a mechanism - so let's look at the Devanit Hartenberg Description. But before we start, we need some basics in rotations and translations.


Translations

For the purpose of this lecture lets look at translations as mappings $tr: \mathbb{R}^n \rightarrow \mathbb{R}^n, \mathbf{x} \mapsto \mathbf{x} + \mathbf{a}$ (note that that generally speaking a translation is a special type of an affine mapping). As an example a translation in $\mathbb{R}^3$ could be $tr_1: \mathbb{R}^3 \rightarrow \mathbb{R}^3, \mathbf{x} \mapsto \mathbf{x} + (1, 0, 0)^T$ which shifts the given vector along the x-axis by one.


Homogenous Coordinates

Easy, right? Yes, but there is one little problem. Later we will combine the translations from above with rotations around the x- and z-axis. Since we want to depict the rotations using matrices it would be neat to also depict translations using matrices. In order to do this, we need to use a trick. If we for example want to describe the function $tr$ from above as a matrix, we first need to extend the given vector $\mathbf{x}$:

$$\begin{align*}\mathbf{x} = \begin{pmatrix}x_1 \\ x_2 \\ x_3\end{pmatrix} \mapsto \begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ 1\end{pmatrix}\end{align*}$$

So we just extended the given vector by another row with a one in it - and now? Now we can describe the translation $tr$ with the following matrix:

$$\begin{align*}tr_1: \mathbb{R}^4 \rightarrow \mathbb{R}^4, \mathbf{x} \mapsto \begin{pmatrix} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ 1 \end{pmatrix} = \begin{pmatrix} x_1 + 1 \\ x_2 \\ x_3 \\ 1 \end{pmatrix}\end{align*}$$

Finally we get back to our vector $x$ in $\mathbb{R}^3$ by dividing through the value in the last column:

$$\begin{align*}\begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ 1\end{pmatrix} \mapsto \begin{pmatrix}x_1 / 1 \\ x_2 / 1 \\ x_3 / 1\end{pmatrix} = \mathbf{x}\end{align*}$$

Note that we can generally extend the vector $\mathbf{x}$ with an arbitrary value $r \in \mathbf{R}$ in the following way:

$$\begin{align*} \mathbf{x} = \begin{pmatrix}x_1 \\ x_2 \\ x_3\end{pmatrix} \mapsto \begin{pmatrix}r x_1 \\ r x_2 \\ r x_3 \\ r\end{pmatrix} ... \begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ r\end{pmatrix} \mapsto \begin{pmatrix}x_1 / r \\ x_2 / r \\ x_3 / r\end{pmatrix} = \mathbf{x} \end{align*}$$

FYI: In mathematical terms we are transforming inhomogenous coordinates to homogenous coordinates to which we then apply homogenous transformations. It is very useful for us since every affine mapping in n-dimensional space can be written as a matrix in (n+1)-dimensional space.

Finally for our our general case of a translation $tr$, we use the following:

$$\begin{align*}tr: \mathbb{R}^4 \rightarrow \mathbb{R}^4, \mathbf{x} \mapsto \begin{pmatrix} 1 & 0 & 0 & a_1 \\ 0 & 1 & 0 & a_2 \\ 0 & 0 & 1 & a_3 \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ r \end{pmatrix}\end{align*}$$

Rotations

Rotations are basically just transformations of the coordinate frames, as the following picture shows:

Rotations

Figure 10: A rotation around the z-axis by angle $\theta$

Since they are also affine mappings, here are the matrices for rotations around the x-, y- and z-axis by angle $\theta$:

$$\begin{align*} \mathbf{R}_x(\theta) = \begin{pmatrix}1 & 0 & 0 \\ 0 & \cos(\theta) & -\sin(\theta) \\ 0 & \sin(\theta) & \cos(\theta)\end{pmatrix}, \mathbf{R}_y(\theta) = \begin{pmatrix}\cos(\theta) & 0 & \sin(\theta) \\ 0 & 1 & 0 \\ -\sin(\theta) & 0 & \cos(\theta)\end{pmatrix}, \mathbf{R}_z(\theta) = \begin{pmatrix}\cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1\end{pmatrix} \end{align*}$$

You can quite easily derive these matrices by geometric insight and the fact that the columns of the transformation matrix correspond to the transformed basis vectors of your coordinate system. So for a rotation around the z-axis by angle $\theta$ we get the following mappings of the basis vectors out of figure 10:

$$\begin{align*} \begin{pmatrix}1 \\ 0 \\ 0\end{pmatrix} \rightarrow \begin{pmatrix}\cos(\theta) \\ \sin(\theta) \\ 0\end{pmatrix}, \begin{pmatrix}0 \\ 1 \\ 0\end{pmatrix} \rightarrow \begin{pmatrix}-\sin(\theta) \\ \cos(\theta) \\ 0\end{pmatrix} \begin{pmatrix}0 \\ 0 \\ 1\end{pmatrix} \rightarrow \begin{pmatrix}0 \\ 0 \\ 1\end{pmatrix} \end{align*}$$

As you can see the tree transformed basis vectors make up the transformation matrix. So the last thing we should know about rotations for now is that we are rotating counter-clockwise. This is because we are doing our transformations in a right hand coordinate system (we will come to the implications of that later).


Denavit-Hartenberg Description: Coordinate Systems

At that point, we got all we need to describe our robot using the Denavit-Hartenberg description. So how do we derive this description?

The basic idea is to assign a new coordinate system to every joint and then transform the coordinate system of one joint into the coordinate system of the next joint as we go along the robot until we reach the end effector. Since we want to have a fixed number of steps to transform one coordinate system into the next one, we will formulate some conditions which the coordinate systems have to meet:

Let $j_0, ..., j_n$ be the joints of the robot (either revolute or prismatic) and $\mathbf{x}_i, \mathbf{y}_i, \mathbf{z}_i$ be the vectors defining the coordinate system of $j_i$:

  • $\mathbf{z}_i$ has to lie alongside the axis of movement of $j_i$
  • $\mathbf{x}_{i+1}$ has to be orthogonal to $\mathbf{z}_i$ and $\mathbf{z}_{i+1}$ (choose $\mathbf{x}_0$ so that is it orthogonal to $\mathbf{z}_0$ and $\mathbf{z}_1$)
  • $\mathbf{y}_i$ has to be choosen in such a way, that it forms a right hand coordinate system with $\mathbf{x}_i$ and $\mathbf{z}_i$

Allthough those constraints now look somewhat annoying they enable us to describe the transformation from one coordinate system into the other with just 4 values! So let's start with the easiest part - finding the $z_i$-axes of the joints in our SCARA robot. For that we only have to draw arrows through our joints:

SCARA DH Z Figure 11: A sketch of the SCARA robot with the $\mathbf{z}_i$ vectors of the coordinate systems

Now in order to have a mathematical description of our $z_i$-axes let's assume that the robot is standing on an absolutely horizontal baseplate. With that we obtain $\mathbf{z}_0 = (0, 0, 1)^T$, $\mathbf{z}_1 = (0, 0, 1)^T$, $\mathbf{z}_2 = (0, 0, -1)^T$. So now that we have done that, we need to find the $x$-axes of the coordinate systems. Since $\mathbf{x}_i$ has to be orthogonal to $\mathbf{z}_i$ and $\mathbf{z}_{i-1}$ we should calculate $\mathbf{z}_i \times \mathbf{z}_{i-1}$ in order to find $\mathbf{x}_i$. If we do this in our case, we will always get $\mathbf{0}$ since $\mathbf{z}_0 \parallel \mathbf{z}_1 \parallel \mathbf{z}_2$. This basically means that there are infinitely many orthogonal vectors to choose from. So let's set $\mathbf{x}_0 = (1, 0, 0)^T$, $\mathbf{x}_1 = (\cos(q_1), \sin(q_1), 0)^T$ and $\mathbf{x}_2 = (\cos(q_1 + q_2), \sin(q_1 + q_2), 0)^T$. If we update our sketch accordingly we will get the following:

SCARA DH XZ

Figure 12: A sketch of the SCARA robot with the $\mathbf{x}_i$ and $\mathbf{z}_i$ vectors of the coordinate systems

We nearly got it! What's left are the $y_i$-axes. Since we assumed that the rotations will be done in a right hand coordinate system we need to ensure that we actually have one. To find $\mathbf{y}_i$, we will use the right hand rule, which is illustrated in the following picture:

Right Hand Rule

Figure 13: The right hand rule for finding the vectors $\mathbf{y}_i$ to form a right hand coordinate system

With the rule we should come to the conclusion that $\mathbf{y}_0 = (0, 1, 0)^T$, $\mathbf{y}_1 = (-\sin(q_1), \cos(q_1), 0)^T$ and $\mathbf{y}_2 = (-\sin(q_1 + q_2), \cos(q_1 + q_2), 0)^T$. So here is our final sketch of the coordinate frames:

SCARA DH XYZ

Figure 14: A sketch of the SCARA robot with the $\mathbf{x}_i$, $\mathbf{y}_i$ and $\mathbf{z}_i$ vectors of the coordinate systems


Denavit-Hartenberg Description: Transformations

So now that we have our coordinate system, we should worry about how to get from one to the other. In order to discuss this let's first add heights and lengths for the links of our SCARA robot:

SCARA DH TRANSFORM 0

Since we have that, let's try to get from the coordinate system of $j_0$ to the coordinate system of $j_1$. The first thing we need to do is make $\mathbf{x}_0$ and $\mathbf{x}_1$ parallel. For that we need a rotation around $\mathbf{z}_0$ by angle $q_1$. So our first transformation matrix looks like this:

$$\begin{align*} \text{Rot}(\mathbf{z}_0, \theta_1) = \begin{pmatrix}\cos(\theta_1) & -\sin(\theta_1) & 0 & 0 \\ \sin(\theta_1) & \cos(\theta_1) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{pmatrix}, \theta_1 = q_1 \end{align*}$$

To see what's going on, here is the same sketch from above with the new coordinate system in dotted lines:

SCARA DH TRANSFORM 1

Now that we have this done, we are going to shift the coordinate system along the z-axis:

$$\begin{align*} \text{Trans}(\mathbf{z}_0, d_1) = \begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & d_1 \\ 0 & 0 & 0 & 1\end{pmatrix}, d_1 = h_1 \end{align*}$$

Again the sketch with the new coordinate system:

SCARA DH TRANSFORM 2

The third step is to shift the coordinate system along the x-axis so that we arrive at the same position where the coordinate system of the next joint has its base:

$$\begin{align*} \text{Trans}(\mathbf{x}_0, a_1) = \begin{pmatrix}1 & 0 & 0 & a_1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{pmatrix}, a_1 = r_1 \end{align*}$$

When we look at the following sketch, a question should arise:

SCARA DH TRANSFORM 3

The question is: Why should we need a fourth transformation? Well in this case we do not need it but if you look at the orientation of $\mathbf{z_1}$ and $\mathbf{z_2}$ you will notice that they point in the opposite direction. So the fourth transformation is a rotation around $x_0$ (by an angle of zero degree in this case):

$$\begin{align*} \text{Rot}(\mathbf{x}_0, \alpha_1) = \begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & \cos(\alpha_1) & -\sin(\alpha_1) & 0 \\ 0 & \sin(\alpha_1) & \cos(\alpha_1) & 0 \\ 0 & 0 & 0 & 1\end{pmatrix}, \alpha_1 = 0 \end{align*}$$

We now finish this transformation by multiplying the four matrices up so that we receive one transformation matrix which transforms the coordinate system of $j_0$ into the coordinate system of $j_1$:

$$\begin{align*} ^{0}T_1 &= \text{Rot}(\mathbf{z}_0, \theta_1) \text{Trans}(\mathbf{z}_0, d_1) \text{Trans}(\mathbf{x}_0, a_1) \text{Rot}(\mathbf{x}_0, \alpha_1) \\ &= \begin{pmatrix} \cos(\theta_1) & -\sin(\theta_1) \cos(\alpha_1) & \sin(\theta_1) \sin(\alpha_1) & a_1 \cos(\theta_1) \\ \sin(\theta_1) & \cos(\theta_1) \cos(\alpha_1) & -\cos(\theta_1) \sin(\alpha_1) & a_1 \sin(\theta_1) \\ 0 & \sin(\alpha_1) & \cos(\alpha_1) & d_1 \\ 0 & 0 & 0 & 1 \end{pmatrix} \end{align*}$$

As you have probably already decuted, the general form of the transformation from the coordinate system of joint $j_{n-1}$ to the coordinate system of joint $j_{n}$ is:

$$\begin{align*} ^{n-1}T_n &= \text{Rot}(\mathbf{z}_{n-1}, \theta_n) \text{Trans}(\mathbf{z}_{n-1}, d_n) \text{Trans}(\mathbf{x}_{n-1}, a_n) \text{Rot}(\mathbf{x}_{n-1}, \alpha_n) \\ &= \begin{pmatrix} \cos(\theta_n) & -\sin(\theta_n) \cos(\alpha_n) & \sin(\theta_n) \sin(\alpha_n) & a_n \cos(\theta_n) \\ \sin(\theta_n) & \cos(\theta_n) \cos(\alpha_n) & -\cos(\theta_n) \sin(\alpha_n) & a_n \sin(\theta_n) \\ 0 & \sin(\alpha_n) & \cos(\alpha_n) & d_n \\ 0 & 0 & 0 & 1 \end{pmatrix} \end{align*}$$

If you now wonder why we can be sure that those four transformations are enough the get from coordinate system to coordinate system then think about how we constructed the coordinate systems. Those constraints which we had to take care of there are now guaranteeing us that those four transformations are enough the get from one coordinate system to the next one. Consequently, you can be sure that you constructed the coordinate systems right if you are able to do the coordinate transformation with the four steps from above.

At this point I just want to add an example of the fourth transformation. We need this transformation when transforming the coordinate system from joint $j_1$ to the one of $j_2$. Here is a sketch of how it looks like:

SCARA DH TRANSFORM 4


Denavit-Hartenberg Description: Depiction

So as we saw, we only need the four parameters $\theta_n$, $d_n$, $a_n$ and $\alpha_n$ to describe the transformation from one coordinate system to the next. Consequently, we normally write them in a table. For our SCARA robot this table looks as follows:

n $\alpha_n$ $a_n$ $d_n$ $\theta_n$
1 0 $r_1$ $h_1$ $q_1$
2 $\pi$ $r_2$ $h_2$ $q_2$
3 $\pi$ 0 $q_3$ 0

The attentive among us may have noticed something. Since we have three transformations we need to have four coordinate systems. However, in our sketches we only had three. Let's fix this by adding the last coordinate system (which normally is the coordinate system of the task space):

SCARA DH TRANSFORM 5


From Denavit-Hartenberg to Forward Kinematics

At the beginning of the topic about Denavit-Hartenberg I promised that we would find an easy step-by-step approach to forward kinematics. But until now, we have only learned how to describe a robot in some fancy way. So how do we get from this description to our forward kinematics function $f(\mathbf{q})$? Luckily, this is quite easy, as we just have to do the following:

$$\begin{align*} f(\mathbf{q}) = ^0T_1 ... ^{n-1}T_n \mathbf{v}_0 \end{align*}$$

The vector $\mathbf{v}_0$ is the position of joint $j_0$ in the task space (as a homogenous coordinate). So if was assume that our SCARA robot is positioned at $(0, 0, 0)^T$ we get the following forward kinematics function for it:

$$\begin{align*} f(\mathbf{q}) = ^0T_1 ^1T_2 ^{2}T_3 \begin{pmatrix}0 \\ 0 \\ 0 \\ 1\end{pmatrix} \end{align*}$$

With this, we have talked enough about kinematics and will now move on to dynamics. Those wo want to do some calculus before moving to dynamics can now show that the Denavit-Hartenberg approach acutally leads to the same vector that we saw in the forward kinematics section.

 

Self test

Dynamics

L2_Dynamics

Now that we know about kinematics we want to take a closer look at dynamics. For this we will not consider the SCARA robot, because this would be rather complex. Instead we use an even simpler robot, consisting only of a rotary and a prismatic joint and living in a 2D space. storm Figure 15. The robot we will consider from now on. It consists of a rotary and a prismatic joint. For simplicity we assume two point masses $m_1$ and $m_2$. Gravity is acting along the negative y-axis.

We quickly state the kinematics of this robot $$\begin{align*} \begin{pmatrix} x_1\\ x_2 \end{pmatrix} = \begin{pmatrix} (\alpha+q) \cos(\theta) \\ (\alpha+q) \sin(\theta) \end{pmatrix} \end{align*}$$ In classical mechanics, we talk about dynamics whenever we consider forces and torques and especially their impact on the motion of a system. In our case the "system" is of course a robot. So in order to learn about dynamics we first need to learn about forces and torques.


Forces and Torques

There are several forces and torques we need to consider to get a satisfactory dynamics model of our robot.


Gravity

The formula for gravity should be well known from high school $$ F_{grav} = m g $$

where $m$ denotes the mass and $g$ denotes the gravitational acceleration, which is (as long as we consider our robot to be on earth) given by $g = 9.8 \frac{m}{s^2}$. If we consider a torque, we need to take the relative position of the mass to the joint into account. To see how and why, take a heavy object and hold it right in front of your chest. Now stretch out your arms horizontally. Afterwards move up until the heavy object is right over your head. In addition to looking incredibly stupid you hopefully have noticed how the object seemed to get heavier when stretching out your arms and lighter again while moving it upwards over your head. Mathematically that can be described with the following equation
$$\begin{align*} \tau_{gravity} = m g \cos(\theta) l \end{align*}$$ Since the resulting force acting on our system depends on the position of the joints we often write $g(\mathbf{q})$


Centripetal and Centrifugal Force

In order for an object to move in a curved path there must be a force pulling it towards the center of the curve. Despite its causes this force is called centripetal force. Additionally every object following a curved path is constantly changing its direction. According to Newtons First Law - Inertia of mass - the object does not want to do this and hence a force is acting against this: the centrifugal force, pulling the object away from the center.

For example consider a swing-ride (Kettenkarusell). The tension in the cains is acting the centripedal force, keeping the chairs from flying of (hopefully). The centrifugal force on the other hand is the one that pulls you outwards.

centri Figure 16. Left: Scheme of the classical "string on a rope" experiment. Centripetal force $c_p$ acting towards the center, centfifugal force $c_f$ acting outwards and velocity is tangential to path. Middle: The swing-ride described above. Right: When driving through a curve motorcyclists have to lean twowards the center of the curve to prevent beeing pulled off the road by the centrifugal force.

Another example for this is the earths rotation around the sun. The suns gravity pulls the earth towards it. The centrifugal force acts outwards. Together those forces keep the earth in a stable orbit.


Coriolis Force

Coriolis Force is a virtual force that acts on systems which movements are described relative to a rotating reference frame. A good example is a a big storm (e.g. a hurricane). The earth is the rotating reference frame. The rotation causes those storm to "spin", building the spirals we see in the weather forecast. storm Figure 17. Low pressure system over Iceland. Low pressure systems always turn counter-clockwise on the nothern hemisphere

In our equations we will combine centripetal and Coriolis forces and denote them as $c(\mathbf{q},\mathbf{\dot{q}})$. If you see a formula and want to figure out which parts correspnds to the centripetal/centrifugal and the coriolis forces look for some velocity that is squared (or two velocities multiplied with each other).


Friction

In general one distinguishes between two forms of friction

  • Stiction: $F_{stiction} = -c_s F_n$
  • Damping (Viscous Friction): $F_{damping} = -D F_n$

Where $F_n$ denotes the normal force and $c_s$ and $D$ denote material dependent factors. Since those factors depend on the very nature of the atomic structure of the used materials modelling friction is a major problem in classical mechanics and dynamics. Therefore in simulation friction is often omitted. In control one need to come up with other clever ways to compensate for it.


Newton's second law of motion

As we said we are interested not only in the forces and torques but also how they effect the motion of our robot. Sir Isaac Newton discovered that the impact of forces and torques on motion can be represented with a very simple equation $$\begin{align*} \sum_i F_i = m \mathbf{\ddot{x}}. \end{align*}$$ This is the famous "Newton's second law of motion". Where $F_i$ denotes all the forces acting on a system, $m$ is the mass of the system and $\ddot{x}$ its acceleration. The equivalent for torques is given by $$\begin{align*} \sum_i \tau_i = I \mathbf{\ddot{q}} \end{align*}$$ where $\tau_i$ denotes the sum of all torques, $I$ is the inertia of the system and $\ddot{q}$ its acceleration. Now that we now about this dependence we can build our dynamics model.


Dynamics Models

Our goal is to understand which motor commands cause which changes in the motion of our robot. We abstract from the actual motors and just consider the forces acted by them on the robot. Those forces are denoted with $u$. In addition we will consider Coriolis and Centripetal forces as well as gravity which act contrary to our motor commands. Newton's second law now yields $$\begin{align*} M(\mathbf{q}) \mathbf{\ddot{q}} = \mathbf{u} - c(\mathbf{q},\mathbf{\dot{q}}) - g(\mathbf{q}) \end{align*}$$ where $M(\mathbf{q})$ denotes the mass matrix. At first glance it may seem odd that this depends on $\mathbf{q}$, however we again consider the "resulting mass" which depends on the joint positions $\mathbf{q}$. Usually the formula above is denoted in the form $$\begin{align*} \mathbf{u} = M(\mathbf{q}) \mathbf{\ddot{q}} + c(\mathbf{q},\mathbf{\dot{q}}) + g(\mathbf{q}) \end{align*}$$ This yields a differential equation $$\begin{align*} \mathbf{u} = f(\mathbf{q}, \mathbf{\dot{q}}, \mathbf{\ddot{q}}) \end{align*}$$ the so called Inverse dynamics model. This can be used for control, for this see the section about control down below. However for now we are more interested in the Forward dynamics model $$\begin{align*} \mathbf{\ddot{q}} = f(\mathbf{q}, \mathbf{\dot{q}},\mathbf{u}) \end{align*}$$ which can be used for simulation. To get this we need to solve the equation for the inverse dynamics model for $\mathbf{\ddot{q}}$. This yields $$\begin{align*} \mathbf{\ddot{q}} = M^{-1}(\mathbf{q})\left(\mathbf{u}-c(\mathbf{q},\mathbf{\dot{q}}) - g(\mathbf{q})\right). \end{align*}$$ To get $\mathbf{q}$ and $\mathbf{\dot{q}}$ we just need to integrate. Unless you like pain, solving the differential equation as well as integrating is done numerically.


Getting the differential equations

All we need to know to build our model are the differential equations. We will consider two methods to get those.


Newton-Euler's Method

The Newton-Euler method is sometimes also referred to as force dissection. This method can be formalized nicely, however we will not do this here. The basic idea is to consider each joint independently from the rest of the system and calculate the resulting force on that joint by summing all individual forces. So lets do this for our robot.
We will start with the prismatic joint ($u_2$). Obviously this only depends on the second mass $m_2$. First we consider the forces along the axis of the cartisian space our robot lives in. pF Figure 18. The forces acting on the mass are displayed in green. The resulting forces at the joint are displayed in red. Those forces are the same, just "shifted" to another location

To get those forces we first need the acceleration of that mass. We obtain this by differentiating the position two times with respect to the time. From the kinematics section we know $$\begin{align*} p_{x2} &= (\alpha+q) \cos(\theta) \\ p_{y2} &= (\alpha+q) \sin(\theta) \end{align*}$$ hence $$\begin{align*} v_{x2} &= -(\alpha +q) \sin(\theta)\dot{\theta} + \dot{q}\cos(\theta) \\ v_{y2} &= (\alpha+q) \cos(\theta) \dot{\theta} + \dot{q}\sin(\theta) \end{align*}$$ and $$\begin{align*} a_{x2} &= -(\alpha + q) \sin(\theta) \ddot{\theta} - (\alpha + q)\dot{\theta}^2\cos(\theta)- \sin(\theta)\dot{q}\dot{\theta} + \ddot{q}\cos(\theta) - \sin(\theta)\dot{\theta}\dot{q} \\ &= \left(-(\alpha + q)\ddot{\theta} - 2\dot{\theta}\dot{q}\right)\sin(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos(\theta) \\ a_{y2} &=(\alpha +q) \cos(\theta)\ddot{\theta} - (\alpha + q)\dot{\theta}^2\sin(\theta) + \cos(\theta)\dot{q}\dot{\theta} + \ddot{q}\sin(\theta) + \cos(\theta)\dot{\theta}\dot{q}\\ &= \left(\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\sin(\theta) \end{align*}$$ With this we can now compute the forces along each axis using Newton's second law of motion. Note that we also need to consider gravity, which acts along the $y$-axis $$\begin{align*} m_2 \left[\left(-(\alpha + q)\ddot{\theta} - 2\dot{\theta}\dot{q}\right)\sin(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos(\theta)\right] &= F_{x2} \\ m_2 \left[\left(\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\sin(\theta)\right] &= F_{y2} - m_2 g \end{align*}$$ Now we have the forces along the axis. However we are interested in the forces in the reference frame of the robot. To get those we need to rotate by $\theta$. Note that we rotate clockwise and hence invert the rotationmatrix. pR Figure 19. We multiply all forces with the rotation matix to get in the robot's reference frame

For $u_2$ this yields $$\begin{align*} u_2&=F_{x} \cos(\theta) + F_{y}\sin(\theta) \\ \end{align*}$$ All we need to do now is plug in the values $$\begin{align*} u_2&=m_2 \left[\left(-(\alpha + q)\ddot{\theta} - 2\dot{\theta}\dot{q}\right)\sin(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos(\theta)\right] \cos(\theta) \\ &+ m_2 \left[\left(\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\sin(\theta)\right] \sin(\theta) + m_2 g \sin(\theta) \\ &= m_2\left[\left(-(\alpha + q)\ddot{\theta} - 2\dot{\theta}\dot{q}\right)\sin(\theta)\cos(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos^2(\theta)\right] \\ &+ m_2\left[\left(\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta)\sin(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\sin^2(\theta)\right] \\ &+ m_2 g \sin(\theta) \\ &=m_2 \ddot{q} - m_2(\alpha+q)\dot{\theta}^2 + m_2 g \sin(\theta) \end{align*}$$

Now we do the same for the rotary joint ($u_1$). This time we need to consider both masses $m_1$ and $m_2$. pR Figure 20. Forces acting on masses are displayed in green. For the resulting force (red) we need to consider the length of the leverage arms. Out motor force (blue) acts against the resulting force

We will do this seperatly, starting with $m_1$. Again we need to compute the acceleration first. $$\begin{align*} p_{x1} &= \cos(\theta) \alpha \\ p_{y1} &= \sin(\theta) \alpha \\ v_{x1} &= -\alpha\sin(\theta)\dot{\theta}\\ v_{y1} &= \alpha\cos(\theta)\dot{\theta} \\ a_{x1} &= -\alpha\left(\sin(\theta)\ddot{\theta} + \cos(\theta)\dot{\theta}^2\right)\\ a_{y1} &= \alpha\left(\cos(\theta)\ddot{\theta} - \sin(\theta)\dot{\theta}^2\right) \end{align*}$$ Next, again with the help of our friend Newton, we obtain the forces along the axis. That guy really deserves a snickers. Note however that $m_1$ has a leverage arm of length $\alpha$. This needs to be considered too. $$\begin{align*} -m_1\alpha \alpha\left(\sin(\theta)\ddot{\theta} + \cos(\theta)\dot{\theta}^2\right) &= F_{x1} \\ m_1\alpha \alpha\left(\cos(\theta)\ddot{\theta} - \sin(\theta)\dot{\theta}^2\right) &= F_{y1} - m_1 \alpha g \\ \end{align*}$$ Again, to get in the right reference frame we need to rotate pR Figure 21. We multiply all forces with the rotation matix to get in the robot's reference frame This yields $$\begin{align*} u_{11} =& -F_{x1} \sin(\theta) + F_{y1} \cos(\theta) \\ u_{12} =& - F_{x2} \sin(\theta) + F_{y2} \cos(\theta) \\ \end{align*}$$ Hence for $u_{11}$ we get $$\begin{align*} u_{11} =& m_1\alpha^2 \left[\left(\sin(\theta)\ddot{\theta} + \cos(\theta)\dot{\theta}^2\right) \right] \sin(\theta) + m_1\alpha^2 \left[\left(\cos(\theta)\ddot{\theta} - \sin(\theta)\dot{\theta}^2\right) \right] \cos(\theta) \\ &+ m_1 \alpha g \cos(\theta)\\ =& m_1\alpha^2 \left(\sin^2(\theta)\ddot{\theta} + \sin(\theta)\cos(\theta)\dot{\theta}^2\right) + m_1\alpha^2 \left(\cos^2(\theta)\ddot{\theta} - \cos(\theta)\sin(\theta)\dot{\theta}^2\right) \\ &+ m_1 \alpha g \cos(\theta) \\ =& m_1\alpha^2 \ddot{\theta} + m_1 \alpha g \cos(\theta). \\ \end{align*}$$ For the second mass we already know the acceleration. Again to calculate the force we have to consider the leverage arm, this time of length $(\alpha + q)$ $$\begin{align*} m_2(\alpha + q) \left[ \left(-(\alpha + q)\ddot{\theta} - 2\dot{\theta}\dot{q}\right)\sin(\theta) + \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos(\theta) \right] &= F_{x2} \\ m_2(\alpha + q) \left[ \left(\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\sin(\theta) \right] &= F_{y2} -m_2(\alpha+q) g \end{align*}$$ The rotation yields $$\begin{align*} u_{12}=&m_2(\alpha+q) \left[ \left((\alpha + q)\ddot{\theta} + 2\dot{\theta}\dot{q}\right)\sin(\theta) - \left(\ddot{q} - (\alpha+q)\dot{\theta}^2\right)\cos(\theta)\right] \sin(\theta)\\ +& m_2(\alpha + q) \left[ \left((\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\sin(\theta) \right] \cos(\theta) \\ +& m_2(\alpha+q) g \cos(\theta)\\ =&m_2(\alpha+q) \left[ \left((\alpha + q)\ddot{\theta} + 2\dot{\theta}\dot{q}\right)\sin^2(\theta) - \left(\ddot{q} -(\alpha+q)\dot{\theta}^2\right)\sin(\theta)\cos(\theta)\right] \\ +& m_2(\alpha + q) \left[ \left((\alpha +q)\ddot{\theta} + 2\dot{\theta}\dot{q} \right)\cos^2(\theta) + \left(\ddot{q} - (\alpha + q)\dot{\theta}^2\right)\cos(\theta) \sin(\theta) \right] \\ +& m_2(\alpha+q) g \cos(\theta)\\ =& m_2(\alpha + q)^2\ddot{\theta} + 2m_2(\alpha + q)\dot{\theta}\dot{q} + m_2(\alpha+q) g \cos(\theta) \end{align*}$$ To get the total force acting on the first joint we know just need to add $$\begin{align*} u_1 &= u_{11} + u_{12}\\ &= m_1\alpha^2 \ddot{\theta} + m_1 \alpha g \cos(\theta) + m_2(\alpha + q)^2\ddot{\theta} + 2m_2(\alpha + q)\dot{\theta}\dot{q} + m_2(\alpha+q) g \cos(\theta)\\ &= \left(m_1\alpha^2 + m_2(\alpha + q)^2\right) \ddot{\theta} + 2m_2(\alpha + q)\dot{\theta}\dot{q} + \left(m_1\alpha + m_2(\alpha + q)\right)g \cos(\theta) \end{align*}$$ We can now write this in the martix form shwon above

$$\begin{align*} \mathbf{u} &= M(\mathbf{q}) \mathbf{\ddot{q}} + c(\mathbf{q},\mathbf{\dot{q}}) + g(\mathbf{q}) \\ \begin{pmatrix} u_1 \\ u_2 \end{pmatrix} &=\begin{pmatrix} m_1\alpha^2 + m_2(\alpha +q )^2 & 0 \\ 0 & m_2 \end{pmatrix} \begin{pmatrix} \ddot{\theta} \\ \ddot{q}\end{pmatrix} + \begin{pmatrix} 2m_2(\alpha + q)\dot{\theta}\dot{q} \\ - m_2(\alpha+q)\dot{\theta}^2\end{pmatrix} + \begin{pmatrix}\left(m_1\alpha + m_2(\alpha + q)\right)g \cos(\theta) \\ m_2 g \sin(\theta)\end{pmatrix}\end{align*}$$

nl Figure 22. *Left: Sir Isaac Newton with his well deserved snickers. Right: Joseph-Louis Lagrange


Lagrangian Method

The Lagrangian Method is a completely different approach. In order to use it we first have to consider potential and kinetic energy. We know them from high school so here we will just shortly recapture the formulas and derive the energies for our robot.

Potential Energy

The general formula for potential energy (at least in mechanics) is given by $$\begin{align*} P = m g h. \end{align*}$$ ePot Figure 23. Gravity acting on the robot

We only need to consider the distance from the point masses to the table our robot is mounted on. Considering both masses separately we get $$\begin{align*} p_1 &= m_1 g \alpha\sin(\theta)\\ p_2 &= m_2 g (\alpha + q) \sin(\theta)\\ p &= p_1 +p_2 \end{align*}$$

Kinetic Energy

The general formula for kinetic energy is given by $$\begin{align*} K = \frac{1}{2}m v^2 \end{align*}$$ where $v$ denotes the velocity of the mass under consideration. Again we consider the masses separately. nl Figure 24. Velocities of the masses

For $m_1$ we get $$\begin{align*} k_1 &= \frac{1}{2}m_1 \left(\dot{\theta} \alpha \right)^2\\ &= \frac{1}{2}m_1 \dot{\theta}^2 \alpha^2 \end{align*}$$ For $m_2$ we need to consider both velocities acting on the mass. Thus $$\begin{align*} k_2 &= \frac{1}{2}m_2 \left(\alpha +q)\dot{\theta}\right)^2 + \frac{1}{2}m_2 \dot{q} \\ &= \frac{1}{2}m_2\left((\alpha + q)^2\dot{\theta}^2 + \dot{q}^2\right) \\ \end{align*}$$ To get the total kinetic energy we just sum up $$\begin{align*} k &= k_1 + k_2. \end{align*}$$

Langrangian Equation

Now that we know about the potential and kinematic energy we can use them to get the equation for our dynamics model. Lagrange stated that we can do so by using the following equation $$\begin{align*} u_i = \dfrac{d}{dt}\dfrac{\partial L}{\partial \dot{q_i}} - \dfrac{\partial L}{\partial q_i} \end{align*}$$ where $L$ is given by $$\begin{align*} L = K - P. \end{align*}$$ It can be proven that this is valid for all dynamic systems, to see why you need to sacrifice a goat to an old guy with funny hairstyle, or just look it up on Wikipedia, however do not blame me if you cry afterwards.
All we need to do now is plug our values for the energies into the equation. In our case $L$ is given by $$\begin{align*} L = \frac{1}{2}m_1\alpha^2\dot{\theta}^2 + \frac{1}{2}m_2\left((\alpha + q)^2\dot{\theta}^2 + \dot{q}^2\right) - m_1 \alpha g \sin(\theta) - m_2 (\alpha + q) g \sin(\theta) \end{align*}$$ We will calculate for the rotary joint first. For the first part of the right sight of the equation we need to differentiate with respect to the velocity. $$\begin{align*} \dfrac{\partial L}{ \partial \dot{\theta}} &= m_1 \alpha^2 \dot{\theta} + m_2 (\alpha +q)^2 \dot{\theta} \\ \dfrac{d}{dt} \dfrac{\partial L}{ \partial \dot{\theta}} &= m_1 \alpha^2 \ddot{\theta} + m_2 (\alpha +q)^2 \ddot{\theta} + 2 m_2 (\alpha + q) \dot{q} \dot{\theta}\\ &= \left(m_1 \alpha^2 + m_2(\alpha + q)^2\right) \ddot{\theta} + 2 m_2( \alpha + q) \dot{\theta} \dot{q} \end{align*}$$ For the second part of the right sight we differentiate with respect to the position. $$\begin{align*} \dfrac{\partial L}{ \partial \theta} &= - m_1 \alpha g \cos(\theta) - m_2 (\alpha + q) g \cos(\theta) \\ &= - \left(m_1 \alpha + m_2 (\alpha + q)\right) g \cos(\theta) \end{align*}$$ Pluging this in we get $$\begin{align*} \dfrac{d}{dt} \dfrac{\partial L}{ \partial \dot{\theta}} - \dfrac{\partial L}{\partial \theta} &= \left(m_1 \alpha^2 + m_2(\alpha + q)^2\right) \ddot{\theta} + 2 m_2( \alpha + q) \dot{\theta} \dot{q} + \left(m_1 \alpha + m_2 (\alpha + q)\right) g \cos(\theta) \\ u_1 &= \left(m_1 \alpha^2 + m_2(\alpha + q)^2\right) \ddot{\theta} + 2 m_2( \alpha + q) \dot{\theta} \dot{q} + \left(m_1 \alpha + m_2 (\alpha + q)\right) g \cos(\theta) \end{align*}$$ Now we do the same for the prismatic joint. $$\begin{align*} \dfrac{\partial L}{ \partial \dot{q}} &= m_2 \dot{q} \\ \dfrac{d}{dt}\dfrac{\partial L}{d \partial \dot{q}} &= m_2 \ddot{q} \\ \dfrac{\partial L}{ \partial q} &= m_2(\alpha + q) \dot{\theta}^2 - m_2g\sin(\theta) \\ \dfrac{d}{dt} \dfrac{\partial L}{ \partial \dot{q}} - \dfrac{\partial L}{\partial q} &= m_2 \ddot{q} - m_2(\alpha + q) \dot{\theta}^2 + m_2g\sin(\theta) \\ u_2 &= m_2 \ddot{q} - m_2(\alpha + q) \dot{\theta}^2 + m_2g\sin(\theta) \end{align*}$$ We directly get the equation for the inverse dynamics model which can be written in the matrix form again:

$$\begin{align*} \mathbf{u} &= M(\mathbf{q}) \mathbf{\ddot{q}} + c(\mathbf{q},\mathbf{\dot{q}}) + g(\mathbf{q}) \\ &=\begin{pmatrix} m_1\alpha^2 + m_2(\alpha +q )^2 & 0 \\ 0 & m_2 \end{pmatrix}\begin{pmatrix} \ddot{\theta} \\ \ddot{q}\end{pmatrix} +\begin{pmatrix} 2m_2(\alpha + q)\dot{\theta}\dot{q} \\ - m_2(\alpha+q)\dot{\theta}^2\end{pmatrix} + \begin{pmatrix}\left(m_1\alpha + m_2(\alpha + q)\right)g \cos(\theta) \\ m_2 g \sin(\theta)\end{pmatrix}\end{align*}$$

You should also note that we get the same result as we got using force dissection (which is nice and makes me very happy - or I got both wrong)


Comparison of Complexity

Naturally the question arises which method to use. Considering this theoretically Newton-Euler is in $\mathcal{O}(n)$ while the Lagrangian is in $\mathcal{O}(n^3)$ so the answer should be clear and if need performance, it is. However it is still good to know about both, since, as seen in the example above, often the Lagrangian is faster if you do the calculations for a robot by hand, especially if you have no clue about physics.

 

Self test

Task Representation

Self test

Control

L2_Control

Before we actually start manipulating robots we must first define what a robot is. Pretty much everyone not living under a rock for the past 50 years has a vague idea of what they are, especially because Hollywood (And thus people) is in love with robots. Just look at all these robots:

Ultron

Robots actually come from literature, the writer Karel Čapek coined the term and was continued by Isaac Asimov and other Science Fiction writers. The word described an artificial source of manual work.

Roomba

Now, what do all of these so-called robots have in common?

If you answered that they can all move (They have extremities) then you are correct and Jan will throw you (hopefully without killing anyone) a snickers.

Snicker

Robots are distinguished from a normal computer by the fact that robots can process information, be programmed and calculate numbers (just like computers) and they can interact directly with the real world through various extremities or actuators:

A computer is just an amputee robot. (G. Randlov)

Let's have a look at the actual names of the parts that make up a robot

Self test

Recommended Literature

  • Book 1
  • Book 2

...

Discussion and Comments

Comment
Author   

  

zum Seitenanfang