# Quadrotor Formation Strategies Based on Distributed Consensus and Model Predictive Controls
## 5 Formation Strategies
### Formation Strategy: Leader
#### 5.1.2 Generation of the Desired Formation Trajectory in the Vertical Motion  
In this study, followers are designated to maintain the same altitude as the leader throughout the flight. Thus, the leader's predicted trajectory of the altitude computed by the MPC algorithm directly becomes the followers' desired formation trajectories. The leader's vertical motion is determined by the desired altitude and/or climb rate, which can be classified into four cases as shown in Table 3.  
In the vertical motion, the first two states, \(\Delta z\) and \(\Delta w\) in the state-space model (13) are used to construct a new second-order state-space model. The new second-order state-space model describes the leader's vertical motion and can be rewritten as follows:  
\[\left[ \begin{array}{c}\Delta z\\ \Delta\dot{w}\end{array} \right]=\left[ \begin{array}{cc}0&1\\ 0&0\end{array} \right]\left[ \begin{array}{c}\Delta z\\ \Delta w\end{array} \right]+\left[ \begin{array}{c}0\\ \frac{-1}{m}\end{array} \right]\Delta T_{total}. \tag{37}\] \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Case** & **Desired Altitude** & **Climb Rate** & **Vertical Motion** \\ \hline \(I\) & Not Given & Not Given & Maintain current altitude. \\ \(II\) & Given & Not Given & Climb to desired altitude. \\ \(III\) & Not Given & Given & Continuous climbing with given climb rate. \\ \(IV\) & Given & Given & Climb to desired altitude with given climb rate. \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Cases of leader’s vertical motion with desired altitude and climb rate. \(\Delta z\) is positive as the quadrotor moving downward. However, it is more intuitive for us to consider moving upward as positive. Hence, variable \(\Delta h\) is defined to replace \(\Delta z\) in the state-space model:  
\[\Delta h=-\Delta z\quad\Rightarrow\quad\Delta\dot{h}=-\Delta w,\]  
and therefore  
\[\left[ \begin{array}{c}\Delta h\\ \Delta\dot{w}\end{array} \right]=\left[ \begin{array}{cc}0&-1\\ 0&0\end{array} \right]\left[ \begin{array}{c}\Delta h\\ \Delta w\end{array} \right]+\left[ \begin{array}{c}0\\ \frac{-1}{m}\end{array} \right]\Delta T_{total}. \tag{38}\]  
With the given desired altitude and/or climb rate, the vertical reference trajectory of the leader for the MPC can be obtained. The MPC computes the control input and the predicted trajectory according to the reference trajectory and the state-space model (38). The following illustrate how the reference trajectory for the MPC is generated in each case in Table (3):  
* Case I: maintain the current altitude. In this case, the leader is designated to maintain the altitude. Thus, the reference trajectories of \(\Delta h\) and \(\Delta w\) over the predicted time horizon are equal to zero. * Case II: climb to the desired altitude. If the desired altitude is given but not the climb rate, the leader is designated to climb to the desired altitude with the default climb rate. The reference for \(\Delta w\) is the negative default climb rate and the reference trajectory of \(\Delta h\) is computed by \[\boldsymbol{d}_{Alt}(k)=\overline{L}_{p}+RC_{default}\times k\times\Delta h_{s},\] (39) where \(\boldsymbol{d}_{Alt}(k)\) denotes the reference altitude at time step \(k\), which is equal to the leader's current altitude \(\overline{L}_{p}\) plus the default climb rate \(RC_{default}\) times the time step \(k\) and the interval of the time step \(\Delta h_{s}\). Time step \(k\) is defined over the predicted time horizon considered by the MPC with the interval of \(\Delta h_{s}\). A deceleration action is taken as the leader is approaching the desired altitude. If the distance between the leader's current position and the desired altitude is smaller than the altitude that can increase/decrease according to the climb rate within one second, then the reference of the altitude is set to the desired altitude and the reference of the climb rate will be set to zero. * Case III: continuous climbing with the given climb rate.