One path to the tool

Two routes to a Jacobian

An open chain's Jacobian is a list of its joint axes, drawn as lines in the same picture as the arm. A finite difference of its own forward kinematics is a completely different computation and has to agree — and when the two disagreed by 5 × 10⁻⁵, the fault was in a function six phases old that every spatial loop on this site had been using.

Assumes The chain that does not close and Every motion is a screw.

Everything this field says about velocity, singularity, redundancy and error comes out of one matrix. It is worth building carefully, and it is worth building twice.

The construction is short. Column i of an open chain’s Jacobian is joint i’s home screw, carried by the product of the joints in front of it. For a revolute joint a screw is an axis — a line in space, with zero pitch — so the matrix is a list of lines, and the lines are drawn in every figure in this field.

elbow arm at a postureelbow arm, drawn from 6 joint values through a product of 6 exponentials — no equation is solved anywhere in this picture, because an open chain has none to solve. The thin lines are the joint axes at this configuration, which are also the columns of the arm's Jacobian: the tool's velocity is a sum of turns about exactly those lines. Here the smallest singular value of that Jacobian is 0.3674 and the largest is 2.407, so the arm is comfortably away from a configuration where a direction of motion is lost. Drag θ₃ elbow.θ₁ baseθ₂ shoulderθ₃ elbowθ₄ roll θ₅ θ₆toolσ_min 0.3674 · condition 6.6the pose is a product of exponentials, not a solve
Fig. 1 The six dashed lines are the Jacobian. Each one is a joint axis at this configuration, and the tool’s motion is a sum of turns about exactly those lines, one per joint, weighted by joint rate. Nothing has been differentiated to obtain them: the axis of joint three is the home axis of joint three, moved by the two joints in front of it, which is the same walk the drawing does.

That description is unavailable elsewhere on this site. A four-bar’s Jacobian is the derivative of its closure equations — a matrix of partial derivatives with no picture attached. An arm’s is geometry, and the difference shows up immediately: a rank deficiency here is visible, as two lines coinciding or three lines meeting, rather than as a determinant that has gone small.

The other route

A second computation, sharing no arithmetic with the first: perturb one joint by hh either way, take the tool’s pose before and after, and read off the twist that carries one to the other as the logarithm of the relative transform, divided by 2h2h. No screw is ever mentioned. The forward map is treated as a black box that turns six numbers into a rigid transform.

Over twelve configurations of four arms — the planar three-link, the six-joint elbow, the seven-joint shoulder-elbow-wrist and the SCARA — the two agree to 8.5×10108.5 \times 10^{-10} in the worst entry of any column. That is the noise floor of a central difference at h=106h = 10^{-6}, and it is what agreement looks like.

They did not agree at first, and the disagreement is the most useful thing in this essay.

Five parts in a hundred thousand

The first run reported a worst-case difference of 5×1055 \times 10^{-5}.

That is not a tolerance question. A central difference has an error of order h2h^2 times a third derivative, which at h=106h = 10^{-6} is around 101210^{-12}; a rounding-driven error is around ε/h=1010\varepsilon/h = 10^{-10}. Five parts in a hundred thousand is seven orders of magnitude too large to be either, so one of the two routes was wrong, and the assertion could not say which.

The fault was in neither. It was in logSE3, which converts a rigid transform to the twist that generates it, and which every spatial loop on this site has used since the expansion phase. Its translation part carries a correction factor whose coefficient is written

k=1θ2(1θsinθ2(1cosθ))k = \frac{1}{\theta^2}\left(1 - \frac{\theta \sin\theta}{2(1 - \cos\theta)}\right)

and whose value as θ0\theta \to 0 is 1/121/12. Read it as a floating-point expression rather than as algebra and it is a cancellation nested inside a cancellation: the bracket subtracts from one a ratio that tends to one, and the ratio’s denominator is 1cosθ1 - \cos\theta, which at small θ\theta is itself computed by subtracting two numbers that are nearly equal.

