MIT 6.4210 — Lecture 4

Basic Kinematics

§ Task vs. Configuration Space

Recall the distinction between task space and configuration space. For example, given a Kuka IIWA manipulator…

Last lecture, we discussed how we represent and work with the task space of the end effector. In this lecture, we work in the configuration space—how should we move the joints such that the gripper moves to the state we desire?

Definition. We often talk about the following forms of kinematics.

§ Forward Kinematics

As one might expect, forward kinematics is purely deterministic and very easy to compute: just compose transforms. To demonstrate, here's how that looks for a simplified 2D Kuka IIWA.

aX2(q0,q1)=aX0 0Xb(q0) bX1 1Xc(q1) cX2{}^aX^2(q_0, q_1) = {}^aX^0 \ {}^0X^b(q_0) \ {}^bX^1 \ {}^1X^c(q_1) \ {}^cX^2

Some observations about the above:

Remark. The pose of a single free body has six parameters—three for its position, and three for its orientation. But in Drake, the pose is represented using seven parameters, because the orientation is expressed using quaternions.

§ Inverse Kinematics

As one might expect, inverse kinematics can have many solutions (or none) and is very hard to compute exactly.

One could use analytic approaches to find one of the (usually many!) exact solutions to an inverse kinematics problem. But for systems with many parameters—such as our Kuka IIWA manipulator—this is not a feasible approach.

Next lecture, we'll discuss numerical approaches for estimating a solution to an inverse kinematics problem.

§ Differential Kinematics: Analytic Jacobian

Back to something easy. From forward kinematics, we know that for any body BB with kk parameters qq that define its pose, there is a map fkinB ⁣:Rk→R3+ℓf_{\mathrm{kin}}^B \colon \mathbb{R}^k \to \mathbb{R}^{3 + \ell} such that XB=fkinB(q)X^B = f_{\mathrm{kin}}^B(q). We can now differentiate this map to achieve:

dXB=∂fkinB(q)∂qdq=JB(q)dq,  where JB(q) is the Analytic Jacobian.\mathrm{d}X^B = \frac{\partial f_{\mathrm{kin}}^B(q)}{\partial q} \mathrm{d}q = J^B(q) \mathrm{d}q, ~ \text{ where } J^B(q) \text{ is the } \textbf{Analytic Jacobian.}

In particular, the analytic Jacobian is a derivative of a pose parametrization. Explicitly,

x(q)=[p(q)ϕ(q)] where p(q)∈R3 and ϕ(q)∈Rℓ,x(q) = \begin{bmatrix} p(q) \\ \phi(q) \end{bmatrix} \text{ where } p(q) \in \mathbb{R}^3 \text{ and } \phi(q) \in \mathbb{R}^{\ell},

where ℓ\ell depends on the choice of orientation parametrization. For example, roll-pitch-yaw would require ℓ=3\ell = 3, whereas quaternions would yield ℓ=4\ell = 4, and rotation matrices would yield ℓ=9\ell = 9.

It then follows that JB(q)J^B(q) and dq\mathrm{d}q look like:

JB(q)=∂x∂q=[∂p/∂q1∂p/∂q2⋯∂p/∂qk∂ϕ/∂q1∂ϕ/∂q2⋯∂ϕ/∂qk]∈R(3+ℓ)×(k)  and  dq=[dq1dq2⋮dqk]∈Rk.J^B(q) = \frac{\partial x}{\partial q} = \begin{bmatrix} \partial p/\partial q_1 & \partial p/\partial q_2 & \cdots & \partial p/\partial q_k \\ \partial \phi/\partial q_1 & \partial \phi/\partial q_2 & \cdots & \partial \phi/\partial q_k \\ \end{bmatrix} \in \mathbb{R}^{(3 + \ell) \times (k)} ~ \text{ and } ~ \mathrm{d}q = \begin{bmatrix} \mathrm{d}q_1 \\ \mathrm{d}q_2 \\ \vdots \\ \mathrm{d}q_k \end{bmatrix} \in \mathbb{R}^k.

For the simplified 2D Kuka IIWA from earlier (with L=1L = 1), (warning: AI-generated) widget below shows how JC(q)J^C(q) depends on the choice of orientation parametrization.

JC(q) =
30°
40°

§ Differential Kinematics: Geometric Jacobian

There's a nice simplifying trick, though. Whereas orientation has many different parametrizations—all of them flawed—velocity (as in, translational and rotational velocity combined) has a very natural 66-variable parametrization: the spatial velocity.

Definition. The spatial velocity of BB relative to AA is:

