No description has been provided for this image

Robotics I

L10. Analysis of differential kinematics and singularities of a manipulator

Open virtual laboratory notebook

PhD Eng. Paweł Kwiatoń

Lab Objective¶

During the laboratory students:

  • determine the Jacobi matrix of the manipulator,
  • analyze the relationship between the velocities of the robot's joints and tip,
  • identify singular configurations,
  • analyze the manipulator's manipulability.

Differential kinematics of the manipulator¶

Differential kinematics describes the relationship between:

  • joint velocities,
  • linear and angular velocity of the manipulator tip.

Relation:

$$ \dot{x} = J(q)\dot{q} $$

where:

  • $\dot{x}$ – tip velocity,
  • $\dot{q}$ – joint velocities,
  • $J$ – Jacobi matrix.

Planar 3DOF manipulator¶

Manipulator tip position:

$$ x = l_1 \cos\theta_1 + l_2 \cos(\theta_1+\theta_2) + l_3 \cos(\theta_1+\theta_2+\theta_3) $$

$$ y = l_1 \sin\theta_1 + l_2 \sin(\theta_1+\theta_2) + l_3 \sin(\theta_1+\theta_2+\theta_3) $$

Jacobian:

$$ J = \frac{\partial f(q)}{\partial q} $$

$$ J \in \mathbb{{R}}^{{2 \times 3}} $$

In [ ]:
import numpy as np
import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = (7, 5)
plt.rcParams["axes.grid"] = True
plt.rcParams["font.size"] = 11

l1 = 1.0
l2 = 1.0
l3 = 1.0

def fk_points(q):
    t1, t2, t3 = q
    p0 = np.array([0.0, 0.0])
    p1 = np.array([l1*np.cos(t1), l1*np.sin(t1)])
    p2 = p1 + np.array([l2*np.cos(t1+t2), l2*np.sin(t1+t2)])
    p3 = p2 + np.array([l3*np.cos(t1+t2+t3), l3*np.sin(t1+t2+t3)])
    return np.array([p0, p1, p2, p3])

def jacobian_3dof(q):
    t1, t2, t3 = q
    J = np.array([
        [-l1*np.sin(t1)-l2*np.sin(t1+t2)-l3*np.sin(t1+t2+t3),
         -l2*np.sin(t1+t2)-l3*np.sin(t1+t2+t3),
         -l3*np.sin(t1+t2+t3)],
        [ l1*np.cos(t1)+l2*np.cos(t1+t2)+l3*np.cos(t1+t2+t3),
          l2*np.cos(t1+t2)+l3*np.cos(t1+t2+t3),
          l3*np.cos(t1+t2+t3)]
    ])
    return J
In [ ]:
q = np.array([0.5, 0.3, 0.2])
pts = fk_points(q)

plt.figure(figsize=(6, 6))
plt.plot(pts[:,0], pts[:,1], "o-", linewidth=3, label="Manipulator")
plt.scatter(pts[-1,0], pts[-1,1], c="red", s=80, label="End-effector")
plt.axis("equal")
plt.xlim(-3, 3)
plt.ylim(-3, 3)
plt.title("Planar 3DOF manipulator configuration")
plt.xlabel("x")
plt.ylabel("y")
plt.legend()
plt.show()

J = jacobian_3dof(q)
print("Jacobian matrix:")
print(J)
WARNING:matplotlib.axes._base:Ignoring fixed y limits to fulfill fixed data aspect with adjustable data limits.
No description has been provided for this image
Jacobian matrix:
[[-2.03825261 -1.55882708 -0.84147098]
 [ 2.11459158  1.23700902  0.54030231]]

Speed Mapping¶

Relationship between joint and tip speeds:

$$ v = J(q)\dot{q} $$

In [ ]:
q_dot = np.array([0.5, 0.2, 0.1])
v = J @ q_dot

print("Joint velocity vector q_dot:")
print(q_dot)
print()
print("Tip velocity vector v:")
print(v)

plt.figure(figsize=(6, 4))
plt.bar(["vx", "vy"], v)
plt.title("Manipulator tip velocity from joint velocities")
plt.ylabel("Velocity")
plt.show()
Joint velocity vector q_dot:
[0.5 0.2 0.1]

Tip velocity vector v:
[-1.41503882  1.35872782]
No description has been provided for this image

Singularities¶

A singular configuration occurs when:

$$ \mathrm{{rank}}(J) < 2 $$

or

$$ \det(JJ^T) = 0 $$