The arithmetic is easy to follow and worth following. At θ=106\theta = 10^{-6}, 1cosθ1 - \cos\theta is about 5×10135 \times 10^{-13} and carries an absolute error of about 101610^{-16}, so a relative error of 2×1042\times10^{-4}. That error passes straight into the ratio, and the bracket — whose true value is θ2/128×1014\theta^2/12 \approx 8\times 10^{-14} — comes out as roughly ±2×104\pm 2 \times 10^{-4} instead. Divided by θ2\theta^2, kk comes back at ±105\pm 10^5 where it should be 0.0830.083. Below θ1.5×108\theta \approx 1.5\times10^{-8} the denominator underflows to zero outright and kk is NaN.

The guard against all this fired only below 101010^{-10} — past the underflow, and four orders of magnitude past the point where the answer had stopped being right.

Why nothing had noticed

The window where the coefficient is wrong runs from about 10810^{-8} up to about 10310^{-3} in the rotation angle, and this site had never asked for a logarithm in it.

A loop’s Newton residual starts at 10110^{-1} and lands at 101610^{-16} in three or four steps. It crosses the bad window between two iterations rather than stopping in it, and a step taken with a slightly wrong linearisation still converges — Newton is forgiving about the direction of a step as long as it is roughly right, and the correction term this coefficient scales is second order in the residual anyway. Six phases of figures are unaffected, and that was checked rather than assumed: the built output is byte-identical before and after the repair.

A finite difference lands in the window every single time. A difference step is a rotation of a few microradians. The moment this field asked its first question, the bug had nowhere to hide.

That is a pattern worth naming, because it is the third time this site has met it. A defect can be invisible not because it is small but because nothing has ever evaluated the function in the region where it is wrong. The ticks() helper returned an empty array for a descending domain and two figures in the fleet had carried no gridlines since the day they were drawn. The logSO3 branch guard fired near zero as well as near π and reported the right magnitude about an invented axis. Now this. In every case the repair was a line, the finding was the region, and what exposed it was a new caller with different habits.

The fix is in lib/spatial.js, beside the function, and it is a series expansion — 1/12+θ2/720+θ4/302401/12 + \theta^2/720 + \theta^4/30240 — used below 10210^{-2}, where the closed form’s error and the series’ truncation are both about 101210^{-12}. The rule about where a fix belongs is not an abstraction on this site; it is the difference between one repaired function and a workaround in one figure with the same bug live everywhere else.

Every joint's lever arm. The thin lines run from the tool to each joint's axis, meeting it square. Their lengths are what a radian of error at each joint costs the tool in metres — not a rule of thumb but the Jacobian column, which is ω × r and therefore that perpendicular exactly. The shortest of them belongs to the joint nearest the work and the longest to the joint furthest from it, which is why an arm's accuracy is decided at the shoulder and its resolution at the wrist.
Fig. 2 What the columns mean, geometrically. Each thin line runs from the tool to a joint axis, meeting it square, and its length is the size of that column’s linear part: ω × r is exactly that perpendicular. So the matrix is not merely computed from the picture, it is readable off it — the joint whose axis is furthest from the tool is the joint whose column is largest, and a joint whose axis passes through the tool has a column with no linear part at all.

Which rows, and about which point

There is a second trap in this matrix and it cost an afternoon.

A twist is a screw, and a screw’s linear part is the velocity of the point of the body currently at the origin — not of the tool. To get the tool’s velocity the angular part has to be crossed with the tool’s position and added on. The Jacobian therefore comes in two forms that differ in three of their six rows, and both are correct about different questions.

The inverse solver mixes them if nobody is careful. Its error term is naturally written as the logarithm of the pose error, which is a screw about the origin; its Jacobian is naturally written with the linear rows referred to the tool, because that is what a position task means. Combine those two and the Newton step is not the linearisation of anything: it converges, slowly, to a pose that is not the one asked for, and the failure looks exactly like a stiff problem.

