## 4 Initial Trajectory Generation
### Minimum-Snap-Based Trajectory Generation  
minimum-snap trajectory generation [53] uses the differential flatness property (Section 2.3) to automate the trajectory generation process. Let quadrotor trajectory be \(\Gamma_{T}(t)=[r_{T}(t),\psi_{T}(t)]^{T}\) for flat output \([x,y,z,\psi_{z}]^{T}\), where \(r=[x,y,z]\) is the center position of the MAV with respect to world coordinate system and \(\psi_{z}\) is the yaw angle of the MAV. The continuous trajectory can be expressed as follows:  
\[\Gamma(t):[t_{0},t_{n}]\leftarrow\mathbb{R}^{d}, \tag{12}\]  
where \(d\) is the dimension of the space, e.g., 3. As we defined in Section 2.3, system states and inputs can be determined in terms of \(\Gamma\) and its derivatives. \(\Gamma,\dot{\Gamma}\), and \(\dot{\Gamma}\) correspond to position, velocity, and acceleration, respectively. Flat output and its derivatives estimation in minimum-snap refer to the original work [53] (Equations (1)-(35)).  
In minimum-snap trajectory parameterization, the total time duration of the trajectory is divided into a set of subintervals, i.e., keyframes. Each keyframe consists of a desired position and a yaw angle. A safe corridor is constructed between consecutive keyframes as a set of piece-wise-polynomial functions to estimate smooth transitions through the keyframes. Let \(m_{d}\) and \(d\) be the number of keyframes and the order of the piece-wise-polynomial functions, respectively. Hence, \(\Gamma_{T}(t)\) can be formulated as:  
\[\Gamma_{T}(t)=\left\{\begin{array}{ccc}\sum_{i=0}^{d}\Gamma_{i,1}(t-t_{0})^ {i}&&t_{0}\leq t<t_{1}\\ \sum_{i=0}^{d}\Gamma_{i,2}(t-t_{1})^{i}&&t_{1}\leq t<t_{2}\\ \vdots&&\\ \sum_{i=0}^{d}\Gamma_{i,m_{d}}(t-t_{m_{d}-1})^{i}&&t_{m_{d}-1}\leq t<t_{m_{d}} \end{array}\right.. \tag{13}\]To generate an optimal trajectory, the following objective is utilized:  
\[J(r_{T},\psi_{T}) =\int_{t_{0}}^{t_{m_{d}}}\xi_{r}\Bigg{\|}\frac{d^{k}r_{T}}{dt^{k_{r} }}\Bigg{\|}^{2}dt+\xi_{\psi}\frac{d^{k_{\psi}}{\psi_{T}}^{2}}{dt^{k_{\psi}}}\,dt \tag{14}\] \[\min_{w} J(r_{T},\psi_{T})\] s.t. \[\Gamma_{T}(t_{i})=\Gamma_{i} i=1,\ldots,m_{d}\] \[\frac{d^{p}x_{T}}{dt^{p}}|_{t=t_{j}} \leq 0 j=0,m_{d};\,p=1,\ldots,k_{r}\] \[\frac{d^{p}y_{T}}{dt^{p}}|_{t=t_{j}} \leq 0 j=0,m_{d};\,p=1,\ldots,k_{r}\] \[\frac{d^{p}z_{T}}{dt^{p}}|_{t=t_{j}} \leq 0 j=0,m_{d};\,p=1,\ldots,k_{r}\] \[\frac{d^{p}\psi_{T}}{dt^{p}}|_{t=t_{j}} \leq 0 j=0,m_{d};\,p=1,\ldots,k_{\psi},\]  
where \(\xi_{r}\) and \(\xi_{\psi}\) are regulation parameters, \(k_{r}\) and \(k_{\psi}\) are the order of derivation at each keyframe, and \(\Gamma_{T}(t_{i})=[x_{i},y_{i},z_{i},\psi_{z_{i}}]^{T},i=0,\ldots,T\). Time intervals, \(t_{1},t_{2},\ldots,t_{m_{d}}\) can be kept constant or varying when deriving the minimum-snap trajectory generation. In most cases, having varying time intervals between keyframes is necessary. [PERSON] et al. [53] proposed a gradient descent-based approach for finding optimal time intervals between keyframes. Furthermore, [PERSON] et al. [74] utilized A* to find the intermediate waypoints. Based on these estimations, time segments or keyframes are calculated incorporating both velocity and acceleration limits. In the latter approach, the steps listed below were used to obtain intermediate waypoints. Initially, the environment was constructed as a map using OctoMap. Afterwards, the formed map was split into two subsets: allocated and nonallocated (a set of free spaces). Then, the discrete graph was constructed connecting consecutive free spaces, which were represented as cubes. Afterwards, A* was applied for finding the optimal path segment within each cube. Similar to (14), the researchers set \(k_{r}=3\) and minimized only total jerk (15) to minimize the angular velocity. As an aside, minimizing the angular velocity helps to avoid fast rotation.  
\[J=\int_{t_{0}}^{t_{m_{d}}}\xi_{r}\Bigg{\|}\frac{d^{k_{r}}\Gamma_{T}(t)}{dt^{k _{r}}}\Bigg{\|}^{2}dt. \tag{15}\]