## 7 Receding Horizon Trajectory Planning
### MPC-Based Trajectory Generation  
As detailed in Section 7.1, unaccountability of addressing sudden disturbances is the main limitation of OCP techniques (e.g., LQR, DDP); this is due to its nature. LQR calculates fixed receding control policy and applies it to the system; there is no intervention during the control policy execution. MPC is one of the ways to address the preceding problem, which is characteristic of both LQR and DDP. The difference between MPC and LQR is that only the first portion of the control policy is applied to a system (Figure 8) in MPC through the calculation of full control policy rather than employing full control policy as in LQR. Let us assume the system dynamics as given in (2). In general, MPC can be formed as follows:  
\[ \begin{split}\min_{w}&\quad J_{end}(\mathbf{x}_{k+N}, \mathbf{x}_{k+N}^{ref})+J_{k}(\mathbf{x},\mathbf{u},\mathbf{x}^{ref},\mathbf{u }^{ref})\\ \text{s.t.}&\quad\mathbf{x}_{k+1}=\mathbf{f}_{d}( \mathbf{x}_{k},\mathbf{u}_{k})\\ &\quad\mathbf{x}^{min}\leq\mathbf{x}_{k+i}\leq\mathbf{x}^{max} \quad\forall 0\leq i\leq N\\ &\quad\mathbf{u}^{min}\leq\mathbf{u}_{k+i}\leq\mathbf{u}^{max} \quad\forall 0\leq i<N-1\\ &\quad g_{1}(w)=0\\ &\quad g_{2}(w)\leq 0,\end{split}  \tag{59}\]  
where \(w=\mathbf{u}_{k},\ldots,\mathbf{u}_{k+N-1}\) is the optimal control sequence to be estimated in each iteration. Variable \(J_{end}(\mathbf{x}_{k+N})\) plays a significant role in terms of the stability of the system locally and globally. Presenting local stability is relatively easy, e.g., [PERSON]'s analysis compared to global stability. In addition to terminal cost, terminal constraints for states should be enforced, which is quite computationally challenging for real-time applications. Moreover, enforcing terminal constraints is even more difficult for nonlinear dynamics. Thus, in most of the practical applications, terminal constraints are not enforced into the optimization procedure. Furthermore, classical MPC lacks recursive feasibility. Several varieties of MPC have been proposed to address processing issues to a certain extent. For a linear system, the performance index, i.e., \(J_{k}(\mathbf{x},\mathbf{u},\mathbf{z}^{ref},\mathbf{u}^{ref})\), can be defined as follows:  
\[ \begin{split} J_{k}(\mathbf{x},\mathbf{u},\mathbf{z}^{ref}, \mathbf{u}^{ref})\\ =\sum_{i=0}^{N-1}((\mathbf{x}_{k+i}-\mathbf{x}_{k+i}^{ref})^{T}Q_ {x}(\mathbf{x}_{k+i}-\mathbf{x}_{k+i}^{ref})+(\mathbf{u}_{k+i}-\mathbf{u}_{k+ i}^{ref})^{T}R_{u}(\mathbf{u}_{k+i}-\mathbf{u}_{k+i}^{ref}))\\ +(\mathbf{x}_{k+N}-\mathbf{x}_{k+N}^{ref})^{T}P(\mathbf{x}_{k+N}- \mathbf{x}_{k+N}^{ref}),\end{split}  \tag{60}\]  
where \(Q_{x}\), which is a positive semi-definite matrix, consists of the state error penalty coefficients, whereas \(R_{u}\) should be positive definite and \(P\) is state error on the terminal cost. In principle, stability and feasibility are not assured implicitly. Consequently, stability and feasibility tend to improve for the longer receding horizon, which is quite challenging due to computational demands. Quadrotor dynamics are usually expressed in a nonlinear fashion. Therefore, LQR or linear MPC cannot be applied without linear approximation. Hence, the nonlinear-programming-based approach has to be applied. Direct multiple shooting and direct collocation are the main two techniques that are used to transform OCP into nonlinear programming (NLP). In both direct multiple shooting and direct collocation, the state is minimized in addition to controlling inputs. Direct multiple shooting differs from direct collocation due to the way of the problem formulation. In multiple shooting, the problem is quantized into \(N\) subintervals, i.e., receding horizon length. In direct collocation, however, those subintervals are further described by a set of polynomials such as B-spline or Lagrangian; this will increase the problem sparsity. On the contrary, the number of optimization parameters to be optimized has dramatically increased in direct collocation compared to multiple shooting.