The repair is to state the error in the same terms as the matrix — an angular part from the logarithm of the relative rotation, and a linear part that is the straight-line displacement of the tool point. It is not more work; it is the same work with the two halves matched. And it is the kind of mistake that only announces itself if something independent checks the answer, which is why the inverse solutions in this field are all run forward again before they are drawn.

Selecting rows is the other half of the same idea. A planar arm controls three quantities, a SCARA four, a six-joint arm six; asking any of the first two for all six rows reports a rank deficiency that is a fact about the question rather than about the mechanism. So the task states its rows and everything downstream — the singular values, the null space, the inverse solve — uses the same selection.

Four numbers, and the sign of each of them. The two Jacobian rows for a coupler point attached at u = 0.55, v = 0.85, against a central difference of the residual they differentiate. The corrected rows agree everywhere. The pre-correction rows differ in exactly 4 places, and in every one of them the difference is a sign. At v = 0 all twelve entries agree, which is why nothing noticed.
Fig. 3 The same matrix in the field that fits linkages to prescribed motions, where its rows are the equations a design has to satisfy. A Jacobian is not a robot idea — it is what any mechanism’s linearisation is called — and this site has been building them since its first phase. What is new here is that an arm’s is a list of lines rather than a table of partial derivatives.

The condition number is not a property of the arm

One more warning belongs here, because the singular values of this matrix are about to be used for several arguments and one thing must not be asked of them.

The Jacobian mixes units. Its top three rows turn joint rates into an angular velocity, in radians per second; its bottom three turn the same rates into a linear velocity, in metres per second. A singular value is therefore a mixture of the two, and the ratio of the largest to the smallest — the condition number, which is the number people quote — depends on the length in which the arm is measured.

Measure it. The arm above, at one posture, has singular values running from 2.407 to 0.367, a condition number of 6.55. Write the identical arm in millimetres instead of metres and the singular values run from 1828 to 0.565, a condition number of 3234. Same arm, same posture, same physics, a factor of five hundred in the number.

What does not change is the rank: 6 in both, and 5 at each of the three singular postures in both. A rank is a count of independent directions and no rescaling of a column or a row can alter it, which is the same argument the practice field made about a seating fixture — where it also had to be checked rather than assumed.

So the rules this field works under are: a rank is quoted; a smallest singular value is quoted with its units and its arm; a condition number is compared only between postures of the same arm in the same units. The essays that follow keep to that, and the one number that crosses between arms is a fitted exponent, which is dimensionless.

The same caution applies to the two forms of the matrix. Writing the twist in the tool’s own frame rather than the base’s — the body Jacobian — gives a matrix related to this one by an adjoint, which is not an orthogonal transformation, so the singular values differ there too. The rank does not.

Two singular sets, and only one belongs to the arm

Now the distinction this essay exists for.

A singularity of the mechanism is a configuration at which the Jacobian loses rank: the tool cannot be moved in some direction, by any combination of joint rates, at that posture. It is a property of the arm and of nothing else, and no change of coordinates removes it.

A singularity of a parameterisation is a place where the numbers chosen to describe an orientation stop being able to describe its rate of change. Three Euler angles are the standard case: the map from angle rates to angular velocity is a matrix whose determinant is sinβ-\sin\beta, so at β=0\beta = 0 it has rank two and one angular velocity has no representation. Nothing has happened to the body.

The two are told apart by measuring both at once. At the joint values

θ=(0.30, 0.04, 1.56, 0, 1.60, 0.20)\theta = (0.30,\ 0.04,\ 1.56,\ 0,\ -1.60,\ 0.20)

the arm’s Jacobian has rank 6 and its smallest singular value is 0.502 — this arm’s condition number there is about as good as it gets. The z-y-z rate matrix at the same posture has rank 2, at a middle angle of 101610^{-16}. A controller working in those angles would report an infinite demand; the arm is standing there perfectly capable of moving in every direction at once.

