Lecture11
Lecture11
Glen Henshaw
Craig Carignan
March 6, 2025
min ∥ O 0
W T − T (q)∥
q
1
Jacobian relationship:
ẋ = J(q)q̇
is linear with respect to the joint rates q̇. The problem, of course, is that the
Jacobian relationship goes the wrong way. We want to be able to fix ẋ and
calculate q̇.
You could consider just inverting the Jacobian:
q̇ = J −1 (q)ẋ
This is also, generally speaking, a bad idea. The most obvious problem is that
the Jacobian may not even be square: it is N × 6, where N is the number of
degrees of freedom of the manipulator. So if your manipulator is not 6–DOF,
you can’t take an inverse. But even if you do have a 6–DOF manipulator, simply
inverting the Jacobian is a bad idea, because square matrices can be singular.
So we’ll talk about what it means, both mathematically and mechanically, to
have a singular Jacobian.
2
direction. Recall that the standard (read: bad) way of calculating an inverse
that is taught in linear algebra courses involves dividing by the matrix determi-
nant. A singular matrix has a determinant of 0, so attempting to calculate the
inverse of a singular matrix is the linear algebra equivalent of a divide–by–zero.
Consequently, if you blindly stuff a singular Jacobian into any sort of nu-
merical inversion routine, in the best case you will end up with infinite values
for at least some of the matrix entries (assuming your code doesn’t just blow
up!), and if you then multiply it by a desired Cartesian tooltip velocity vector,
you may end up with infinitely large joint rates.
• small desired end effector velocities may result in very large joint velocities
• small joint torques may cause very large tool tip forces
There are two types of singularities: boundary singularities and internal
singularities. Boundary singularities are poses where the tooltip lies on the
boundary of the workspace. Remember our diagram from last lecture: except
here the arm is full stretched out so that the end effector lies exactly on the
outer workspace boundary. This arm is in a singular pose, and cannot pro-
duce a Cartesian velocity along the direction orthogonal to the normal of the
workspace (either inward or outward). All robotic arms have singular poses at
their workspace boundaries.
For many manipulators there are also poses that are not on a workspace
boundary where the manipulator cannot produce a velocity in some direction.
It’s important to avoid these situations. Some ways to locate such poses:
• Set the determinant to zero, |J(q)| = 0, and solve for q
– only works for 6–DOF arms (or other arms with square Jacobians)
– this is essentially an exhaustive search; there may be many such
poses, and you have to somehow find all of them.
3
y
5
3
l2
2
l1
1
0
−5 −4 −3 −2 −1 0 1 2 3 4 5 x
−1 if l < l
2 1
−2
−3
−4
−5
|J| = l1 l2 s2 = 0 ⇒ θ2 = 0◦ or 180◦
4
y
5
3
θ2
θ1
0
0 1 2 x
in which case,
3 0 0
J=
l1 + l2 l2
and the two columns are not linearly dependent.
which implies that the arm cannot move in the y direction, and an attempt to
set ẋ will result in the denominators of the fractions becoming zero, hence the
joint rates will become infinite.
NOTE, however that even if θ2 is not exactly 0◦ or 180◦ but is merely
close to one of these values, the denominators of the expressions will be quite
large. Hence, the singularity is “felt” for some distance away; exactly how far
depends on the maximum joint rates that are acceptable and/or achievable.
5
so
1 1 c2
fx = τ1 − + τ2
l1 s2 l1 s2 l2 s2
1
fy = τ2
l2
which implies that fx → ∞ near the singularity.
0 s4 −c4 s5
3
Jrot = 1 0 c5
0 c4 s4 s5
| 3 J| = − sin θ5 ⇒ θ5 = 0◦ , ±180◦
At the singularity,
0 s4 0
3
Jrot = 1 0 1
0 c4 0
so the first and third columns are linearly dependent. At the singularity, the
first roll axis is aligned with the third roll axis, and essentially they have become
redundant.
This is an important point: interior singularities occur at poses where degrees
of freedom that are normally independent become redundant.
4.3 Pseudo–inverses
OK, so if taking a direct inverse of the Jacobian is a bad idea, what else can
we do? A better idea is to use a pseudo–inverse. Contrary to popular opinion,
there are in general an infinite number of pseudo–inverses for a matrix, but the
one everyone knows about is the Moore–Penrose pseudo–inverse:
J † ≜ J T (JJ T ) −1
| {z }
square!
6
What this means is that of all the vectors of joint rates that lie in the nullspace of
the Jacobian, the Moore–Penrose pseudo–inverse finds the one that is smallest,
e.g. the joints rates are the lowest.
To tie this into our aside above: any given pseudo–inverse will choose exactly
one joint rate vector q̇ 2 that satisfies ẋ = J(q)q̇ 2 . But if the Jacobian has a
nontrivial nullspace N (J), we can find an infinite number of vectors q̇ 1 such
that ẋ = J(q)(q̇ 2 + q̇ 1 ). The Moore–Penrose pseudo–inverse inherently chooses
q̇ 1 such that ∥q̇ 1 + q̇ 2 ∥22 is the smallest it can be.
There are more clever ways to pick q̇ 1 . You could, for instance, choose a q̇ 1
that moves the elbow of your arm away from a potential collision hazard or that
improved its manipulability.
One easy way to improve the robustness of any technique that uses a Moore–
Penrose pseudo–inverse is to add what is called a damped least–squares term:
J † ≜ J T (JJ T + γI)−1
q i+1 = q i + J † (q i )ẋ
7
i.e. use a straight forward Euler integration scheme, you will get trajectories
that look like this:
desired
actual
x = f (q)
x0 = f (q0 )
∂f
f (q 0 + ∆q) = f (q 0 ) + ∆θ + O(∆q 2 )
∂q q=q
0
†
q = q 0 + J (q 0 ) [x − x0 ] for N = M (1)
| {z }
∆x
8
where ψ is a scalar and n̂ is a 3–vector. In a small angle situation, ψ is close
to unity and n̂ is close to zero, and exactly zero if the angle is zero. In fact, for
small angles, n̂ approximates 1/2 time the 3–2–1 Euler angles. In general we
use n̂ as the rotation part.
So what’s ∆x? Again, for the positional part it’s straightforward: it’s p − p0 .
And again, for rotation... it’s complicated.
If you are using an Euler angle or fixed angle set, you can subtract them.
This hand–waves over a bunch of math but as a small angle approximation it
holds, and only extreme pedants (or possibly those cramming fo their doctoral
T
quals) need go any further. So if you are using the [α, β, γ] set:
p
α − α0
x= β − β0
γ − γ0
If you are using a quaternion representation, you really shouldn’t just sub-
tract n̂ from n̂0 . The proper way to calculate the difference between two quater-
nions q and q is:
∼ ∼0
q 0 ∗ ∆q = q ⇒ ∆q = q ∗ q −1
0
∼ ∼ ∼ ∼ ∼ ∼
1 q 0 = q and x0 = f (q)
2 ∆x = x“-”x0
3 J = J(q)
4 ∆q = J † ∆x
5 q = q 0 + ∆q
6 ∥∆q∥ < ϵ? If yes, stop
7 go to 1
9
4.4.2 Direct Error Correction
Another way to solve the integral drift problem is simply to build an error
correction term into the RMRC law, e.g. to implement
where γ is a gain that has to be selected for good performance, and everything
else is defined as we did above.
This is in a form for which there are many good, realtime–capable quadratic
optimization solvers. unlike the two previous techniques, though, in this form
it’s easy to add constraints, e.g.
s.t.
−θ1,min ≤ θ1 ≤ θ1,max
−θ2,min ≤ θ2 ≤ θ2,max
..
.
and with a little cleverness you can even add constraints that depend on q,
not q̇, such as collision constraints. You can also correct for integrator drift by
solving
Thinking along these lines eventually leads you to a technique called model–
predictive control, which if you’ve ever seen YouTube videos of robots doing
parkour, you’ve seen in action. It is a very powerful technique for robotic
motion control.
10