**Proof.**

(i) Given a multivector *X*, identity *X*<sup>2</sup> = 3*XX*+40is equivalent to:

$$\|\mathbf{X}\| = \pm \sqrt{\left\langle \mathbf{X} \mathbf{X} \right\rangle\_0}. \tag{62}$$

Thus, it is clear by Lemma 1 that the positive branch of Equation (62) is well defined and that *X* ≥ 0. In particular, if *X* = 0, then:

$$\sqrt{\left\langle X\widetilde{X}\right\rangle\_0} = 0 \Longrightarrow \left\langle X\widetilde{X}\right\rangle\_0 = 0 \Longrightarrow \sum\_{i=0}^n \left\langle \langle X\rangle\_i \Big\langle \widetilde{X}\Big\rangle\_i \right\rangle\_0 = 0,\tag{63}$$

where all the terms of the last equation are positive by Lemma 1 and, thus, all of them are equal to zero. Now, note that each addend is the geometric product of an *i*-vector with its reverse. Therefore, if such product is zero, the corresponding *i*-vector must be zero. Since all the terms are zero, all the *i*-vectors that form *X* are zero, and thus, *X* is zero.

(ii) If *λ* ∈ R and *X* ∈ G*<sup>n</sup>*, then:

$$\begin{aligned} \|\lambda X\| &= \sqrt{\left< (\lambda X)(\lambda \vec{X}) \right>\_0} = \sqrt{\left< \lambda^2 X \vec{X} \right>\_0} \\ &\stackrel{(1)}{=} \sqrt{\lambda^2 \left< X \vec{X} \right>\_0} = |\lambda| \sqrt{\left< X \vec{X} \right>\_0} = |\lambda| \|X\|\_{\prime} \end{aligned} \tag{64}$$

where (1) uses the linearity of the grade-0 projection operator (as stated in Section 2). (iii) Given two different multivectors *X* and *Y*, they can be expanded as linear combinations of the basis elements of G*n*as follows:

$$\begin{aligned} X &= \sum\_{i=0}^{2^n} \alpha\_i \mathbf{c}\_{j\_1} \cdot \cdots \mathbf{c}\_{j\_i}, \\ Y &= \sum\_{i=0}^{2^n} \beta\_i \mathbf{c}\_{j\_1} \cdot \cdots \mathbf{c}\_{j\_i}. \end{aligned} \tag{65}$$

Now, it follows that:

$$X + Y = \sum\_{i=0}^{2^n} (\alpha\_i + \beta\_i) e\_{\hat{\jmath}\_1} \cdots e\_{\hat{\jmath}\_i} \tag{66}$$

and hence:

$$\begin{split} \left|| (X+Y) \right|| &= \sqrt{\left< (X+Y)(X+Y)^{\sim} \right>\_{0}} \stackrel{(1)}{=} \sqrt{\sum\_{i=0}^{2^{n}} (a\_{i}+\beta\_{i})^{2}} \\ &= \sqrt{\frac{\left[\sum\_{i=0}^{2^{n}} a\_{i}^{2}\right]}{A} + \underbrace{\left[\sum\_{i=0}^{2^{n}} \beta\_{i}^{2}\right]}\_{B} + 2\underbrace{\left[\sum\_{i=0}^{2^{n}} a\_{i}\beta\_{i}\right]}\_{C}}\_{C} \end{split} \tag{67}$$

where (1) uses Lemma 1, while *A*, *B* and *C* are just notations given to simplify the different manipulations. Since *A*, *B* > 0 (If either *A*, *B* are equal to zero, then either *X* = 0 or *Y* = 0, which will make the condition *X* + *Y*≤*X* + *Y* trivial):

$$
\sqrt{A+B+C} \stackrel{(1)}{\leq} \sqrt{A} + \sqrt{B} = \sqrt{\sum\_{i=0}^{2^u} a\_i^2} + \sqrt{\sum\_{i=0}^{2^u} \beta\_i^2} = \|X\| + \|Y\|.\tag{68}
$$

where (1) uses the first or second property of Lemma 2 depending on whether *C* < 0 or *C* > 0. It only remains to check if *C* > 0, 2*C* ≤ <sup>2</sup>√*AB*. Indeed, the previous inequality is equivalent to that *C*<sup>2</sup> ≤ *AB*. Now:

$$\begin{aligned} AB &= \sum\_{i=0}^{2^n} \alpha\_i^2 \sum\_{i=0}^{2^n} \beta\_i^2 = \sum\_{i=0}^{2^n} \sum\_{j=0}^{2^n} \alpha\_i^2 \beta\_j^2 = \sum\_{i=0}^{2^n} \alpha\_i^2 \beta\_i^2 + \sum\_{i=0}^{2^n} \sum\_{j=0}^{2^n} \alpha\_i^2 \beta\_j^2, \\ \mathbb{C}^2 &= \left(\sum\_{i=0}^{2^n} \alpha\_i \beta\_i\right)^2 = \sum\_{i=0}^{2^n} \alpha\_i^2 \beta\_i^2 + \sum\_{i=0}^{2^n} \sum\_{j=0}^{2^n} \alpha\_i \beta\_i \alpha\_j \beta\_j \end{aligned} \tag{69}$$