Finding that posture took a search rather than a guess, and the reason is worth recording. For this arm, with the fourth joint anywhere but zero, the tool’s axis can only line up with the base’s when the fifth joint is at zero — which is the wrist singularity. The two events coincide almost everywhere, and a posture picked casually to show the distinction demonstrates nothing at all. They separate only along the surface where the fourth joint reads zero, and that is where the search found them.

Three singularities, and where each one is. The elbow singularity is at the edge of the workspace, where the arm is straight and cannot reach further — nothing is lost that could have been used. The shoulder singularity is where the two ways of facing the target merge, on a cylinder of radius 0.18 m about the base axis which is also the boundary of a hole the arm cannot reach into at all. The wrist singularity is the one that stops real machines: axes four and six in line, one rotation gone, in the middle of an ordinary working volume with nothing about the tool's position to suggest it. The rank falls by exactly one in all three — and what is lost differs. The elbow and the shoulder are constrained by a pure force, along the arm and across it; the wrist is constrained by a screw of pitch −0.629, which is a force and a couple together. Those are reciprocal screws rather than singular vectors, because a singular vector's direction depends on whether the arm was written in metres or millimetres and a screw does not.
Fig. 4 The mechanism’s own three, for contrast. All three lose exactly one rank; two are inside an ordinary working volume. None of them can be argued away by choosing different numbers to write the tool’s orientation in, which is precisely what separates them from the case above.
planar 3R at a postureplanar 3R, drawn from 3 joint values through a product of 3 exponentials — no equation is solved anywhere in this picture, because an open chain has none to solve. The thin lines are the joint axes at this configuration, which are also the columns of the arm's Jacobian: the tool's velocity is a sum of turns about exactly those lines. Here the smallest singular value of that Jacobian is 0.3779 and the largest is 4.150, so the arm is comfortably away from a configuration where a direction of motion is lost. Drag θ1.θ1θ2θ3toolσ_min 0.3779 · condition 11.0the pose is a product of exponentials, not a solve
Fig. 5 The planar case, where the columns can be checked by eye. Three parallel axes out of the page, and the tool’s velocity is a sum of three turns about them; each column’s linear part is the perpendicular from the tool to that axis, which in a plane is just the distance between two points. Nothing here needs a projection to be believed.

What agreement between two routes is worth

It is worth being precise about what the check at the top of this essay establishes, because “two routes agree” is a phrase this site uses constantly and it does not always mean the same thing.

Both routes here compute the same derivative of the same forward map. If the forward map were wrong — if a joint axis were entered in the wrong direction — both would be wrong together and both would agree beautifully. So the agreement does not establish that the arm is the arm intended. It establishes that the screw construction is a correct derivative of the product of exponentials, which is a statement about the algebra rather than about the machine.

That is still worth having, and this essay is the evidence: the check caught a defect neither route contained, in a shared function, by being the first thing on the site to evaluate it in a particular range. But the other half of the discipline has to come from somewhere else, and in this field it comes from the round trip — an inverse solve’s answer is run forward and compared with what was asked for, which does test the map itself.

The general form is worth stating once. Two computations of one quantity test the arithmetic between them. A computation and a measurement of the same quantity by a different definition test the model. The lever-arm figure above is the second kind: the column’s linear part is computed from screws, and the perpendicular distance from the tool to the axis is a length taken off the geometry, and they agree to 101210^{-12} because ω × r is that perpendicular. Had a joint’s axis been entered wrongly, the two would have parted.

The velocity ellipse. The arm at one posture, with the set of tool velocities its joints can produce for a joint rate of one. It is an ellipse because the map from joint rates to tool velocity is linear, and its axes are the Jacobian's singular values: 3.548 the long way and 0.589 the short way, a ratio of 6.0. The short axis is the direction the arm is worst at, and at a singularity it is the direction the arm cannot move in at all — the ellipse does not shrink, it flattens.
Fig. 6 What the matrix does, drawn at true scale: the set of tool velocities the arm can produce for a joint rate of one. It is an ellipse because the map is linear, its axes are the singular values, and it is the first reading of this matrix that has a picture rather than a number.

