# Quadrotor Formation Strategies Based on Distributed Consensus and Model Predictive Controls
## 5 Formation Strategies
### Formation Strategy: Leader
#### 5.1.1 Generation of the Desired Formation Trajectory in the Horizontal Motion  
In the horizontal motion, the leader generates the followers' desired formation trajectories based on its position, direction of the horizontal velocity in frame \(\mathbf{I}\), predicted trajectory, and the given formation pattern. The transformation from the leader's predicted trajectory to the desired formation trajectories of the followers can be derived according to Figure 4.  
First of all, from Figure 4a, the follower's desired formation position in horizontal plane in frame \(\mathbf{I}\) can be described as follows:  
\[\mathbf{r}_{d,F}=\mathbf{r}_{L}+\mathbf{r}_{L2F,\mathbf{I}}, \tag{30}\]  
where \(\mathbf{r}_{d,F}\) denotes the position vector of the follower's desired formation position and \(\mathbf{r}_{L}\) denotes the leader's position vector. \(\mathbf{r}_{L2F,\mathbf{I}}\) is a vector pointing from leader's position to follower's desired formation position with respect to frame \(\mathbf{I}\).  
Considering Figure 4b, the desired formation position with respect to the leader's velocity tangential coordinate can be written as follows:  
\[\mathbf{r}_{L2F,\mathbf{V}} = \left[\begin{array}{cc}\rho_{\parallel}&\rho_{\perp}\end{array} \right]\left[\begin{array}{cc}\hat{V}_{L_{\parallel}}\\ \hat{V}_{L_{\perp}}\end{array}\right], \tag{31}\]  
where \(\hat{V}_{L_{\parallel}}\) and \(\hat{V}_{L_{\perp}}\) are the unit vectors of the leader's velocity tangential coordinate in which \(\hat{V}_{L_{\parallel}}\) is parallel to \(\mathbf{V}_{L}\) and \(\hat{V}_{L_{\perp}}\) is perpendicular to \(\mathbf{V}_{L}\). \(\left(\rho_{\parallel},\,\rho_{\perp}\right)\) is the coordinate of the desired formation position with respect to the leader's tangential coordinate.  
Figure 4: Relative position of the leader and the follower (left); tangential coordinate and leader’s velocity \(\mathbf{V}_{L}\) in a horizontal plane (right).  
Figure 3: Formation control strategy of the leader.  
The rotation matrix, denoted as \(R_{V2I}\), that transforms the position vector from \(r_{L2F,V}\) to \(r_{L2F,I}\) is defined as follows:  
\[R_{V2I} = \left[\begin{array}{cc}\cos\theta_{VL}&\sin\theta_{VL}\\ -\sin\theta_{VL}&\cos\theta_{VL}\end{array}\right], \tag{32}\]  
where \(\theta_{VL}\) is the angle between \(\mathbf{V}_{L}\) and \(\mathbf{\hat{i}}\), which can be obtained by  
\[\theta_{VL} = \cos^{-1}\left(\frac{V_{L}\cdot\mathbf{\hat{i}}}{\parallel\mathbf{V}_{L} \parallel}\right). \tag{33}\]  
\(\mathbf{V}_{L}\) and its magnitude can be computed as follows:  
\[\mathbf{V}_{L} = \hat{x}\ \mathbf{\hat{i}}+\hat{y}\ \mathbf{\hat{j}},\] \[\parallel\mathbf{V}_{L}\parallel = \sqrt{\hat{x}^{2}+\hat{y}^{2}}, \tag{34}\]  
where \(\hat{x}\) and \(\hat{y}\) can be obtained from Equation (8). Thus, position vector \(r_{L2F,I}\) can be obtained as follows:  
\[r_{L2F,I} = \left[\begin{array}{cc}\rho_{\parallel}&\rho_{\perp}\end{array} \right]\left[\begin{array}{cc}\cos\theta_{VL}&\sin\theta_{VL}\\ -\sin\theta_{VL}&\cos\theta_{VL}\end{array}\right]\left[\begin{array}{c} \mathbf{\hat{i}}\\ \mathbf{\hat{j}}\end{array}\right]. \tag{35}\]  
Finally, the coordinate of the follower's desired formation position \(\mathbf{r}_{d,F}\) can be obtained by  
\[\mathbf{r}_{d,F} = \mathbf{r}_{L}+\mathbf{r}_{L2F,I}\] \[\Rightarrow\left\{\mathbf{r}_{d,F}\right\}_{\mathbf{I}} = \left\{\mathbf{r}_{L}\right\}_{\mathbf{I}}+\left[\begin{array}{cc}\rho _{\parallel}&\rho_{\perp}\end{array}\right]\left[\begin{array}{cc}\cos \theta_{VL}&\sin\theta_{VL}\\ -\sin\theta_{VL}&\cos\theta_{VL}\end{array}\right]. \tag{36}\]  
Applying Equation (36) to every points of the leader's position in the predicted trajectory, the desired formation trajectory of each follower in the horizontal motion over the predicted time horizon can be obtained.