and, thus, *C*<sup>2</sup> ≤ *AB* turns to:

$$\sum\_{i=0}^{2^u} \alpha\_i^2 \beta\_i^2 + \sum\_{i=0}^{2^u} \sum\_{j=0}^{2^u} \alpha\_i \beta\_i \alpha\_j \beta\_j \le \sum\_{i=0}^{2^u} \alpha\_i^2 \beta\_i^2 + \sum\_{i=0}^{2^u} \sum\_{j=0}^{2^u} \alpha\_i^2 \beta\_j^2,\tag{70}$$

which is equivalent to:

$$\sum\_{i=0}^{2^n} \sum\_{j=0}^{2^n} \alpha\_i \beta\_i \alpha\_j \beta\_j \le \sum\_{i=0}^{2^n} \sum\_{j=0}^{2^n} \alpha\_i^2 \beta\_j^2 \tag{71}$$

which, in turn, is equivalent to:

$$\begin{split} 0 &\leq \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} a\_{i}^{2} \beta\_{j}^{2} - \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} a\_{i} \beta\_{i} a\_{j} \beta\_{j} \\ &= \frac{1}{2} \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} a\_{i}^{2} \beta\_{j}^{2} + \frac{1}{2} \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} a\_{i}^{2} \beta\_{j}^{2} - \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} a\_{i} \beta\_{i} a\_{j} \beta\_{j} \\ &= \frac{1}{2} \sum\_{i=0}^{2^{n}} \sum\_{j=0}^{2^{n}} (a\_{i} \beta\_{j} - a\_{j} \beta\_{i})^{2}. \end{split} \tag{72}$$

Since this last inequality is always true, the triangle inequality is also true.

Now, a distance function *D* can be defined for rotors.

**Theorem 7.** *The function D* : R × R → R<sup>+</sup> *defined by the identity <sup>D</sup>*(*<sup>R</sup>*1, *<sup>R</sup>*2) = *<sup>R</sup>*1 − *<sup>R</sup>*2 *is a distance in* R*, i.e.,*

*(i) <sup>D</sup>*(*<sup>R</sup>*1, *<sup>R</sup>*2) ≥ 0 *for all R*1, *R*2 ∈ R*. In particular, <sup>D</sup>*(*<sup>R</sup>*1, *<sup>R</sup>*2) = 0 *if, and only if, R*1 = *R*2*; all*


**Proof.** The proof is straightforward and uses the fact that · is a norm. Given two different rotors *R*1 and *R*2:

(i) *<sup>D</sup>*(*<sup>R</sup>*1, *<sup>R</sup>*2) = *<sup>R</sup>*1 − *<sup>R</sup>*2 ≥ 0. In particular:

$$D(R\_1, R\_2) = 0 \Longleftrightarrow ||R\_1 - R\_2|| = 0 \stackrel{(1)}{\Longleftrightarrow} R\_1 - R\_2 = 0 \Longleftrightarrow R\_1 = R\_2. \tag{73}$$

where (1) uses the first property of a norm.

(ii) We have that:

$$\begin{split} D(R\_1, R\_2) &= \|R\_1 - R\_2\| = \sqrt{\langle (R\_1 - R\_2)(R\_1 - R\_2)^\sim \rangle\_0} \\ &= \sqrt{\langle (R\_2 - R\_1)(R\_2 - R\_1)^\sim \rangle\_0} = \|R\_2 - R\_1\| = D(R\_2, R\_1). \end{split} \tag{74}$$

(iii) Given a third rotor *R*3, we have that:

$$\begin{aligned} \left| D(R\_1, R\_3) = \left\| R\_1 - R\_3 \right\| \right| &= \left\| R\_1 - R\_2 + R\_2 - R\_3 \right\| \\ \stackrel{(1)}{\leq} \left\| R\_1 - R\_2 \right\| + \left\| R\_2 - R\_3 \right\| &= D(R\_1, R\_2) + D(R\_2, R\_3), \end{aligned} \tag{75}$$

where (1) uses the third property of a norm.

As stated before, the end-effector pose of a serial robot and the pose of each one of its joints are described by the configuration-dependent rotors *<sup>R</sup>*(*q*) and *Ri*(*q*), respectively. Thus, one can be tempted to extend the distance function *D* to C as follows:

$$\begin{aligned} D: \mathcal{C} \times \mathcal{C} &\to \mathbb{R}^+ \\ D(q\_1, q\_2) &= ||R(q\_1) - R(q\_2)|| \end{aligned} \tag{76}$$

This function verifies all the requirements of a distance function with the exception of:

$$D(\mathfrak{q}\_1, \mathfrak{q}\_2) = 0 \Longleftrightarrow \mathfrak{q}\_1 = \mathfrak{q}\_2. \tag{77}$$

The reason is simple: a given pose of the end-effector can be associated with up to 16 different configurations if the serial robot is non-redundant and an infinite number if it is redundant. In particular, this means that *<sup>R</sup>*(*q*1) = *<sup>R</sup>*(*q*2) with *q*1 = *q*2. However, this problem can be overcome as follows:

• For each joint *i*, denote by C*i* the configuration space of the subchain formed by the first *i* joints. It is clear that, if the robot has *n* degrees of freedom, C*i* ⊂ C for every 1 ≤ *i* ≤ *n*. Then, the following set of functions can be defined:

$$\begin{aligned} D\_i &: \mathcal{C}\_i \times \mathcal{C}\_i \to \mathbb{R}^+ \\ D\_i(\mathfrak{q}\_1, \mathfrak{q}\_2) &= ||R\_i(\mathfrak{q}\_1) - R\_i(\mathfrak{q}\_2)|| \end{aligned} \tag{78}$$

where, as stated before, *Ri* is the rotor that describes the pose of joint *i*. Again, these functions are not distance functions for the same reason as *D* (Equation (76)) is not a distance function.

• The function:

$$\begin{aligned} D: \mathcal{C} \times \mathcal{C} &\to [0, +\infty) \\ D(q\_{1\prime}, q\_2) &= D\_1(q\_{1\prime}q\_{2\prime}) + \dots + D\_n(q\_{1\_n\prime}q\_{2\_n}) \end{aligned} \tag{79}$$

where *q*1*i* (*q*2*i*) denotes the first *i* coordinates of the configuration vector *q*1 (*q*2), defines a distance function in C.

**Proof.** Since, for each 1 ≤ *i* ≤ *n*, *Di* satisfies the requirements (*ii*) and (*iii*) of a distance function, it is clear that *D* also satisfies them. In addition, *Di*(*q*1*i* , *<sup>q</sup>*2*i*) ≥ 0 for each 1 ≤ *i* ≤ *n* and *q*1*i* , *q*2*i* ∈ C*i*. Therefore, *<sup>D</sup>*(*q*1, *q*2) ≥ 0 for arbitrary *q*1, *q*2 ∈ C. Finally, if *<sup>D</sup>*(*q*1, *q*2) = 0, then, since any term of Equation (79) is a positive scalar, it can be deduced that *Di*(*q***<sup>1</sup>***i* , *<sup>q</sup>*2*i*) = 0 for every 1 ≤ *i* ≤ *n*. Thus, *q*1 and *q*2 not only have the same end-effector pose, but the same pose for of each of its joints, which clearly implies that *q*1 = *q*2.

This distance function can be restricted to S just by considering the joints involved in a given singularity *q<sup>s</sup>*.

**Definition 5.** *Let qs* ∈ S *be a singularity of a serial robot that involves joints i*1, ... , *ir. Then, the function D* : C×S→ R<sup>+</sup> *is defined by the expression:*

$$D(\mathfrak{q}, \mathfrak{q}\_{\mathfrak{s}}) = D\_{i\_1}(\mathfrak{q}\_{i\_1}, \mathfrak{q}\_{\mathfrak{s}\_{i\_1}}) + \dots + D\_{i\_r}(\mathfrak{q}\_{i\_{r'}}, \mathfrak{q}\_{\mathfrak{s}\_{i\_r}}),\tag{80}$$

 *where, for each i*1 ≤ *k* ≤ *ir, Dk is the function defined in (78) and is a distance function in* C*.*

#### **5. Application to the Serial Robot Kuka Lwr 4+**

To show the advantages of the proposed method, an illustrative example is developed in this section, making use of the Kuka LWR 4+, an anthropomorphic robotic arm with seven degrees of freedom and a spherical wrist. It is schematically depicted in Figure 4. Since it has a spherical wrist, its singularities can be decoupled into position and orientation singularities. Hence, Theorem 6 can be applied in order to find out such singularities. The computations with the vectors of G3 have been carried out using the Clifford Multivector Toolbox of MATLAB [45].

**Figure 4.** Schematic representation of the Kuka LWR 4+.

With respect to the position singularities, the following system of *C*(4, 3) = 4 equations should be solved:

$$\begin{cases} \left(\boldsymbol{z}\_{1}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{1}\right)\right)\wedge\left(\boldsymbol{z}\_{2}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{2}\right)\right)\wedge\left(\boldsymbol{z}\_{3}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{3}\right)\right) = 0\\ \left(\boldsymbol{z}\_{1}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{1}\right)\right)\wedge\left(\boldsymbol{z}\_{2}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{2}\right)\right)\wedge\left(\boldsymbol{z}\_{4}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{4}\right)\right) = 0\\ \left(\boldsymbol{z}\_{1}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{1}\right)\right)\wedge\left(\boldsymbol{z}\_{3}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{3}\right)\right)\wedge\left(\boldsymbol{z}\_{4}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{4}\right)\right) = 0\\ \left(\boldsymbol{z}\_{2}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{2}\right)\right)\wedge\left(\boldsymbol{z}\_{3}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{3}\right)\right)\wedge\left(\boldsymbol{z}\_{4}\times\left(\boldsymbol{\sigma}\_{7}-\boldsymbol{\sigma}\_{4}\right)\right) = 0 \end{cases} \tag{81}$$

