# Robotics Kinematics and Dynamics/Serial Manipulator Differential Kinematics
## Twists

A popular, and minimal way to represent the time derivate of a pose is a twist. A twist consists of two 3 × 1 vectors: $\omega$ and $v$, where $\omega$ is the angular velocity of the moving rigid body (manipulator link), and $v$ is the linear velocity of the point on the moving rigid body that instantaneously coincides with the origin of the reference frame.
$t=\left({\begin{array}{c}\omega \\v\end{array}}\right)$

## Propagation of Velocity

Rotational velocities that are written with respect to the same frame can simply be added. Hence:
    $_{i+1}\omega _{i+1}=\,_{i+1}^{i}R\,_{i}\omega _{i}+{\begin{pmatrix}0\\0\\{\dot {\theta }}_{i+1}\end{pmatrix}}$
The linear velocity of the origin of a link is that of the origin of the preceeding link plus a rotational component:
    $_{i+1}v_{i+1}=\,_{i+1}^{i}R\left(_{i}v_{i}+_{i}\omega _{i}\times \,_{i}P_{i+1}\right)$
Note: In the above equations the resulting velocities are expressed relative to the frame of the current link. $_{i}P_{i+1}$ is the vector pointing from the origin of frame ${i}$ to that of frame ${i+1}$.

### Example: The Two-Link Planar Manipulator

The link transformations that come with this manipulator can be easily derived graphically from looking at the figure on the right:
    $_{0}^{1}T={\begin{pmatrix}c_{1}&-s_{1}&0&0\\s_{1}&c_{1}&0&0\\0&0&1&0\\0&0&0&1\\\end{pmatrix}}$
    $_{1}^{2}T={\begin{pmatrix}c_{2}&-s_{2}&0&l_{1}\\s_{2}&c_{2}&0&0\\0&0&1&0\\0&0&0&1\\\end{pmatrix}}$
    $_{2}^{3}T={\begin{pmatrix}1&0&0&l_{2}\\0&1&0&0\\0&0&1&0\\0&0&0&1\\\end{pmatrix}}$
Here, $l_{1}$ and $l_{2}$ are the lengths link 1 and 2, respectively.
Note: Notice again the use of $s_{i}$ and $c_{i}$ as shorthand notations for $sin(\theta _{i})$ and $cos(\theta _{i})$, respectively.
Hence, from the above equations:
    $_{2}\omega _{2}={\begin{pmatrix}0\\0\\{\dot {\theta _{1}}}+{\dot {\theta _{2}}}\end{pmatrix}}$
and:
    $_{3}\omega _{3}=_{2}\omega _{2}$
Also:
    $_{2}v_{2}={\begin{pmatrix}c_{2}&s_{2}&0\\-s_{2}&c_{2}&0\\0&0&1\end{pmatrix}}\left[{\begin{pmatrix}0\\0\\{\dot {\theta _{1}}}\end{pmatrix}}\times {\begin{pmatrix}l_{1}\\0\\0\end{pmatrix}}\right]={\begin{pmatrix}l_{1}s_{2}{\dot {\theta _{1}}}\\l_{1}c_{2}{\dot {\theta _{1}}}\\0\end{pmatrix}}$
and:
    $_{3}v_{3}={\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix}}\left[{\begin{pmatrix}l_{1}s_{2}{\dot {\theta _{1}}}\\l_{1}c_{2}{\dot {\theta _{2}}}\\0\end{pmatrix}}+{\begin{pmatrix}0\\0\\{\dot {\theta _{1}}}+{\dot {\theta _{2}}}\end{pmatrix}}\times {\begin{pmatrix}l_{2}\\0\\0\end{pmatrix}}\right]={\begin{pmatrix}l_{1}s_{2}{\dot {\theta _{1}}}\\l_{1}c_{2}{\dot {\theta _{2}}}+l_{2}({\dot {\theta _{1}}}+{\dot {\theta _{2}}})\\0\end{pmatrix}}$
With respect to the base frame, the end-effector velocity becomes:
    $_{0}v_{3}=\,_{0}^{3}R\,_{3}v_{3}=\,_{0}^{1}R\,_{1}^{2}R\,_{2}^{3}R\,_{3}v_{3}={\begin{pmatrix}-l_{1}s_{1}{\dot {\theta _{1}}}-l_{2}s_{12}({\dot {\theta _{1}}}+{\dot {\theta _{2}}})\\l_{1}c_{1}{\dot {\theta _{1}}}-l_{2}c_{12}({\dot {\theta _{1}}}+{\dot {\theta _{2}}})\\0\end{pmatrix}}$

