AnyLearn
All lessons
Roboticsintermediate

The Jacobian and Velocity Kinematics

Connect joint velocities to end-effector velocity through the Jacobian matrix. Learn how to build J, spot singularities where det J = 0, invert J with the pseudoinverse for velocity control, and measure manipulability — with NumPy code for the 2-link arm.

Not signed in — your progress and quiz score won't be saved.
Lesson progress1 / 8

From positions to velocities

FK gives a static map qxq \mapsto x. Differentiate with respect to time and you get the velocity kinematics relation:

x˙=J(q)q˙\dot{x} = J(q) \, \dot{q}

Here q˙Rn\dot{q} \in \mathbb{R}^n is the vector of joint velocities, x˙Rm\dot{x} \in \mathbb{R}^m is the end-effector velocity (linear + angular), and J(q)Rm×nJ(q) \in \mathbb{R}^{m \times n} is the Jacobian — a matrix that depends on the current configuration qq. For a 6-DOF arm, m=6m = 6 (three linear, three angular) and JJ is 6×66 \times 6. For the 2-link planar arm computing only position, m=2m = 2, n=2n = 2, and JJ is 2×22 \times 2. The Jacobian is the local, linearized version of FK.

Full lesson text

All 8 steps on one page — for reading, reference, and search.

Show

1. From positions to velocities

FK gives a static map qxq \mapsto x. Differentiate with respect to time and you get the velocity kinematics relation:

x˙=J(q)q˙\dot{x} = J(q) \, \dot{q}

Here q˙Rn\dot{q} \in \mathbb{R}^n is the vector of joint velocities, x˙Rm\dot{x} \in \mathbb{R}^m is the end-effector velocity (linear + angular), and J(q)Rm×nJ(q) \in \mathbb{R}^{m \times n} is the Jacobian — a matrix that depends on the current configuration qq. For a 6-DOF arm, m=6m = 6 (three linear, three angular) and JJ is 6×66 \times 6. For the 2-link planar arm computing only position, m=2m = 2, n=2n = 2, and JJ is 2×22 \times 2. The Jacobian is the local, linearized version of FK.

2. Building the Jacobian by differentiation

For the 2-link planar arm with FK

x=l1c1+l2c12,y=l1s1+l2s12x = l_1 c_1 + l_2 c_{12}, \qquad y = l_1 s_1 + l_2 s_{12}

take partial derivatives:

J(q)=(x,y)(q1,q2)=[l1s1l2s12l2s12l1c1+l2c12l2c12]J(q) = \frac{\partial(x,y)}{\partial(q_1,q_2)} = \begin{bmatrix} -l_1 s_1 - l_2 s_{12} & -l_2 s_{12} \\ l_1 c_1 + l_2 c_{12} & l_2 c_{12} \end{bmatrix}

where c12=cos(q1+q2)c_{12} = \cos(q_1+q_2), s12=sin(q1+q2)s_{12} = \sin(q_1+q_2). Each column jj of JJ is the rate of change of the end-effector position when only joint jj moves, with all other joints fixed. Column 1 depends on both q1q_1 and q2q_2; column 2 depends only on q2q_2.

3. Singularities: when det J = 0

The determinant of JJ measures how much end-effector velocity you get per unit joint velocity:

detJ2-link=l1l2sinq2\det J_{2\text{-link}} = l_1 l_2 \sin q_2

When sinq2=0\sin q_2 = 0 — i.e., q2=0q_2 = 0 or q2=πq_2 = \pi (fully extended or fully folded) — the Jacobian is singular. Physically: in this configuration the arm cannot instantaneously move the end-effector in a certain direction no matter how fast the joints spin. Three consequences:

  1. The inverse J1J^{-1} does not exist — you cannot directly compute joint velocities from Cartesian velocities.
  2. Nearby, J1J^{-1} has large eigenvalues — tiny Cartesian velocity demands enormous joint velocities.
  3. Manipulability w=det(JJ)0w = \sqrt{\det(JJ^\top)} \to 0 — the arm is in a mechanically disadvantaged posture.

4. Pseudoinverse for velocity control

When JJ is square and invertible, joint velocities for a desired Cartesian velocity are:

q˙=J1(q)x˙\dot{q} = J^{-1}(q) \, \dot{x}

When JJ is not square (redundant arm, n>mn > m) or near-singular, use the Moore-Penrose pseudoinverse J+J^+:

J+=J(JJ)1(right pseudoinverse, for n>m)J^+ = J^\top (J J^\top)^{-1} \quad (\text{right pseudoinverse, for } n > m)

The pseudoinverse solution q˙=J+x˙\dot{q} = J^+ \dot{x} gives the minimum-norm joint velocity achieving the desired Cartesian velocity — it distributes the motion across joints as evenly as possible. Near singularities add damped least squares (DLS) regularization:

J+J(JJ+λ2I)1J^+ \approx J^\top (J J^\top + \lambda^2 I)^{-1}

The damping factor λ\lambda limits joint velocity spikes at the cost of a small tracking error.

5. NumPy: Jacobian and velocity control

import numpy as np