where, as computed in [46], we have that:

*z*1 × (*<sup>o</sup>*7 − *<sup>o</sup>*1) = ⎡⎣−400c2s1 − 390s4(c1s3 + c3s1s2) − 390c2c4s1 400c1c2 − 390s4(s1s3 − c1c3s2) + 390c1c2c4 0 ⎤⎦, *z*2 × (*<sup>o</sup>*7 − *<sup>o</sup>*2) = ⎡⎣−c1(400s2 + 390c4s2 − 390c2c3s4) −s1(400s2 + 390c4s2 − 390c2c3s4) *A*1 ⎤⎦, *z*3 × (*<sup>o</sup>*7 − *<sup>o</sup>*3) = ⎡⎣ c2s1(390c4s2 − 390c2c3s4) − s2(390s4(c1s3 + c3s1s2) + 390c2c4s1) −s2(390s4(s1s3 − c1c3s2) − 390c1c2c4) − c1c2(390c4s2 − 390c2c3s4) c1c2(390s4(c1s3 + c3s1s2) + 390c2c4s1) + c2s1(390s4(s1s3 − c1c3s2) − 390c1c2c4)⎤⎦, *z*4 × (*<sup>o</sup>*7 − *<sup>o</sup>*4) ⎡⎣(390c4s2 − 390c2c3s4)(c1c3 − s1s2s3) − c2s3(390s4(c1s3 + c3s1s2) + 390c2c4s1) ⎤⎦,(82)

c2s3(390s4(s1s3

 − c1c3s2) − 390c1c2c4)

where

= (390c4s2 − 390c2c3s4)(c3s1

 + c1s2s3) −

$$\begin{split} A\_{1} &= \mathbf{c}\_{1}(400\mathbf{c}\_{1}\mathbf{c}\_{2} - 390\mathbf{s}\_{4}(\mathbf{s}\_{1}\mathbf{s}\_{3} - \mathbf{c}\_{1}\mathbf{c}\_{3}\mathbf{s}\_{2}) + 390\mathbf{c}\_{1}\mathbf{c}\_{2}\mathbf{c}\_{4}) + \mathbf{s}\_{1}(400\mathbf{c}\_{2}\mathbf{s}\_{1} \\ &+ 390\mathbf{s}\_{4}(\mathbf{c}\_{1}\mathbf{s}\_{3} + \mathbf{c}\_{3}\mathbf{s}\_{1}\mathbf{s}\_{2}) + 390\mathbf{c}\_{2}\mathbf{c}\_{4}\mathbf{s}\_{1}), \\ A\_{2} &= (\mathbf{c}\_{1}\mathbf{c}\_{3} - \mathbf{s}\_{1}\mathbf{s}\_{2}\mathbf{s}\_{3})(390\mathbf{s}\_{4}(\mathbf{s}\_{1}\mathbf{s}\_{3} - \mathbf{c}\_{1}\mathbf{c}\_{3}\mathbf{s}\_{2}) - 390\mathbf{c}\_{1}\mathbf{c}\_{2}\mathbf{c}\_{4}) - (390\mathbf{s}\_{4}(\mathbf{c}\_{1}\mathbf{s}\_{3} + \mathbf{c}\_{3}\mathbf{s}\_{1}\mathbf{s}\_{2})) \\ &+ 390\mathbf{c}\_{2}\mathbf{c}\_{4}\mathbf{s}\_{1})(\mathbf{c}\_{3}\mathbf{s}\_{1} + \mathbf{c}\_{1}\mathbf{s}\_{2}\mathbf{s}\_{3}), \end{split}$$

*A*2

and where c*i* = cos(*<sup>θ</sup>i*) and s*i* = sin(*<sup>θ</sup>i*). However, in order to simplify these expressions, the system of Equation (81) is expressed with respect to the frame attached to the fourth joint of the Kuka LWR 4+. To do so, a relation analogous of relation (9) is applied. Here, instead of pre-multiplying by the corresponding rotation matrix, the system of Equation (81) is multiplied by the three-dimensional rotor *R* that performs the rotation between the frame attached to the end-effector and the frame attached to the fourth joint. For instance, the first equation of the system (81) becomes:

