## 3 Formation Controller Design
### Tracking Controller  
The tracking controller is designed based on reference velocities \(\left[ \begin{array}{cc}v_{ri}&\omega_{ri}\end{array} \right]^{T}\) and trajectories \(\left[ \begin{array}{cc}x_{ri}&y_{ri}\end{array} \right]^{T}\). Define the tracking errors regarding the robot's coordination (show in Figure 5) as  
\[\left( \begin{array}{c}\epsilon_{xi}\\ \epsilon_{yi}\\ \epsilon_{\theta i}\end{array} \right)=\left( \begin{array}{ccc}\cos\theta_ {i}&\sin\theta_{i}&0\\ -\sin\theta_{i}&\cos\theta_{i}&0\\ 0&0&1\end{array} \right)\left( \begin{array}{c}x_{ri}-x_{i}\\ y_{ri}-y_{i}\\ \theta_{ri}-\theta_{i}\end{array} \right) \tag{21}\]  
Then, the error dynamics can be obtained as follows:  
\[ \begin{split}&\dot{e}_{xi}=\omega_{i}\epsilon_{yi}-v_{i}+\cos \epsilon_{\theta i}v_{ri},\\ &\dot{e}_{yi}=-\omega_{i}\epsilon_{xi}+\sin\epsilon_{\theta i}v_{ri},\\ &\dot{e}_{\theta i}=\omega_{ri}-\omega_{i},\end{split}  \tag{22}\]  
The tracking controller \(\left[ \begin{array}{cc}v_{i}&\omega_{i}\end{array} \right]^{T}\) should be designed to have a good tracking performance for reference trajectories. Thus, the tracking controller can be designed as  
\[ \begin{split} v_{i}=& v_{ri}+c_{1i}\epsilon_{xi},\\ \omega_{i}=&\omega_{ri}+4v_{ri}\left(\epsilon_{yi}\cos\frac{ \epsilon_{\theta i}}{2}-\epsilon_{xi}\sin\frac{\epsilon_{\theta i}}{2}\right) \\ &+4c_{2i}\sin\frac{\epsilon_{\theta i}}{2},\end{split}  \tag{23}\]where \(c_{1i}\) and \(c_{2i}\) are positive constants. For the good tracking performance of the trajectory generator, one theorem can be obtained as follows. **Theorem 1**. : _With the reference trajectories \([ \begin{array}{cc}x_{ri}&y_{ri}\end{array} ]^{T}\) and velocities \([ \begin{array}{cc}\
u_{ri}&\omega_{ri}\end{array} ]^{T}\), by applying the tracking controller (23), the closed-loop system is asymptotically stable with the achievement of the following equations:_  
\[ \begin{split}&\lim_{t\to\infty}x_{ri}-x_{i}\to 0\\ &\lim_{t\to\infty}y_{ri}-y_{i}\to 0\\ &\lim_{t\to\infty}\theta_{ri}-\theta_{i}\to 2K\pi,K\in\mathbb{Z} \end{split}  \tag{24}\]  
_which means that the tracking controller (23) shows a good tracking performance and can maintain the formation for a group of \(N\) mobile robots._  
Proof. : Define  
\[\eta_{i}=1-\cos\frac{\epsilon_{\theta i}}{2}, \tag{25}\]  
We note that \(\eta_{i}\) is non-negative and converges to \(0\) if and only if \(\epsilon_{\theta i}\) converges to \(4K\pi,K\in\mathbb{Z}\)[35]. Thus, \(\eta_{ei}\) instead of \(\epsilon_{\theta i}\) is applied to design a Lyapunov function as follows:  
\[V_{i}=\frac{1}{2}\epsilon_{xi}^{2}+\frac{1}{2}\epsilon_{yi}^{2}+\eta_{i}+ \Gamma_{i}, \tag{26}\]  
where \(\Gamma_{i}\) is potential function (5) so that \(V_{i}\) is non-negative and \(V_{i}\to\infty\) as \(\|\epsilon_{xi}\|+\|\epsilon_{yi}\|\to\infty\). Taking the time derivative of \(V_{i}\):  
\[\dot{V}_{i}=\dot{\epsilon}_{xi}\epsilon_{xi}+\dot{\epsilon}_{yi}\epsilon_{yi} +\frac{1}{2}\dot{\epsilon}_{\theta i}\sin\frac{\epsilon_{\theta i}}{2}+\dot{ \Gamma}_{i} \tag{27}\]  
Figure 5: The \(i\)th robot and interpretation of tracking errors. where the time derivative of potential function \(\Gamma_{i}\) has the following form:  
\[\dot{\Gamma_{i}}=\left\{ \begin{array}{cc}\frac{4d(d^{2}-R^{2})(R^{2}-r^{2})}{(d ^{2}-r^{2})^{3}}d,&r<d\leq R\\ 0,&d>R\end{array} \right. \tag{28}\]  
\(\Box\)  
We note that \(d\) is the distance between the robot and the obstacle. When the robot is outside the collision region, \(\dot{\Gamma_{i}}\) is equal to 0. While inside the collision region--i.e., \(r<d\leq R\)--then \(\frac{4d(d^{2}-R^{2})(R^{2}-r^{2})}{(d^{2}-r^{2})^{3}}\leq 0\), which means the sign of \(\dot{\Gamma_{i}}\) depends on the sign of \(\dot{d}\). Considering Remark 1, the reference trajectories can be adjusted dynamically to avoid obstacles; thus, \(d\) is guaranteed to increase when the robot is in the collision region. Therefore, it can be concluded that \(d\geq 0\); thus, \(\dot{\Gamma_{i}}\leq 0\) always holds.