ddtAXFB=AVFB=[AωFBAvFB]=[AωF,xBAωF,yBAωF,zBAvF,xBAvF,yBAvF,zB]∈R6,\frac{\mathrm{d}}{\mathrm{d}t} {}^AX^B_F = {}^AV^B_F = \begin{bmatrix} {}^A\omega^B_F \\ {}^Av^B_F \end{bmatrix} = \begin{bmatrix} {}^A\omega^B_{F, x} \\ {}^A\omega^B_{F, y} \\ {}^A\omega^B_{F, z} \\ {}^Av^B_{F, x} \\ {}^Av^B_{F, y} \\ {}^Av^B_{F, z} \end{bmatrix} \in \mathbb{R}^6,

where AωFB∈R3{}^A\omega^B_F \in \mathbb{R}^3 is angular velocity, and AvFB∈R3{}^Av^B_F \in \mathbb{R}^3 is translational velocity.

Remark. Recall that AωFB∈R3{}^A\omega^B_F \in \mathbb{R}^3 points along the axis of rotation with magnitude given by the angular speed. Equivalently, if

AωFB=[AωF,xBAωF,yBAωF,zB]∈R3,{}^A\omega^B_F = \begin{bmatrix} {}^A\omega^B_{F, x} \\ {}^A\omega^B_{F, y} \\ {}^A\omega^B_{F, z} \end{bmatrix} \in \mathbb{R}^3,

that means the rotation is equivalent to the composition of a rotation with speed AωF,xB{}^A\omega^B_{F, x} about the xx-axis, a rotation with speed AωF,yB{}^A\omega^B_{F, y} about the yy-axis, and a rotation with speed AωF,zB{}^A\omega^B_{F, z} about the zz-axis.

Then JB(q)J^B(q) is not very hard to compute; the ithi^{\text{th}} column is an R6\mathbb{R}^6-vector that reads the rotational and translational velocities incurred by changing the ithi^{\text{th}} parameter qiq_i.

For example, for revolute joints (i.e., every joint qiq_i can only rotate about a line z^i\hat{z}_i), we have:

JB(q)=[z^1z^2⋯z^kz^1×J1pBz^2×J2pB⋯z^k×JkpB]∈R6×k  and  dq=[dq1dq2⋮dqk]∈Rk.J^B(q) = \begin{bmatrix} \hat{z}_1 & \hat{z}_2 & \cdots & \hat{z}_k \\ \hat{z}_1 \times {}^{J_1}p^B & \hat{z}_2 \times {}^{J_2}p^B & \cdots & \hat{z}_k \times {}^{J_k}p^B \end{bmatrix} \in \mathbb{R}^{6 \times k} ~ \text{ and } ~ \mathrm{d}q = \begin{bmatrix} \mathrm{d}q_1 \\ \mathrm{d}q_2 \\ \vdots \\ \mathrm{d}q_k \end{bmatrix} \in \mathbb{R}^k.

When parametrizing velocities in this way, the JB(q)J^B(q) we achieve is specifically called the Geometric Jacobian.

Notice how each joint gets one column, and the height of the geometric Jacobian is always 66, independent of how we internally represent the end effector's orientation.

Problem. Recall the simplified 2D Kuka IIWA from earlier, specifically in the case where both rods have length L=1L = 1. What is the geometric Jacobian JC(q)J^C(q) of the tip CC?

Solution: There are k=2k = 2 joints, and they are both revolute joints. Applying the formula above, we find:

JC(q)=[000011−sin⁡(q0)−sin⁡(q0+q1)−sin⁡(q0+q1)cos⁡(q0)+cos⁡(q0+q1)cos⁡(q0+q1)00]∈R6×2.J^C(q) = \begin{bmatrix} 0 & 0 \\ 0 & 0 \\ 1 & 1 \\ -\sin(q_0) - \sin(q_0 + q_1) & -\sin(q_0 + q_1) \\ \cos(q_0) + \cos(q_0 + q_1) & \cos(q_0 + q_1) \\ 0 & 0 \end{bmatrix} \in \mathbb{R}^{6 \times 2}.

Check this for yourself; you can also play around with the (warning: AI-generated) widget below.

JC(q) =
30°
40°

Note that the angular speed is not factored into JC(q)J^C(q), because it's factored into dq\mathrm{d}q instead.   ■\blacksquare

You can also check for yourself that the dimensions of the geometric Jacobian of the IIWA are 6×76 \times 7.

§ Inverse Differential Kinematics: Pseudo-Inverse

