## 4 Simulation Setup
### Simulation of Set 1  
This simulation set is designed to illustrate that the controller with collision avoidance can show better performance in a relatively complex environment than without. To obtain a fair and effective comparison, two controllers are compared as follows:  
C1: Virtual-structure-based formation controller with P1 considering collision avoidance. The control law is selected as (23), where \(c_{1i}=10\) and \(c_{2i}=5\), and the parameters in adjusted component (9) in Section 3.2 is selected as \(c_{3i}=1\) and \(c_{4i}=1\). The parameter in P1 (17) is selected as \(\alpha=1\). C2: Virtual-structure consensus tracking control (proposed in [18], without collision avoidance). The control law is designed as  
\[u_{i}=B_{i}^{-1}(-k\sum_{j\in N}(r_{i}-r_{j})-(r_{i}-r_{d})+\dot{r}_{d}) \tag{35}\]  
where  
\[r_{i}=\left[ \begin{array}{c}x_{ri}\\ y_{ri}\end{array} \right]=\left[ \begin{array}{c}x_{i}\\ y_{i}\end{array} \right]+\left[ \begin{array}{cc}\cos\theta_{i}&\sin\theta_{i }\\ \sin\theta_{i}&\cos\theta_{i}\end{array} \right]\left[ \begin{array}{c}d_{x}\\ d_{y}\end{array} \right],\]  
\(\left[ \begin{array}{cc}d_{x}&d_{y}\end{array} \right]^{T}\) is the distance between the position of the \(i\)th robot and the position of the center of the virtual structure \(k=1\). Then,  
\[B_{i}=\left[ \begin{array}{cc}\cos\theta_{i}&-d_{x}\sin\theta_{i}-d_{y}\cos \theta_{i}\\ \sin\theta_{i}&d_{x}\cos\theta_{i}-d_{y}\sin\theta_{i}\end{array} \right],\]\(r_{d}=\left[ \begin{array}{cc}x_{d}&y_{d}\\ \end{array} \right]^{T}\) is the desired trajectory. The workshop is 4 m \(\times\) 4 m square in the simulation set, which contains three mobile robots cooperating with each other. Assume that the shape of each robot is round, each robot can detect the position of others and obstacles in the workshop are within a certain range. A triangle formation is expected and built by the virtual structure (show in Figure 6a) and the distance \(\left[ \begin{array}{cc}l_{xi}&l_{yi}\\ \end{array} \right]^{T}\) between the \(i\)th desired trajectory and the center of the virtual structure \(\left[ \begin{array}{cc}x_{d0}&y_{d0}\\ \end{array} \right]^{T}\) is given as follows:  
\[\left[ \begin{array}{cc}l_{x1}&l_{y1}\\ \end{array} \right]^{T}=\left[ \begin{array}{cc}0&0.6\\ \end{array} \right]^{T}\] \[\left[ \begin{array}{cc}l_{x2}&l_{y2}\\ \end{array} \right]^{T}=\left[ \begin{array}{cc}0&-0.6\\ \end{array} \right]^{T}\] \[\left[ \begin{array}{cc}l_{x3}&l_{y3}\\ \end{array} \right]^{T}=\left[ \begin{array}{cc}-0.6&0\\ \end{array} \right]^{T}\]  
Then, the desired trajectory of the virtual center is designed as follows:  
\[x_{d0}=\left\{ \begin{array}{cc}-2+0.2t&t\leq T_{1}\\ -1+\sin\left(0.2\left(t-T_{1}\right)\right)&T_{1}<t\leq T_{2}\\ 1-\cos\left(0.2\left(t-T_{2}\right)\right)&T_{2}<t\leq T_{3}\\ 1+0.2\left(t-T_{3}\right)&T_{3}<t\leq T_{4}\\ \end{array} \right. \tag{36}\]  
\[y_{d0}=\left\{ \begin{array}{cc}-1&t\leq T_{1}\\ -\cos\left(0.2\left(t-T_{1}\right)\right)&T_{1}<t\leq T_{2}\\ \sin\left(0.2\left(t-T_{2}\right)\right)&T_{2}<t\leq T_{3}\\ 1&T_{3}<t\leq T_{4}\\ \end{array} \right. \tag{37}\]  
\[\theta_{d0}=\left\{ \begin{array}{cc}0&t\leq T_{1}\\ -0.2\left(t-T_{1}\right)&T_{1}<t\leq T_{2}\\ -\frac{\pi}{2}+0.2\left(t-T_{2}\right)&T_{2}<t\leq T_{3}\\ 0&T_{3}<t\leq T_{4}\\ \end{array} \right. \tag{38}\]  
where \(T_{1}=5\), \(T_{2}=5+2.5\pi\), \(T_{3}=5+5\pi\), \(T_{4}=10+5\pi\), and the desired trajectory of the \(i\)th robot \(R_{di}\) is calculated based on \(R_{d0}\), as shown in Figure 6b. We note that the desired trajectory designed for formation maintenance has discontinuities. Figure 6: The triangle formation setup and desired trajectories for the robot formation in set 1. Figures 9 and 10 show the tracking errors of the whole group. It should be noted that the desired trajectories have three mutation points, which result in the blowing up of tracking errors at these moments. The tracking errors caused by trajectory catastrophe in C1 are obviously lower than those in C2.