def jacobian_2link(q1, q2, l1=1.0, l2=0.8):
    """Analytic 2x2 Jacobian for the 2-link planar arm."""
    s1   = np.sin(q1)
    c1   = np.cos(q1)
    s12  = np.sin(q1 + q2)
    c12  = np.cos(q1 + q2)
    return np.array([
        [-(l1*s1 + l2*s12), -l2*s12],
        [ (l1*c1 + l2*c12),  l2*c12]
    ])

def dls_inverse(J, lam=0.05):
    """Damped least-squares pseudoinverse."""
    return J.T @ np.linalg.inv(J @ J.T + lam**2 * np.eye(J.shape[0]))

# Desired end-effector velocity [vx, vy]
q = np.array([np.pi/4, np.pi/3])
xdot_desired = np.array([0.1, 0.0])  # move at 0.1 m/s in x

J = jacobian_2link(*q)
qdot = dls_inverse(J) @ xdot_desired
print("det(J):", np.linalg.det(J))
print("Joint velocities:", np.degrees(qdot), "deg/s")

Always check np.linalg.det(J) before applying J1J^{-1} directly; switch to DLS when the determinant is below a threshold (e.g., 1e-3).

6. Manipulability

Yoshikawa's manipulability measure quantifies how far the arm is from a singularity:

w(q)=det(J(q)J(q))w(q) = \sqrt{\det\bigl(J(q)\,J(q)^\top\bigr)}

For a square JJ this simplifies to detJ|\det J|. Interpretation:

  • w=0w = 0: singular configuration — one or more directions are unreachable.
  • Large ww: the arm can move freely in all directions; joint effort is well-distributed.

The manipulability ellipsoid {x˙:q˙1}\{\dot{x} : \|\dot{q}\| \le 1\} has semi-axes equal to the singular values of JJ. A round ellipsoid (all singular values equal) is ideal; a very flat ellipsoid signals near-singularity in one direction.

def manipulability(J):
    return np.sqrt(max(np.linalg.det(J @ J.T), 0.0))

Path planners and posture optimizers use w(q)w(q) as a cost function — stay away from singularities to maintain control authority.

7. Velocity kinematics pipeline

How joint velocities become Cartesian velocities and back:

flowchart LR
  Q["Joint config q"]
  JC["Compute Jacobian J(q)"]
  JV["Joint velocity qdot"]
  XV["Cartesian velocity xdot = J qdot"]
  DET["Check det J for singularity"]
  JINV["Invert J or use pseudoinverse J+"]
  QVC["Joint velocity command qdot = J+ xdot"]
  Q --> JC
  JC --> DET
  DET --> JINV
  JV --> XV
  JINV --> QVC

8. Jacobian transpose control and full-DOF arms

For 6-DOF arms the Jacobian becomes 6×66 \times 6 and encodes both linear and angular velocity. The geometric Jacobian columns are built joint by joint:

  • Revolute joint ii: column =[zi1×(pnpi1)zi1]= \begin{bmatrix} z_{i-1} \times (p_n - p_{i-1}) \\ z_{i-1} \end{bmatrix} (linear and angular parts)
  • Prismatic joint ii: column =[zi10]= \begin{bmatrix} z_{i-1} \\ 0 \end{bmatrix}

where zi1z_{i-1} is the zz-axis of frame {i1}\{i-1\} in the world, and pnpi1p_n - p_{i-1} is the vector from joint ii's origin to the end-effector.

A simple alternative to pseudoinverse for force control is the Jacobian transpose: τ=JF\tau = J^\top F, which maps Cartesian forces to joint torques without any matrix inversion — numerically safe even at singularities. These relationships are the bridge from kinematics to dynamics and control.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. The velocity kinematics equation $\dot{x} = J(q)\dot{q}$ relates:
    • Joint positions to end-effector positions.
    • Joint accelerations to Cartesian forces.
    • Joint velocities to end-effector velocity.
    • Joint torques to end-effector acceleration.
  2. For the 2-link planar arm, $\det J = l_1 l_2 \sin q_2$. At which configuration is the arm singular?
    • $q_1 = q_2 = \pi/4$
    • $q_2 = \pi/2$
    • $q_2 = 0$ (fully extended)
    • $q_1 = \pi/2$, any $q_2$
  3. The damped least-squares (DLS) pseudoinverse $J^+ = J^\top(JJ^\top + \lambda^2 I)^{-1}$ adds the $\lambda^2 I$ term to:
    • Increase the speed of convergence near the workspace boundary.
    • Prevent unbounded joint velocities near singularities.
    • Enforce joint-limit constraints exactly.
    • Maximize the manipulability measure.
  4. Yoshikawa's manipulability measure $w = \sqrt{\det(JJ^\top)}$ equals zero when:
    • All joint velocities are equal.
    • The arm is at full extension and the Jacobian loses rank.
    • The end-effector is at the workspace center.
    • The pseudoinverse is used instead of the direct inverse.
  5. For a redundant robot with $n > m$, the minimum-norm joint-velocity solution is:
    • $\dot{q} = J^{-1}\dot{x}$, computed by standard matrix inversion.
    • $\dot{q} = J^\top \dot{x}$, the Jacobian transpose method.
    • $\dot{q} = J^\top(JJ^\top)^{-1}\dot{x}$, the right pseudoinverse.
    • $\dot{q} = (J^\top J)^{-1}J^\top \dot{x}$, the left pseudoinverse.

Related lessons