$$R\left(\mathbf{z}\_{1}\times(\mathbf{o}\_{7}-\mathbf{o}\_{1})\right)\wedge\left(\mathbf{z}\_{2}\times(\mathbf{o}\_{7}-\mathbf{o}\_{2})\right)\wedge\left(\mathbf{z}\_{3}\times(\mathbf{o}\_{7}-\mathbf{o}\_{3})\right)\ddot{R}=\mathbf{0},\tag{83}$$

which, using the geometric covariance property for rotors introduced in Section 2, becomes:

$$R(\boldsymbol{\varpi}\_1 \times (\boldsymbol{\sigma}\boldsymbol{\gamma} - \boldsymbol{\sigma}\_1)) \check{\boldsymbol{R}} \wedge \boldsymbol{R} (\boldsymbol{\varpi}\_2 \times (\boldsymbol{\sigma}\boldsymbol{\gamma} - \boldsymbol{\sigma}\boldsymbol{\varrho})) \check{\boldsymbol{R}} \wedge \boldsymbol{R} (\boldsymbol{\varpi}\_3 \times (\boldsymbol{\sigma}\boldsymbol{\gamma} - \boldsymbol{\sigma}\boldsymbol{\varsigma})) \check{\boldsymbol{R}} = \boldsymbol{0}.\tag{84}$$

Therefore, the system of Equation (81) becomes:

$$\begin{cases} a\_1 \wedge a\_2 \wedge a\_3 = 0 \\ a\_1 \wedge a\_2 \wedge a\_4 = 0 \\ a\_1 \wedge a\_3 \wedge a\_4 = 0 \\ a\_2 \wedge a\_3 \wedge a\_4 = 0 \end{cases} \tag{85}$$

where

$$\begin{aligned} a\_1 &= (-10\mathbf{c}\_2\mathbf{s}\_3(40\mathbf{c}\_4 + 39))c\_1 + (400\mathbf{c}\_2\mathbf{s}\_3\mathbf{s}\_4)c\_2 + (400\mathbf{c}\_2\mathbf{c}\_3 + 390\mathbf{s}\_2\mathbf{s}\_4 + 390\mathbf{c}\_2\mathbf{c}\_3\mathbf{c}\_4)c\_3, \\ a\_2 &= (10\mathbf{c}\_3(40\mathbf{c}\_4 + 39))c\_1 + (-400\mathbf{c}\_3\mathbf{s}\_4)c\_2 + (10\mathbf{s}\_3(40\mathbf{c}\_4 + 39))c\_3, \\ a\_3 &= (390\mathbf{s}\_4)c\_3, \\ a\_4 &= (-390)c\_1. \end{aligned} \tag{86}$$

Now, the system of Equation (85) becomes:

$$\begin{aligned} 0 &= 0\\ 40 \text{c}\_2 \text{s}\_4 + 39 \text{s}\_2 \text{c}\_3 \text{s}\_4^2 + 39 \text{c}\_2 \text{c}\_4 \text{s}\_4 &= 0\\ \text{c}\_2 \text{s}\_3 \text{s}\_4^2 &= 0\\ \text{c}\_3 \text{s}\_4^2 &= 0 \end{aligned} \tag{87}$$

which clearly has two different solutions:


These two solutions correspond to the position singularities of the Kuka LWR 4+. With respect to the orientation singularities, there is only one equation to solve:

$$
\mathfrak{z}\_{\mathfrak{F}} \wedge \mathfrak{z}\_{\mathfrak{G}} \wedge \mathfrak{z}\_{\mathfrak{T}} = 0. \tag{88}
$$

Again, the expression of each *zi* for *i* = 5, 6, 7 can be simplified by expressing those vectors with respect to the frame attached to the fourth joint. Thus, Equation (88) becomes:

$$\begin{aligned} \mathbf{e}\_2 &\wedge \left(-\mathbf{s}\mathbf{e}\_1 - \mathbf{c}\_5\mathbf{e}\_3\right) \wedge \left(\mathbf{c}\_5\mathbf{s}\_6\mathbf{e}\_1 + \mathbf{c}\_6\mathbf{e}\_2 - \mathbf{s}\mathbf{s}\mathbf{s}\_6\mathbf{e}\_3\right) \\ \mathbf{e}\_3 &= \left(-\mathbf{s}\mathbf{e}\_2 \wedge \mathbf{e}\_1 - \mathbf{c}\_5\mathbf{e}\_2 \wedge \mathbf{e}\_3\right) \wedge \left(\mathbf{c}\_5\mathbf{s}\_6\mathbf{e}\_1 + \mathbf{c}\_6\mathbf{e}\_2 - \mathbf{s}\mathbf{s}\mathbf{s}\_6\mathbf{e}\_3\right) \\ \mathbf{\underline{n}} &\stackrel{(1)}{=} -\mathbf{s}\_5^2\mathbf{s}\_6\mathbf{e}\_1 \wedge \mathbf{e}\_2 \wedge \mathbf{e}\_3 - \mathbf{c}\_5^2\mathbf{s}\_6\mathbf{e}\_1 \wedge \mathbf{e}\_2 \wedge \mathbf{e}\_3 = -\mathbf{s}\_6\mathbf{e}\_1 \wedge \mathbf{e}\_2 \wedge \mathbf{e}\_3 = 0, \end{aligned} \tag{89}$$

