# A Trajectory Generation Method for Multi-Rotor UAV Based on Adaptive Adjustment Strategy
## 3 Method
### Definition of Optimization Function and Adaptive Adjustment Method
#### 3.2.3 Time Reallocate Method  
By optimizing the objective function, a B-spline trajectory with better smoothness and dynamic feasibility can be obtained, but some of its trajectory segments may not meet the dynamic feasibility constraints, that is, some speed and acceleration control points will exceed the maximum speed and acceleration of the multi-rotor UAV. Therefore, it is necessary to adjust the original uniform knot vector to obtain a better trajectory that meets the dynamic constraints.  
This paper refers to the time reallocate method in reference [18] to adjust the trajectory's time to meet the dynamic constraints. Record the \(i\)-th speed control point and acceleration control point as \(\mathbf{V}_{i}\) and \(\mathbf{A}_{i}\), respectively. \(\mathbf{V}_{i}\) and \(\mathbf{A}_{i}\) can be calculated by Formula (25).  
\[\mathbf{V}_{i}=\frac{p_{b}(\mathbf{Q}_{i+1}-\mathbf{Q}_{i})}{t_{i+p_{b}+1}-t_{i+1}},\;\mathbf{ A}_{i}=\frac{(p_{b}-1)(\mathbf{V}_{i+1}-\mathbf{V}_{i})}{t_{i+p_{b}+1}-t_{i+2}} \tag{25}\]  
According to the convex hull property of the B-spline curve, if the absolute values of velocity control points and acceleration control points do not exceed the limits, then the velocity and acceleration at any point of the B-spline curve are also less than the maximum velocity and acceleration, thus meeting the dynamic feasibility. If the speed control points or the acceleration control points exceed the limits, the time reallocate method keeps the position of the control points unchanged. It increases the time interval so that the trajectory meets the dynamic constraints. Set the maximum speed and acceleration of multi-rotor UAV as \(v_{max}\) and \(a_{max}\), respectively. Assume the \(k\)-th speed control point \(V_{k}\) does not meet the dynamic constraint, and its absolute value is recorded as \(v_{m}\). At this time, the time interval between \(t_{i+p_{b}+1}\) and \(t_{i+1}\) needs to be adjusted to  
\[\hat{t}_{m+1}-\hat{t}_{m}=\frac{v_{m}}{v_{max}}(t_{m+1}-t_{m}),\;m=i,i+1, \ldots i+p_{b}+1 \tag{26}\]At this time, the speed control point \(\mathbf{V}_{i}\) will be adjusted to  
\[\mathbf{V}_{i}=\frac{p_{b}(\mathbf{Q}_{i+1}-\mathbf{Q}_{i})}{\hat{t}_{i+p_{b}+1}-\hat{t}_{i+1 }}=\frac{v_{max}}{v_{m}}\frac{p_{b}(\mathbf{Q}_{i+1}-\mathbf{Q}_{i})}{\left(t_{i+p_{b}+1 }-t_{i}\right)}=\frac{v_{max}}{v_{m}}v_{m}=v_{max} \tag{27}\]  
Therefore, the speed control point can meet the maximum speed requirement.  
Similarly, if the absolute value \(a_{m}\) of the acceleration control point \(A_{i}\) exceeds the maximum acceleration \(a_{max}\), the time interval should also be adjusted. The \(a_{i}\) value of the acceleration control point is jointly affected by \(\mathbf{V}_{i}\) and \(\mathbf{V_{i+1}}\), so the \(a_{i}\) value is affected by \(t_{i+p_{b}+2}-t_{i}\). To make the adjusted acceleration value not exceed the maximum acceleration, the time interval between \(t_{i+p_{b}+2}\) and \(t_{i+1}\) needs to be adjusted to  
\[\hat{t}_{m+1}-\hat{t}_{m}=\sqrt{\frac{a_{m}}{a_{max}}}(t_{m+1}-t_{m}),m=i,i+1, \ldots,i+p_{b}+2 \tag{28}\]  
The acceleration will be adjusted to  
\[\mathbf{A}_{i}=\frac{(p_{b}-1)\big{(}\mathbf{V}_{i+1}^{\prime}-\mathbf{V}_{i}^{\prime} \big{)}}{\hat{t}_{i+p_{b}+1}-\hat{t}_{i+2}}=\sqrt{\frac{a_{max}}{a_{m}}}\frac{ p_{b}\Big{(}\sqrt{\frac{a_{max}}{a_{m}}}\mathbf{V}_{i+1}-\sqrt{\frac{a_{max}}{a_{m}}} \mathbf{V}_{i}\Big{)}}{\left(t_{i+p_{b}+1}-t_{i}\right)}=a_{max} \tag{29}\]  
Therefore, the acceleration \(\mathbf{A}_{i}\) meets the constraint of maximum acceleration.