For a non-square Jacobian (J \in \mathbb{R}^{2\times 3}), the determinant of (JJ^T) is used to detect loss of rank.

In [ ]:
q_sing = np.array([0.0, 0.0, 0.0])
J_sing = jacobian_3dof(q_sing)

rank_J = np.linalg.matrix_rank(J_sing)
value = np.linalg.det(J_sing @ J_sing.T)

print("Singular configuration q =", q_sing)
print("Jacobian:")
print(J_sing)
print()
print("rank(J) =", rank_J)
print("det(JJ^T) =", value)
Singular configuration q = [0. 0. 0.]
Jacobian:
[[-0. -0. -0.]
 [ 3.  2.  1.]]

rank(J) = 1
det(JJ^T) = 0.0
In [ ]:
t1_vals = np.linspace(-np.pi, np.pi, 150)
det_values = []

for t2 in [0.0, 0.3, 0.8]:
    vals = []
    for t1 in t1_vals:
        q_tmp = np.array([t1, t2, 0.0])
        J_tmp = jacobian_3dof(q_tmp)
        vals.append(np.linalg.det(J_tmp @ J_tmp.T))
    det_values.append((t2, np.array(vals)))

plt.figure(figsize=(8,4))
for t2, vals in det_values:
    plt.plot(t1_vals, vals, label=f"theta2={t2:.1f}")
plt.axhline(0, color="black", linestyle="--")
plt.xlabel("theta1")
plt.ylabel("det(JJ^T)")
plt.title("Singularity indicator for selected configurations")
plt.legend()
plt.show()
No description has been provided for this image

Manipulability¶

Yoshikawa Manipulation Measure:

$$ w = \sqrt{\det(JJ^T)} $$

Interpretation:

  • high value (\rightarrow) good movement ability,
  • low value (\rightarrow) close to singularity.
In [ ]:
q_man = np.array([0.5, 0.4, 0.3])
J_man = jacobian_3dof(q_man)
w = np.sqrt(np.linalg.det(J_man @ J_man.T))

print("Configuration q =", q_man)
print("Manipulability w =", w)
Configuration q = [0.5 0.4 0.3]
Manipulability w = 1.4278805774122945

Manipulability map¶

To visualize the quality of motion in configuration space, we compute a manipulability map for a planar 2DOF manipulator.

This gives a compact visualization of regions with high and low movement ability.

In [ ]:
l1_2 = 1.0
l2_2 = 1.0

points = []
values = []

for t1 in np.linspace(-np.pi, np.pi, 80):
    for t2 in np.linspace(-np.pi, np.pi, 80):
        J2 = np.array([
            [-l1_2*np.sin(t1)-l2_2*np.sin(t1+t2), -l2_2*np.sin(t1+t2)],
            [ l1_2*np.cos(t1)+l2_2*np.cos(t1+t2),  l2_2*np.cos(t1+t2)]
        ])

        w = np.sqrt(abs(np.linalg.det(J2 @ J2.T)))
        points.append([t1, t2])
        values.append(w)

points = np.array(points)
values = np.array(values)

plt.figure(figsize=(7, 6))
plt.scatter(points[:,0], points[:,1], c=values, s=5)
plt.colorbar(label="Manipulability")
plt.xlabel("theta1")
plt.ylabel("theta2")
plt.title("Manipulability map")
plt.show()
No description has been provided for this image

Difficulties of Inverse Kinematics¶

The IK problem is difficult because:

  • it may have multiple solutions,
  • it may have no solution,
  • a singularity may occur.

Laboratory task¶

Based on the prepared programs, analyze the differential kinematics of the manipulator.

  1. Determine the Jacobi matrix for various manipulator configurations.
  2. Modify the joint velocities and analyze the robot tip velocity.
  3. Identify the singular configurations of the manipulator.
  4. Analyze the manipulator's manipulability for various robot configurations.

Suggested student experiment¶

Try the following modifications in the notebook:

  • change the manipulator configuration (q),
  • change the joint velocity vector (\dot{q}),
  • compare regular and near-singular configurations,
  • identify which regions of the manipulability map correspond to poor motion capability.

Report¶

The report should include:

  • determined Jacobi matrix,
  • calculated manipulator tip velocities,
  • identification of singular configurations,
  • analysis of manipulator manipulability,
  • conclusions regarding robot control.

Summary¶

  • The differential kinematics of the manipulator were analyzed,
  • the Jacobi matrix was determined,
  • singular configurations were identified,
  • and the robot's manipulability was analyzed.

Thank you!