The lines are the argument

There is a reason this field draws the axes in every scene rather than only in the singularity essays.

At a wrist singularity the fourth and sixth axes are the same line, and two identical columns are a rank deficiency that can be seen. At an elbow singularity the arm is straight and the two axes that would move the wrist outward have become parallel with nothing between them. At a shoulder singularity the wrist centre sits on the surface the base axis cannot reach past, and the two ways of facing it have merged.

Each of those is a sentence about lines. Written as a determinant, all three are “the matrix went singular”, which is true and says nothing about which direction was lost or why.

The ellipsoid collapsing. The smallest singular value of the Jacobian, along a path that carries elbow arm through a singular configuration. It reaches 8.82e-9 at 50% of the way along — which is not a small number, it is a zero being approached, and the joint rates a controller needs to hold a task-space speed are its reciprocal. Nothing about the tool's position on this path is remarkable at that point; the singularity is a property of the configuration, not of the place.
Fig. 7 And here is what a determinant would have looked like: the smallest singular value along a path that carries the arm through its wrist singularity. It reaches 10⁻¹⁷ — not a small number, a zero being approached — while nothing about the tool’s position on that path is remarkable. The singularity is a fact about the configuration, not about the place.

Where this goes

Three things are now available that were not before, and they are the next three essays’ subjects.

The singular values of this matrix say how fast the tool can be moved in each direction for a bounded joint rate, and their smallest is how close the arm is to losing a direction entirely. The null space says which joint motions do nothing at all, which is empty for a six-joint arm and one-dimensional for a seven-joint one. And the columns say what an error at each joint costs at the tool, which turns out to be a length measurable off the drawing with a ruler.

All three are readings of one matrix, computed one way and checked another.

One nudge, two descriptions. One joint axis of elbow arm is tilted by a millionth of a radian, and each description of the arm is asked how far it moved — as a multiple of the nudge, so a well-behaved description scores about one. The screws score 1.00, because they are the axes. The DH offset scores 9.0e+11 when the tilt is along the line joining the two axes, and zero when it is across — so the ill-conditioning has a direction, and in the bad one a published parameter moves by 899920 for a change nobody could measure. The arm did not move; the foot of the common perpendicular slid along it.
Fig. 8 The other measurement in this field with the same shape, for comparison: how far two descriptions of an arm move when one axis is tilted by a millionth of a radian. The Jacobian check above compares two computations of the same thing and expects them to agree. This one compares two descriptions of the same thing and finds that one of them moves by 9 × 10¹¹ times the nudge. Agreement between routes is evidence; disagreement between descriptions is a property of the descriptions.

It is worth naming what the agreement of the two routes cannot see, because a check is worth exactly its independence. One route builds the Jacobian from the joint screws; the other differences the forward kinematics. Those share the forward map itself — the product of exponentials — and nothing else. So a defect in the forward map is invisible here: both routes would be wrong together, one because it differenced a wrong function and the other because the screws it read are the same screws the product uses. What the comparison does cover is everything downstream of the map, which is where the defect actually was. The lesson is the ordinary one about redundancy and it is worth stating in its exact form: two routes check what they do not share, so the useful question about any pair of routes is what is common to both — and the answer here is one function, which therefore needs a check of a different kind entirely.

What this makes readable

Essays that name this one as a prerequisite.

About the same objects

Not linked from either essay — found by the objects both name.

What links here

The 8 of 14 essays linking to this one that name the most of the same objects.

The objects this essay names

Each one links to every other essay that touches it.

Euler anglesFinite differenceGimbal lockJacobianOpen chainRankScrewSerial manipulatorSingularityTwistVelocity field