# Differentially-Driven Robots Moving in Formation--Leader-Follower Approach
## 4 Control Algorithm
\begin{array}{c} \frac{\partial V_{aij}}{\partial x_{i}}\\ \frac{\partial V_{aij}}{\partial y_{i}}\end{array} \right]. \tag{11}\]Equation (10) can be rewritten using (9) and (11) as follows:  
\[E_{ix} =p_{ix}\cos(\theta_{i})+p_{iy}\sin(\theta_{i})+\sum_{j=1,j\
eq i}^{N }\frac{\partial V_{aij}}{\partial\epsilon_{ix}}\] \[E_{iy} =-p_{ix}\sin(\theta_{i})+p_{iy}\cos(\theta_{i})+\sum_{j=1,j\
eq i }^{N}\frac{\partial V_{aij}}{\partial\epsilon_{iy}}\] \[e_{i\theta} =p_{i\theta}, \tag{12}\]  
where each spatial derivative of the APF is transformed from the global to the local coordinate frame fixed to the robot. Correction variables expressed with respect to the local coordinate frame can be written in the following form:  
\[E_{ix} =e_{ix}+\sum_{j=1,j\
eq i}^{N}\frac{\partial V_{aij}}{\partial \epsilon_{ix}}\] \[E_{iy} =e_{iy}+\sum_{j=1,j\
eq i}^{N}\frac{\partial V_{aij}}{\partial \epsilon_{iy}}. \tag{13}\]  
Trajectory tracking algorithm given in [21] extended with collision avoidance based on APF for \(N\) mobile platforms is given by equations:  
\[ \begin{array}{c}v_{i}=v_{i-1}\cos(e_{i\theta})+k_{1}E_{ix}\\ \omega_{i}=\omega_{i-1}+k_{2}\operatorname{sgn}(v_{i-1})E_{iy}+k_{3}e_{i \theta},\end{array}  \tag{14}\]  
where \(k_{1}\), \(k_{2}\), \(k_{3}\) are constant parameters fulfilling conditions \(k_{1}>0\), \(k_{2}>0\), \(k_{3}>0\) and function \(\operatorname{sgn}(\bullet)\) is as follows:  
\[\operatorname{sgn}(\xi)=\left\{ \begin{array}{c}-1\quad\text{for}\quad\xi<0 \\ 0\quad\text{for}\quad\xi=0\\ 1\quad\text{for}\quad\xi>0\end{array} \right.. \tag{15}\]  
Regardless of the definition of (15) function for \(v_{i-1}\) replaced by zero in the controller of the \(i\)-th robot, it is proposed to keep second term in Equation (14) as \(k_{2}E_{iy}\) in order to avoid possible deadlock. **Assumption 4**. : _If the value of the linear velocity control is less then considered threshold \(v_{t}\), i.e., \(|v_{i}|<v_{t}\) (\(v_{t}\)--positive constant design parameter), it is replaced by a scalar function \(\tilde{v}_{i}=S(v_{i})v_{t}\), where_  
\[S(v_{i})=\left\{ \begin{array}{c}-1\quad\text{for}\quad v_{i}<0\\ 1\quad\text{for}\quad v_{i}\geq 0\end{array} \right.. \tag{16}\]  
Substituting Equation (14) into (8) system error dynamics in the following form is obtained:  
\[ \begin{array}{c}\dot{e}_{ix}=e_{iy}\omega_{i}-k_{1}E_{ix}\\ \dot{e}_{iy}=-e_{ix}\omega_{i}+v_{i-1}\sin(e_{i\theta})\\ \dot{e}_{i\theta}=-k_{2}\operatorname{sgn}(v_{i-1})E_{iy}-k_{3}e_{i\theta}\end{array}  \tag{17}\]  
Above equations can be transformed using (14) and taking into account Assumption 2 (in the collision avoidance region, linear velocity \(v_{i-1}\) and angular velocities \(\omega_{i-1}\) in the \(i\)-th robot's controller are replaced by zero) error dynamics can be rewritten as follows:  
\[ \begin{array}{c}\dot{e}_{ix}=k_{3}e_{iy}e_{i\theta}+k_{2}e_{iy}E_{iy}-k_{1}E _{ix}\\ \dot{e}_{iy}=-k_{3}e_{ix}e_{i\theta}-k_{2}e_{ix}E_{iy}\\ \dot{e}_{i\theta}=-k_{2}E_{iy}-k_{3}e_{i\theta}\end{array}  \tag{18}\]The paper [20] presents the same robot control algorithm applied to a formation with a different topology. The stability proof presented there remains valid with the proviso that the error components \([p_{ix}\;\;p_{iy}\;\;p_{i\theta}]^{T}\) are defined as in this paper. This indirectly affects \(e_{ix}\), \(e_{iy}\), \(e_{i\theta}\) that are used to compose a Lyapunov-like function. In the stability analysis, the error dynamics (18) was used to derive the system stability condition. The rule described in Assumption 4 pushes robot out of a state where the stability condition obtained in reference [20] would not be satisfied. This situation occurs when, during collision avoidance, \(E_{ix}=0\) which results from the specific combination of \(e_{ix}\) and the sum of the partial derivatives of the APF with respect to the variable \(e_{ix}\), according to the first Equation in (13). The state in which this situation occurs is non-attracting.