# Formation Control and Distributed Goal Assignment for Multi-Agent Non-Holonomic Systems
## 6 Stability of the System with Target Assignment  
The goal exchange procedure significantly improves system convergence and reduces the number of collision avoidance interactions between agents. On the other hand, its execution time was not critical for the control of the system. Stability analysis of the control system with goal switching was conducted using the same Lyapunov-like function (20) as in Section 3. Proposition 2: _The procedure given by Equation (33) results in a decrease of the Lyapunov-like function Equation (20)._  
Proof: A hypothetical position error \(p_{ij}\) can be expressed in a local coordinate frame by the following transformation  
\[e_{ij}=\left[ \begin{array}{cc}\cos(\theta_{j})&\sin(\theta_{j})\\ -\sin(\theta_{j})&\cos(\theta_{j})\end{array} \right]p_{ij}. \tag{36}\]  
that is invariant under scaling, and thus, the following equality holds true:  
\[||e_{ij}||=||p_{ij}|| \tag{37}\]  
(notice that index \(i\) is the number of the goal and index \(j\) is the number of the robot). Using Equation (37) the switching function (32) can be rewritten as follows:  
\[\sigma=\left\{ \begin{array}{ll}1&\quad\text{if}\;\;||e_{mk}||^{2}+||e_{nl} ||^{2}>||e_{nk}||^{2}+||e_{ml}||^{2}\\ 0&\quad\text{otherwise}\end{array} \right.. \tag{38}\]To carry out further analysis the Lyapunov-like function (20) will be rewritten as follows:  
\[V =\overbrace{\sum_{i=1}^{N}\frac{1}{2}e_{i0}^{2}}+\overbrace{\sum_{i=1 }^{N}\sum_{j=1,j\
eq i}^{V_{a}}V_{aij}}^{V_{a}}+\frac{1}{2}(e_{1x}^{2}+e_{1y}^{ 2})+\ldots \tag{39}\] \[+\underbrace{\frac{1}{2}(e_{kx}^{2}+e_{ky}^{2})}_{V_{pk}}+\ldots+ \underbrace{\frac{1}{2}(e_{1x}^{2}+e_{ly}^{2})}_{V_{pl}}+\ldots+\frac{1}{2}(e_ {1x}^{2}+e_{Ny}^{2}).\]  
Terms \(V_{pk}\) and \(V_{pl}\) are related to the position errors of robot \(k\) and \(l\), respectively. Notice that other terms of the Lyapunov-like function \(V\) are invariant under goal assignment as \(V_{a}\) depends only on the distances between agents and \(V_{\theta}\) remains constant because all agents share the same reference orientation \(\theta_{l}\). The position error terms related to robots that were not involved in goal exchange were also invariant under goal exchange. Two cases will be considered further: case 1 at \(t_{s}^{-}\), and case 2 at \(t_{s}\). In case 1 the sum of position terms of robots \(k\) and \(l\) can be transformed using (36) and (31) as follows:  
\[V_{p1}=V_{pk}+V_{pl}=\frac{1}{2}(e_{kx}^{2}+e_{ky}^{2})+\frac{1}{ 2}(e_{1x}^{2}+e_{ly}^{2})\] \[=\frac{1}{2}||[e_{kx}\;e_{ky}]^{T}||^{2}+\frac{1}{2}||[e_{lx}\;e_{ ly}]^{T}||^{2}\] \[=\frac{1}{2}||[p_{kx}\;p_{ly}]^{T}||^{2}+\frac{1}{2}||[p_{lx}\;p_ {ly}]^{T}||^{2}\] \[=\frac{1}{2}(p_{kx}^{2}+p_{ky}^{2})+\frac{1}{2}(p_{lx}^{2}+p_{ly }^{2})\] \[=\frac{1}{2}([x_{bd}-x_{k}\;\;y_{kd}-y_{k}])^{2}+\frac{1}{2}([x_{ld }-x_{l}\;\;y_{ld}-y_{l}])^{2}\] \[=\frac{1}{2}([\bar{x}_{md}-x_{k}\;\;\bar{y}_{md}-y_{k}])^{2}+\frac {1}{2}([\bar{x}_{md}-x_{l}\;\;\bar{y}_{md}-y_{l}])^{2}\] \[=\frac{1}{2}(||p_{mk}||^{2}+||p_{nl}||^{2}).\]  
In case 2 the sum of position terms of robot \(k\) and \(l\), repeating the initial steps above and taking into account (35) is given by:  
\[V_{p2}=V_{pk}+V_{pl}=\] \[+\underbrace{\frac{1}{2}(e_{kx}^{2}+e_{ky}^{2})}_{V_{pk}}+\ldots+ \underbrace{\frac{1}{2}(e_{1x}^{2}+e_{ly}^{2})}_{V_{pl}}+\ldots+\frac{1}{2}(e_ {1x}^{2}+e_{Ny}^{2}).\]0 \[+\underbrace{\frac{1}{2}(e_{kx}^{2}+e_{ky}^{2})}_{V_{pk}}+\ldots+ \underbrace{\frac{1}{2}(e_{1x}^{2}+e_{ly}^{2})}_{V_{pl}}+\ldots+\frac{1}{2}(e_ {1x}^{2}+e_{Ny}^{2}).\]1 \[+\underbrace{\frac{1}{2}(e_{kx}^{2}+e_{ky}^{2})}_{V_{pk}}+\ldots+ \underbrace{\frac{1}{2}(e_{1x}^{2}+e_{ly}^{2})}_{V_{pl}}+\ldots+\frac{1}{2}(e_ {1x}^{2}+e_{Ny}^{2}).\]2  
Note that \(V_{p1}\) (omitting the constant multiplier \(\frac{1}{2}\)) is the left hand side of the inequality in the first condition of the switching function (32) while \(V_{p2}\) is the right hand side of this condition (also omitting the multiplier).