where (1) uses the anticommutativity of the outer product. Clearly, the last expression of Equation (89) is zero if, and only if, s6 = 0 or, equivalently, if, and only if, *q*6 = 0. Thus, the Kuka LWR 4+ only has one orientation singularity (the wrist singularity, as explained in Remark 7).

Finally, the distance function defined in Definition 5 can be applied to any of the already obtained singular configurations. Let us consider, for instance, the position singularity *q*4 = 0. Then, the distance between an arbitrary configuration *q* ∈ C and this singularity is given by the expression:

$$D(\mathfrak{q}, \mathfrak{q}\_{\mathfrak{s}}) = ||\mathbb{R}\_4(\mathfrak{q}) - \mathbb{R}\_4(\mathfrak{q}\_{\mathfrak{s}})||,\tag{90}$$

where *qs* denotes the singular configuration *q*4 = 0 and *R*4 is the rotor defining the pose of the fourth joint of the Kuka LWR 4+.

In particular, *R*4 can be found as explained in Section 2. Indeed, if {*<sup>e</sup>*1,*e*2,*e*3} denotes the orthogonal basis defined by the world frame and { *f*1, *f*2, *f*3} (respectively, { *f* -1, *f* -2, *f* -3}), the orthogonal basis defined by the frame attached to the fourth joint under the effect of configuration *q* (respectively, singular configuration *qs*), then:

$$\begin{aligned} R\_4(q) &= \frac{1 + \epsilon^1 f\_1 + \epsilon^2 f\_2 + \epsilon^3 f\_3}{||1 + \epsilon^1 f\_1 + \epsilon^2 f\_2 + \epsilon^3 f\_3||}, \\\\ R\_4(q\_s) &= \frac{1 + \epsilon^1 f\_1' + \epsilon^2 f\_2' + \epsilon^3 f\_3'}{||1 + \epsilon^1 f\_1' + \epsilon^2 f\_2' + \epsilon^3 f\_3'||}. \end{aligned} \tag{91}$$

where {*e*1,*e*2,*e*<sup>3</sup>} is the reciprocal frame of {*<sup>e</sup>*1,*e*2,*e*3}. Since {*<sup>e</sup>*1,*e*2,*e*3} is also an orthonormal set of vectors, such a reciprocal frame is:

$$\begin{aligned} x^1 &= \mathfrak{e}\_{1\prime} \\ x^2 &= \mathfrak{e}\_{2\prime} \\ x^3 &= \mathfrak{e}\_3. \end{aligned} \tag{92}$$

Thus, Equation (91) turns to:

$$\begin{aligned} R\_4(q) &= \frac{1 + \varepsilon\_1 f\_1 + \varepsilon\_2 f\_2 + \varepsilon\_3 f\_3}{||1 + \varepsilon\_1 f\_1 + \varepsilon\_2 f\_2 + \varepsilon\_3 f\_3||}, \\\\ R\_4(q\_s) &= \frac{1 + \varepsilon\_1 f\_1' + \varepsilon\_2 f\_2' + \varepsilon\_3 f\_3'}{||1 + \varepsilon\_1 f\_1' + \varepsilon\_2 f\_2' + \varepsilon\_3 f\_3'||}. \end{aligned} \tag{93}$$

Evaluating Equation (93) for the KUKA LWR 4+, we obtain:

$$R\_4(q) = \frac{a\_1 + a\_2e\_1 \wedge e\_2 + a\_3e\_1 \wedge e\_3 + a\_4e\_2 \wedge e\_3}{\sqrt{a\_1^2 + a\_2^2 + a\_3^2 + a\_4^2}},\tag{94}$$

$$R\_4(q\_s) = \frac{b\_1 + b\_2 c\_1 \wedge c\_2 + b\_3 c\_1 \wedge c\_3 + b\_4 c\_2 \wedge c\_3}{\sqrt{b\_1^2 + b\_2^2 + b\_3^2 + b\_4^2}},$$

where {*<sup>e</sup>*1 ∧ *e*2,*e*1 ∧ *e*3,*e*2 ∧ *<sup>e</sup>*3} are the basic bivectors of G3 and