## Jacobian

Suppose $m$ kinematic (end-effector) equations. Each is a function of $n$ degrees of freedom:
    ${\begin{array}{ccc}x_{1}&=&x_{1}(\theta _{1},\ldots ,\theta _{n})\\\vdots &&\vdots \\x_{m}&=&x_{m}(\theta _{1},\ldots ,\theta _{n})\\\end{array}}$
Note that in the case of a non-redundant manipulator, $m=n$.
The time derivate of the above equations is found as follows:
    ${\begin{array}{ccc}{\dfrac {dx_{1}}{dt}}&=&{\dfrac {\partial x_{1}}{\partial \theta _{1}}}{\dfrac {d\theta _{1}}{dt}}+\cdots +{\dfrac {\partial x_{1}}{\partial \theta _{n}}}{\dfrac {d\theta _{n}}{dt}}\\\vdots &&\vdots \\{\dfrac {dx_{m}}{dt}}&=&{\dfrac {\partial x_{m}}{\partial \theta _{1}}}{\dfrac {d\theta _{1}}{dt}}+\cdots +{\dfrac {\partial x_{m}}{\partial \theta _{n}}}{\dfrac {d\theta _{n}}{dt}}\end{array}}$
This can be written in vector form:
    $v=J{\frac {d\theta }{dt}}$
The matrix $J$ is called the Jacobian, the matrix of which the elements are the partial derivatives of the kinematics equations. The relationship between the end-effector velocity and the (known) joint velocities is thus fully described by the Jacobian. The end-effector velocity is a linear function of the joint velocities.
$J={\begin{pmatrix}{\frac {\partial x_{1}}{\partial \theta _{1}}}&\cdots &{\frac {\partial x_{1}}{\partial \theta _{n}}}\\\vdots &\ddots &\vdots \\{\frac {\partial x_{m}}{\partial \theta _{1}}}&\cdots &{\frac {\partial x_{m}}{\partial \theta _{n}}}\end{pmatrix}}$

### Example: The Two-Link Planar Manipulator

This example presents a slightly other way of solving the above problem. The position kinematics equations of this manipulator can be easily derived using the technique presented in the Serial Manipulator Position Kinematics section, or graphically from looking at the figure above:
    ${\begin{array}{l}x=l_{1}\cos(\theta _{1})+l_{2}\cos(\theta _{1}+\theta _{2})\\y=l_{1}\sin(\theta _{1})+l_{2}\sin(\theta _{1}+\theta _{2})\end{array}}$
Here, the Jacobian is:
    $J={\begin{pmatrix}-l_{1}\sin(\theta _{1})-l_{2}\sin(\theta _{1}+\theta _{2})&-l_{2}\sin(\theta _{1}+\theta _{2})\\l_{1}\cos(\theta _{1})+l_{2}\cos(\theta _{1}+\theta _{2})&l_{2}\cos(\theta _{1}+\theta _{2})\\\end{pmatrix}}$
Hence, the end-effector velocity is:
    ${\begin{array}{ccc}{\dfrac {dx}{dt}}&=&\left[-l_{1}\sin(\theta _{1})-l_{2}\sin(\theta _{1}+\theta _{2})\right]{\dfrac {d\theta _{1}}{dt}}-l_{2}\sin(\theta _{1}+\theta _{2}){\dfrac {d\theta _{2}}{dt}}\\{\dfrac {dy}{dt}}&=&\left[l_{1}\cos(\theta _{1})+l_{2}\cos(\theta _{1}+\theta _{2})\right]{\dfrac {d\theta _{1}}{dt}}+l_{2}\cos(\theta _{1}+\theta _{2}){\dfrac {d\theta _{2}}{dt}}\\\end{array}}$
Note that the end-effector's angular velocity is, of course, the sum of the joint velocities. Another possibility that yields exactly the same result would be to explicitly include the equation for angular velocity and then calculate the Jacobian accordingly. This result is, as could already be expected, the same as the one in the above example, where the link transformation matrices were used to achieve the result.

## Inverse Velocity Kinematics

This problem can easily be solved by inverting the Jacobian...

### Singularities

If the Jacobian $J$ is invertible, inverting it can be used to easily calculate the joint velocities if the (Cartesian) end-effector velocity is given. Locations (combinations of $\theta _{i}$ where the Jacobian is not invertible are called singularities. Setting the determinant of $J$ equal to zero and solving for $\theta$ allows for finding these singularities. These positions correspond to the loss of a degree of freedom.