## 3 Formation Controller Design
### Collision Avoidance  
In this subsection, the component \(\left[\begin{array}{cc}v_{ai}&\omega_{ai}\end{array}\right]^{T}\) is designed via the potential function method to adjust the basic trajectories dynamically with regard to obstacles in the environment. For easy implementation, the shape of obstacles is simplified as being round, and a single robot is also regarded as a round obstacle for other robots. The detailed design is given below. Define the potential function candidate as  
\[\Gamma_{i}=\left\{\begin{array}{cc}0,&d\leq r\\ \left(\frac{d^{2}-R^{2}}{d^{2}-r^{2}}\right)^{2},&r<d\leq R\\ 0,&d>R\end{array}\right. \tag{5}\]  
where \(d=\sqrt{\left(x_{i}-x_{p}\right)^{2}+\left(y_{i}-y_{p}\right)^{2}}\) is the distance from the \(i\)th robot to the obstacle, and the coordinates are \(\left(x_{i},y_{i}\right)\)and \(\left(x_{p},y_{p}\right)\). \(r\) is the radius of the round obstacle and \(R\) is the radius of the detection region around the obstacle; note that \(R>r>0\).  
Thus, this function will blow up when the robot is close to the obstacle and will be equal to zero whenever the robot is outside the detection region. It is noteworthy that there is no need to consider situation \(d\leq r\) because collision will occur before that time.  
Take the partial derivatives of \(\Gamma_{i}\) with respect to \(x_{i}\) and \(y_{i}\) coordinates as  
\[\frac{\partial\Gamma_{i}}{\partial x_{i}}=\left\{\begin{array}{cc}\frac{4 \left(R^{2}-r^{2}\right)\left(d^{2}-R^{2}\right)}{\left(d^{2}-r^{2}\right)^{3 }}\left(x_{i}-x_{p}\right),&r<d\leq R\\ 0,&otherwise\end{array}\right. \tag{6}\]  
\[\frac{\partial\Gamma_{i}}{\partial y_{i}}=\left\{\begin{array}{cc}\frac{4 \left(R^{2}-r^{2}\right)\left(d^{2}-R^{2}\right)}{\left(d^{2}-r^{2}\right)^{3 }}\left(y_{i}-y_{p}\right),&r<d\leq R\\ 0,&otherwise\end{array}\right. \tag{7}\]  
and define the virtual force vector \(\vec{l_{pi}}=-k_{pi}\left[\begin{array}{cc}\frac{\partial\Gamma_{i}}{ \partial x_{i}}&\frac{\partial\Gamma_{i}}{\partial y_{i}}\end{array}\right]^{T}\).  
Transform this virtual force vector to the robot's body coordination as  
\[\left[\begin{array}{c}\Psi_{vi}\\ \Psi_{vi}\end{array}\right]=\left[\begin{array}{cc}\cos\theta_{i}&\sin\theta _{i}\\ -\sin\theta_{i}&\cos\theta_{i}\end{array}\right]\vec{l_{pi}} \tag{8}\]  
Figure 3: Virtual-structure-based formation setup.  
Then, the adjusted component can be obtained as  
\[\begin{split}\
u_{ai}=&-c_{3i}\Psi_{vi}\\ \omega_{ai}=&-c_{4i}\Psi_{vi}\end{split} \tag{9}\]  
where \(c_{3i}\) and \(c_{4i}\) are positive constants.  
In this design, the virtual force \(\Psi_{wi}\) directly acts on the reference angular velocity, and the action direction is opposite to the obstacle (see Figure 4), which means that the generator tends to turn in the direction without obstacles; correspondingly, new reference trajectories will deviate from the desired path to avoid obstacles. Another force \(\Psi_{vi}\) acts on the linear velocities, and the forward speed tends to decrease to adjust the direction when the obstacle is in front. By applying this design, the new trajectories can be guaranteed to gradually move away from the location of the obstacle.