# Automatic Vertical Parking Reference Trajectory Based on Improved Immune Shark Smell Optimization
## 2 Model of Reference Trajectory Optimization and Related Principles for Automatic Vertical Parking
### Reference Trajectory Optimization Model for AVP  
The main purpose of this work is to study an effective and applicable optimization method for automatic vertical parking reference trajectory. Therefore, how to properly determine the control speed and the control attitude angle change rate, according to the specific characteristics of the vehicle itself and the tracking control algorithm, is not considered in this situation. In other words, we only need to provide the common vehicle kinematics equations, which are described as follows:  
\[\left\{ \begin{array}{l}\vspace{0.2 cm}\vspace{0.2 cm}v_{it,ref}=\frac{\Delta L_{ g}}{\Delta T}\\ \omega_{it,ref}=\frac{\Delta\angle_{g}}{\Delta T}\\ \left|\vspace{0.2 cm}v_{it,ref}-v_{it,C}\right|\leq\Delta v_{\max}\\ \left|\omega_{it,ref}-\omega_{it,C}\right|\leq\Delta\omega_{\max}\\ \end{array} \right., \tag{4}\]  
where \(\Delta T\) denotes the parking process period, \(\Delta v_{\max}\) denotes the maximum threshold of the absolute value of the difference between the reference speed \(v_{it,ref}\) and the control speed \(v_{it,C}\), and \(\Delta\omega_{\max}\) denotes the maximum threshold of the absolute value of the difference between the reference attitude angle change rate \(\omega_{it,ref}\) and the control attitude angle change rate \(\omega_{it,C}\). Obviously, due to the limited performance of the vehicle itself,  
\[\left\{ \begin{array}{l}v_{it,C}\leq v_{C,max}\\ \omega_{it,C}\leq\omega_{C,\max}\\ \end{array} \right., \tag{5}\]  
where \(v_{C,max}\) and \(\omega_{C,\max}\) represent the maximum vehicle speed and maximum vehicle attitude angle change rate that can be achieved by vehicles of specific types, respectively. The parking reference trajectory \(T_{R}\) results from fitting the central points \(P_{1},P_{2},\cdots,P_{ns}\) of all feature regions. The central point \(P_{1}\) of the starting area is fixed, and the other \(ns-1\) feature regional center \(P_{2},\cdots,P_{ns}\) can be appropriately adjusted within a certain scope; they are the decision variables for parking reference trajectory optimization. Based on the reference trajectory optimization model for AVP, an IOA (intelligent optimization algorithm) can be used to obtain the AVP reference trajectory \(T_{R}\). In other words, the reference speed \(v_{it,ref}\) and reference attitude angle change rate \(\omega_{it,ref}\) at any time in the process can be obtained. Then, the appropriate tracking control algorithm can be adopted to obtain the corresponding tracking control trajectory. The specific automatic reversing parking reference trajectory optimization model is as follows:  
\[\min\left\{ \begin{array}{l}L(T_{R})=\int_{0}^{T_{\max}}v(t)dt \approx\sum\limits_{i=1}^{nt}\Delta L_{it}\\ \left|\Delta\angle_{S}\right|=\left|\angle\left(T(P_{ns},P_{bm}),L_{fe}\right) \right|\\ \left|\Delta\angle_{S}\right|\leq\Delta\angle_{\max}\\ \left|\Delta y_{ns}\right|=\left|y(P_{ns})-y_{H}\right|\leq\Delta y_{H\max} \end{array} \right., \tag{6}\]  
where \(\Delta t\) is the parking process period, \(\Omega_{g}\) is the area surrounded by both sidelines of the garage and the bottom line, \(P_{g}\) is the set of sideline collision avoidance detection position points, \(P_{g}(ig)\) is the position point for collision avoidance detection on the \(ig\)-th sideline, \(ig\in\{1,2,\cdots,ng\}\), and \(ng\) is the number of detection position points, obviously, \(\forall P_{g}(ig)\in\Omega_{g}\). \(\Delta L_{it}\) and \(\Omega_{c,it}\) are the interval distance for the parking and vehicle body coverage area under the \(it\)-th period, respectively, \(T_{\max}\) is the parking time, \(nt\) is the number of periods, \(nt\)=\(\left|\frac{T_{\max}}{\Delta t}\right|\), \(it\in\{1,2,\cdots,nt\}\), and \(\left\lceil\right\rceil\) is the upward rounding operator, because the vehicle cannot touch the bottom line of the garage and both sidelines, \(\forall P_{g}(i)\
otin\Omega_{c,it}\).