# Is there a way to determine which degrees of freedom are lost in a robot at a singularity position by looking at the jacobian?

For a 6DoF robot with all revolute joints the Jacobian is given by: $$\mathbf{J} = \begin{bmatrix} \hat{z_0} \times (\vec{o_6}-\vec{o_0}) & \ldots & \hat{z_5} \times (\vec{o_6}-\vec{o_5})\\ \hat{z_0} & \ldots & \hat{z_5} \end{bmatrix}$$ where $z_i$ is the unit z axis of joint $i+1$(using DH params), $o_i$ is the origin of the coordinate frame connected to joint $i+1$, and $o_6$ is the origin of the end effector. The jacobian matrix is the relationship between the Cartesian velocity vector and the joint velocity vector: $$\dot{\mathbf{X}}= \begin{bmatrix} \dot{x}\\ \dot{y}\\ \dot{z}\\ \dot{r_x}\\ \dot{r_y}\\ \dot{r_z} \end{bmatrix} = \mathbf{J} \begin{bmatrix} \dot{\theta_1}\\ \dot{\theta_2}\\ \dot{\theta_3}\\ \dot{\theta_4}\\ \dot{\theta_5}\\ \dot{\theta_6}\\ \end{bmatrix} = \mathbf{J}\dot{\mathbf{\Theta}}$$

Here is a singularity position of a Staubli TX90XL 6DoF robot:

$$\mathbf{J} = \begin{bmatrix} -50 & -425 & -750 & 0 & -100 & 0\\ 612.92 & 0 & 0 & 0 & 0 & 0\\ 0 & -562.92 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 1 & 1 & 0 & 1 & 0\\ 1 & 0 & 0 & -1 & 0 & -1 \end{bmatrix}$$

You can easily see that the 4th row corresponding to $\dot{r_x}$ is all zeros, which is exactly the lost degree of freedom in this position.

However, other cases are not so straightforward.

$$\mathbf{J} = \begin{bmatrix} -50 & -324.52 & -649.52 & 0 & -86.603 & 0\\ 987.92 & 0 & 0 & 0 & 0 & 0\\ 0 & -937.92 & -375 & 0 & -50 & 0\\ 0 & 0 & 0 & 0.5 & 0 & 0.5\\ 0 & 1 & 1 & 0 & 1 & 0\\ 1 & 0 & 0 & -0.866 & 0 & -0.866 \end{bmatrix}$$

Here you can clearly see that joint 4 and joint 6 are aligned because the 4th and 6th columns are the same. But it's not clear which Cartesian degree of freedom is lost (it should be a rotation about the end effector's x axis in red).

Even less straightforward are singularities at workspace limits.

$$\mathbf{J} = \begin{bmatrix} -50 & 650 & 325 & 0 & 0 & 0\\ 1275.8 & 0 & 0 & 50 & 0 & 0\\ 0 & -1225.8 & -662.92 & 0 & -100 & 0\\ 0 & 0 & 0 & 0.86603 & 0 & 1\\ 0 & 1 & 1 & 0 & 1 & 0\\ 1 & 0 & 0 & 0.5 & 0 & 0 \end{bmatrix}$$

In this case, the robot is able to rotate $\dot{-r_y}$ but not $\dot{+r_y}$. There are no rows full of zeros, or equal columns, or any clear linearly dependent columns/rows.

Is there a way to determine which degrees of freedom are lost by looking at the jacobian?

Not by merely looking at Jacobian but by looking at the Singular Value Decomposition of the Jacobian, one can see the degrees of freedom that are lost, if lost. Of course it technically somehow turns up to finding the null space but yet I guess it is somewhat familiar and easier.

For example let the Jacobian be:

$$J = \begin{bmatrix} -50 & 650 & 325 & 0 & 0 & 0\\ 1275.8 & 0 & 0 & 50 & 0 & 0\\ 0 & -1225.8 & -662.92 & 0 & -100 & 0\\ 0 & 0 & 0 & 0.86603 & 0 & 1\\ 0 & 1 & 1 & 0 & 1 & 0\\ 1 & 0 & 0 & 0.5 & 0 & 0 \end{bmatrix}$$ A Singular Value Decomposition of this is given by $J=U\Sigma V^T$, where

$$U=\left[\begin{matrix}-0.46 & 0.01 & -0.89 & 0.0 & 0.0 & -0.02\\\\0.03 & -1.0 & -0.03 & 0.0 & 0.0 & 0.0\\\\0.89 & 0.05 & -0.46 & 0.0 & 0.0 & -0.01\\\\0.0 & 0.0 & 0.0 & -0.97 & 0.24 & 0.0\\\\0.0 & 0.0 & 0.02 & -0.02 & -0.07 & -1.0\\\\0.0 & 0.0 & 0.0 & -0.24 & -0.97 & 0.07\end{matrix}\right]$$

$$\Sigma=\left[\begin{matrix}1574.54 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 1277.15 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 50.59 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 1.36 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.34 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\end{matrix}\right]$$

$$V^T=\left[\begin{matrix}0.04 & -0.88 & -0.47 & 0.0 & -0.06 & 0.0\\\\-1.0 & -0.04 & -0.02 & -0.04 & 0.0 & 0.0\\\\0.0 & -0.24 & 0.34 & -0.03 & 0.91 & 0.0\\\\0.03 & 0.01 & -0.01 & -0.7 & -0.02 & -0.72\\\\0.03 & 0.01 & -0.01 & -0.71 & -0.02 & 0.7\\\\0.0 & -0.41 & 0.82 & 0.0 & -0.41 & 0.0\end{matrix}\right]$$

Now, it can be seen that the 6th singular value of $\Sigma$ is zero. Therefore, the corresponding (6th) row of $U$ is $$\left[\begin{matrix}0.0 & 0.0 & 0.0 & -0.24 & -0.97 & 0.07\end{matrix}\right]$$, which shows the direction of singularity. It means the end effector at this instant of Jacobian can't move in this direction. In other words, the angular velocity $ω$ of the end-effector about the vector $\hat{n}=-0.24\hat{i}-0.97\hat{j}+0.07\hat{k}$ is not possible at this instant.

The corresponding (6th) column of $V^T$ is $$\left[\begin{matrix}0.0\\\\0.0\\\\0.0\\\\-0.72\\\\0.7\\\\0.0\end{matrix}\right]$$ which is the direction of the above singularity in the joint space, which means the above singularity is caused at the end-effector when $\dot{\theta_1}=0, \dot{\theta_2}=0, \dot{\theta_3}=0, \dot{\theta_4}=-0.72$ units, $\dot{\theta_5}=0.7$ units and $\dot{\theta_6}=0$.

You need to find the null space, not just look for zero rows or full columns. And I don't mean the null space of any particular jacobian, I mean the analytic space of all singular configurations, given the closed-form Jacobian. Usually this occurs because of a gimbal lock (as opposed to just an unreachable state space)

Doing this in closed form is very, very hard. But sometimes you can reduce the space a little.

Please correct me if I am wrong. Let's check if the Jacobian matrix loses it's rank (for example using Matlab or Octave). This should indicate the singularity. Then let's try to check the rank of sub-matrices of the Jacobian, to find which degree of freedom is lost.