Inverse differential kinematics is actually not so hard; from the relationship dXB=JB(q)dq\mathrm{d}X^B = J^B(q) \mathrm{d}q, it follows that dq=JB(q)−1dXB\mathrm{d}q = J^B(q)^{-1}\mathrm{d}X^B.

But this doesn't actually work as written, because JB(q)−1J^B(q)^{-1} need not exist, because the geometric Jacobian might not be square. (In general, its dimensions are 6×k6 \times k, where kk is the number of joints.)

The fix, in general, is to take inspiration from Lecture 23 of 18.650, on linear regression.

Definition. The Moore-Penrose Pseudo-Inverse J+J^+ of a matrix JJ has two versions, depending on the rank of JJ.

Remark. Suppose J ⁣:Rn→RmJ \colon \mathbb{R}^n \to \mathbb{R}^m is full row rank with n>mn > m and has null space WW. Then the pseudo-inverse J+J^+ must be a bijection from Rm\mathbb{R}^m to W⊥⊆RnW^{\perp} \subseteq \mathbb{R}^n, as shown in the image below.

CYU: Explain why the map M ⁣:Rn→RnM \colon \mathbb{R}^n \to \mathbb{R}^n given by M:=I−J+JM := I - J^+J projects vectors x∈Rnx \in \mathbb{R}^n onto the null space of JJ.

Example. Some examples of whether JJ has full column rank or full row rank.

And here's the property of J+J^+ that makes it so useful, as in both 18.650 and this class.

Theorem. (Pseudo-Inverse Approximation) For any matrix JJ and vector bb (with appropriate dimensions), the vector x∗:=J+bx^* := J^+b is the vector with minimum magnitude across all vectors that minimize ∥Jx−b∥\|Jx - b\|. In particular,

§ Inverse Differential Kinematics: Singularities and Damping

But there's still an issue with the pseudo-inverse as stated above; its values can explode near singularities.

Definition. We say there is a singularity when the rows of JB(q)J^B(q) for the velocities we want to control are not full row rank.

Example. In the two-rod example from earlier, when considering only the gripper's (x,y)(x, y) velocity, one singularity occurs when q1=0q_1 = 0: both joints can then only move the gripper perpendicular to the arm.

Observe this in the (warning: AI-generated) widget below. When q1q_1 approaches 00, and the desired dX\mathrm{d}X points outside the shaded ellipse, the computed (dq0,dq1)(\mathrm{d}q_0, \mathrm{d}q_1) values blow up.

reachable, |dq| ≤ 1 desired dX achieved J dq

dq0 0
dq1 0
Tip error 0
30°
40°
0°
0.00

The fix for this problem is also inspired by 18.650; it's equivalent to adding a ridge regression term.

Definition. The damped pseudo-inverse of JJ (for any JJ, given λ>0\lambda > 0) is:

J∗=J⊤(JJ⊤+λI)−1.J^* = J^{\top}(JJ^{\top} + \lambda I)^{-1}.

The λI\lambda I term prevents things from exploding when JJ⊤JJ^{\top} is close to zero in some directions. You can also observe this using the widget above; the λI\lambda I sacrifices output accuracy in favor of controlled (dq0,dq1)(\mathrm{d}q_0, \mathrm{d}q_1) values.

Remark. The existence of a singularity is not enough to cause concern if that singularity occurs momentarily.

For example, if q1q_1 gradually decreases from +10∘+10^{\circ} to −10∘-10^{\circ}, then there is a moment when q1=0∘q_1 = 0^{\circ} and a singularity occurs. But such a moment is instantaneous; the pre-existing momentum of the robot allows it to pass the singularity unharmed.

§ Addendum: Velocities and Change-Of-Frame

The lecture also covers the following information about how velocities change between frames.

Theorem. (Monogram Velocities) The following identities are all true.

Proof: The simplified 2D Kuka IIWA example from earlier is a prototype to use when thinking through these identities.

For the identity AvFC=AvFB+BvFC+AωFB×BpFC{}^Av^C_F = {}^Av^B_F + {}^Bv^C_F + {}^A\omega^B_F \times {}^Bp^C_F, for example, recall that BvFC{}^Bv^C_F only captures the movement of tip CC in the frame of joint BB. So if only joint BB is rotating, then BvFC{}^Bv^C_F is zero, even though CC is moving in the frame of AA.

To account for the movement of tip CC caused by the rotation of frame BB, we must add the term AωFB×BpFC{}^A\omega^B_F \times {}^Bp^C_F. (You can check that the proportionalities make sense.)   ■\blacksquare