$$\begin{aligned} a\_1 &= \mathbf{c\_2s\_3} + \mathbf{c\_4s\_1s\_3} - \mathbf{c\_4c\_3c\_1s\_2} + \mathbf{s\_3s\_4c\_1} + \mathbf{s\_4s\_1s\_2c\_3} + \mathbf{s\_4c\_1c\_2} + \mathbf{c\_2c\_4s\_1} \\ a\_2 &= \mathbf{c\_2s\_1s\_4} - \mathbf{c\_4c\_1s\_3} - \mathbf{c\_4c\_3s\_1s\_2} - \mathbf{c\_1c\_2c\_4} + \mathbf{s\_4s\_1s\_3} - \mathbf{s\_4s\_2c\_1c\_3} \\ a\_3 &= \mathbf{s\_2s\_4} + \mathbf{c\_2c\_3c\_4} + \mathbf{c\_3s\_1} + \mathbf{c\_1s\_2s\_3} \\ a\_4 &= \mathbf{c\_4s\_2 - \mathbf{c\_2c\_3s\_4} - \mathbf{c\_1c\_3} + \mathbf{s\_1s\_2s\_3} \\ b\_1 &= \mathbf{c\_2s\_3 + s\_1s\_3 - \mathbf{c\_3c\_1s\_2} + \mathbf{c\_2s\_1} \\ b\_2 &= -\mathbf{c\_1s\_3 - \mathbf{c\_3s\_1s\_2} - \mathbf{c\_1c\_2}} \\ b\_3 &= \mathbf{c\_2c\_3 + \mathbf{c\_3s\_1} + \mathbf{c\_1s\_2s\_3} \\ b\_4 &= \mathbf{s\_2 - \mathbf{c\_1c\_3} + \mathbf{s\_1s\_2s\_3} .\end{aligned} \tag{95}$$

Therefore, by Proposition 4 and the decomposition used in the Proof of Lemma 1, the distance of an arbitrary configuration *q* to the position singularity *q*4 = 0 is given by:

$$D(\mathfrak{q}, \mathfrak{q}\_s) = \sqrt{(a\_1' - b\_1')^2 + (a\_2' - b\_2')^2 + (a\_3' - b\_3')^2 + (a\_4' - b\_4')^2},\tag{96}$$

where

$$a'\_i = \frac{a\_i}{\sqrt{a\_1^2 + a\_2^2 + a\_3^2 + a\_4^2}} \text{ and } b'\_i = \frac{b\_i}{\sqrt{b\_1^2 + b\_2^2 + b\_3^2 + b\_4^2}}.\tag{97}$$

#### **6. Handling of Singularities**

Once the set of singular configurations S has been identify, several methods can be applied to handle the singularities. The detailed treatment of this topic is beyond the scope of this work. However, in order to show the possibilities of the distance function proposed in Section 4, we comment on three different situations, namely, motion planning, motion control and bilateral teleoperation. In each one of these situations, the distance function defined in Definition 5 plays an important role for handling the singularities.

#### *6.1. Singularity Handling in Motion Planning*

Motion planning consists of programming collision-free motions for a given robotic manipulator from a start position to a goal position among a collection of static obstacles. The subset of robot configurations that do not cause collision with such obstacles is termed the free-of-obstacles configuration space, and it is denoted by Cfree. The main methods used for motion planning can be grouped into three categories:


For any method of these three categories, the distance function *D* defined in Definition 5 can be applied to construct solution trajectories that also avoid the singularities. Indeed:

• For a potential field method, it is sufficient to add a repulsive component that pushes the trajectory, not only away from obstacles, but also away from singularities. To do so, the most efficient method is to define, for each singularity *q<sup>s</sup>*, a quadratic repulsive component as follows:

$$\mathcal{U}\_{r,q\_s}(\boldsymbol{q}) = \begin{cases} \frac{\kappa}{2} \left( \frac{1}{D(\boldsymbol{q}, \boldsymbol{q}\_s)} - \frac{1}{D\_0} \right)^2 & \text{if } D(\boldsymbol{q}, \boldsymbol{q}\_s) \le D\_0 \\\ 0 & \text{if } D(\boldsymbol{q}, \boldsymbol{q}\_s) > D\_0 \end{cases} \tag{98}$$

where *D*0 is set as a threshold for the distance *D* and *κ* ∈ R.

	- (1) Select a value *D*0 > 0 that will work as a threshold.
	- (2) Given a discretization of the configuration space C, each *q* of this discretization is evaluated to check whether:
		- \* It is free-of-obstacles;
		- \* It is far from any singularity. This can be achieved simply by evaluating whether *<sup>D</sup>*(*q*, *qs*) > *D*0 or *<sup>D</sup>*(*q*, *qs*) ≤ *D*0;
	- (3) If *q* is free-of-obstacles and far from any singularity, then it can be added to the set of nodes of the roadmap.

#### *6.2. Singularity Handling in Motion Control*

Motion control consists of making the end-effector of a robot follow a time-varying trajectory specified within the manipulator workspace. A typical Inverse Dynamics Control scheme (depicted as a block diagram in Figure 5) can be described as:


$$
\pi = M(q)\ddot{q} + \mathbb{C}(q, \dot{q})\dot{q} + \mathbb{g}(q) \tag{99}
$$

where *<sup>M</sup>*(*q*) denotes the inertia matrix of the robot, *<sup>C</sup>*(*q*, *q*˙) denotes the matrix of Coriolis and centrifugal forces and *g*(*q*) denotes the gravity vector.


**Figure 5.** Standard motion control scheme.

To handle the singularities, a restriction can be defined inside the controller:

	- **–** Select a threshold value *D*0 > 0.
	- **–** Evaluate the condition *<sup>D</sup>*(*qd*, *qs*) > *D*0 for each singularity *q<sup>s</sup>*.
	- **–**If the evaluation returns yes, then *τ* can be computed from *qd* using the dynamical model (Equation (99)) and sent to the robot. Otherwise, *qd* is substituted by *qd* + *D*0*qd* and evaluated again.

A block diagram of this scheme is depicted in Figure 6.

**Figure 6.** Proposed control scheme in presence of singularities.

#### *6.3. Singularity Handling in Bilateral Teleoperation*

Teleoperated robotic systems are characterized by a robot that executes the movements/actions commanded by a human operator. Any high-level or planning decision is made by a human user, while the robot is responsible for their mechanical implementation [47]. Teleoperation systems are often, at least conceptually, split into two parts: a local manipulator and a remote manipulator. The first one refers to the device moved by the human operator, while the second refers to the robot or robot system that performs the action.

According to the information flow direction, the teleoperation may be unilateral or bilateral. In unilateral teleoperation, the local manipulator sends position or force data to the remote manipulator and only receives, as feedback, visual information from the remote scene. However, in bilateral teleoperation, the position or force data are also sent from the remote manipulator in addition to the visual information.

In a bilateral teleoperation system, some strategies for handling of kinematic singularities can make use of the distance function *D* defined in Definition 5. For instance, the following scheme could be applied:


## **7. Conclusions**

This paper proposes a novel singularity identification method for arbitrary serial robots based on the six-dimensional geometric algebra G6. For non-redundant serial robots, we take the six unit twists *ξ*1, ... , *ξ*6 associated with the joints, and we model them as vectors of G6. Hence, the problem reduces to find the configurations causing the exterior product *ξ*1(*q*) ∧···∧ *ξ*6(*q*) to vanish since, as proven in Corollary 1, *ξ*1(*q*) ∧···∧ *ξ*6(*q*) = 0 if, and only if, *q* ∈ S. Analogously, for a redundant robot with *n* DoF, we consider the *<sup>C</sup>*(*<sup>n</sup>*, 6) different combinations of six unit twists taken from {*ξ*1, ... , *ξn*}, and we find the configurations causing all the exterior products of the form *ξj*1 (*q*) ∧···∧ *ξj*6 (*q*) for 1 ≤ *j* ≤ *<sup>C</sup>*(*<sup>n</sup>*, 6) to vanish.

For serial robots with a spherical wrist, a simplification is possible. For these manipulators, the singularities are of two types: position singularities and orientation singularities. The former are identified as the configurations causing the exterior products *<sup>s</sup>i*1 (*q*) ∧ *<sup>s</sup>i*2 (*q*) ∧ *<sup>s</sup>i*3 (*q*) to vanish for 1 ≤ *i* ≤ *<sup>C</sup>*(*n* − 3, <sup>3</sup>), where *sij* is the linear velocity component of the unit twist *ξij* and is modelled as a vector of G3, while the latter are identified as the configuration causing the exterior product *<sup>z</sup>n*−<sup>2</sup>(*q*) ∧ *<sup>z</sup>n*−<sup>1</sup>(*q*) ∧ *<sup>z</sup>n*(*q*) to vanish, where *zi* is the *i*-th joint axis and, again, is modelled as a vector of G3. Thus, the simplification consists of evaluating the exterior product of three vectors in G3 instead of six vectors in G6.

Once the singularities are identified, a distance function is defined such as its restriction to the singular set S, defined in Definition 5, is also a distance function that allows us to check how far an arbitrary configuration *q* is to a singularity. This distance function exploits the fact that between any two vectors *x*, *y* ∈ G*<sup>n</sup>*, there always exists a rotor *R* such that *y* = *RxR* + .

The advantages of the strategy introduced in this work are clear. First, it is a computerfriendly approach that avoids the computation of the determinant of an order 6 × *n* (for non-redundant robots) or *n* × *n* (for redundant robots) matrix and the Jacobian matrix *J*. In addition, the novel distance function defined in Definition 5 can be used to improve the performance of current control schemes or motion planning algorithms, which, as seen in the introduction, is still a hot research topic in robotics.

**Author Contributions:** Conceptualization, I.Z. and J.L.; methodology, I.Z.; investigation, I.Z. and H.H.; writing—original draft preparation, I.Z. and H.H.; writing—review and editing, I.Z., H.H. and J.L.; supervision, J.L. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding. **Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.
