1 Introduction

As the most common ways of transportation, cars are playing an increasingly important role in daily travel and life (Park et al., 2018). However, the increasingly complex driving environment makes drivers very headache, resulting in many traffic accidents, of which parking traffic accidents account for about 20% (Qin et al., 2022). To effectively reduce the parking burden of drivers and alleviate the problem of "less parking space and difficult parking" in cities (Zhang et al., 2014), automatic parking, as an important technology for driver comfort and parking safety, has been widely concerned and studied in recent years (Chai et al., 2023).

In autonomous parking research, parking trajectory planning is an important technology to realize autonomous parking. At present, parking trajectory planning algorithms mainly include:(1) geometric method (Li et al., 2021), (2) graph search method (Laurini et al., 2021, Tazaki et al., 2017), (3) random sampling method (Bergman et al., 2021), (4) learning-based method (Xu et al., 2021), (5) numerical optimization method (Liu et al., 2023), etc. Among these methods, the geometric method mainly obtains the trajectory through curve combination and interpolation fitting (Hu et al., 2022); for instance, Chen et al. (Chen et al., 2023) introduced a parallel parking path planning based on enhanced arctangent function optimization. The basic idea of graph search method is to traverse a state space and then search out the optimal path according to the given starting point and target point. Bai et al. (2022) used the directed hybrid A* global path planning algorithm to accurately and effectively generate a collision-free path from the starting point to the ending point. However, the front section of the planned path may have twists and turns, and the path is not optimized enough. The random sampling method selects optimal points in the configuration space based on performance requirements, ensuring probabilistic completeness but lacking efficiency. Zheng and Liu (2018) introduced vehicle kinematics constraints on the basis of the traditional rapidly exploring random tree (RRT) algorithm to obtain vertical, parallel, and oblique parking paths, which improved the computational efficiency. However, the stability of the obtained path quality still needed to be further improved. Based on the learning method, namely the design of strategic neural network from environment to control, behavioral cloning or reinforcement learning was adopted to train the strategy network (Hu et al., 2022). Sun et al. (2021) established the initial strategy neural network using demonstration data of nonlinear programming, and it was improved by reinforcement learning, so as to obtain parking trajectory. On this basis, the obtained trajectory can be tracked by many algorithms, for instance, pure pursuit method (Ahn et al., 2021), model predictive control (Stano et al., 2023), etc.

Compared with other methods, the numerical optimization method sorted the automatic parking trajectory planning into a constrained dynamic optimization problem (DOP) (Kou et al., 2024), in which the vehicle travels from the starting position to the target position to meet some evaluation indexes under the constraints of environmental constraints and the vehicle’s own characteristics (Chen et al., 2016). Meanwhile, the feasible parking path can still be planned under complex environment and small parking space (Zhang et al., 2021). The pseudo-spectral method, which employs the numerical optimization technique, is esteemed for its high solving accuracy, uncomplicated structure, and efficient solving capabilities, making it a subject of extensive research. Pseudo-spectral methods include Gaussian pseudo-spectral method (GPM), Legendre pseudo-spectral method (LPM), etc. For instance, Huntington et al. (2007) studied the above pseudo-spectral methods and proved that LPM and GPM pseudo-spectral methods have advantages in convergence speed and accuracy. The idea of the pseudo-spectral method is to discretize the DOP into a nonlinear programming (NLP) problem (Liu et al., 2019). Currently, this method has been widely studied in intelligent driving (Zhang and Sun, 2024). For instance, Qiu et al. (2023) employed a piecewise Gauss pseudo-spectral method to construct a trajectory planning scheme for autonomous parking. Qian et al. (2020) introduced autonomous parking path planning using hp adaptive Gaussian pseudo-spectrum to address slow convergence. However, Liu et al. (2022) highlighted that the global Gauss pseudo-spectral method is characterized by dense ends and sparse middle. Meanwhile, this kind of method requires a large amount of calculation and the operational efficiency still needs to be optimized. To further improve the performance of this method, the segmented Gaussian pseudo-spectrum method was further studied. Qian et al. (2019) proposed a piecewise GPM in different parking areas to discretize the optimal control problem into an NLP, which was solved separately at different stages. Gan et al. (2019) studied the pseudo-spectral splicing method to solve multi-stage parking and obtain parking path planning.

The above method can obtain parking trajectories of different parking spaces by solving DOPs several times in segments, but the overall computational efficiency is still not guaranteed, rapid parking trajectory planning should be further studied. Meanwhile, in the actual parking scenarios, due to the small parking space and complex constraints, it is required that the unmanned vehicle parking planning time should be as short as possible to ensure quick and effective parking. Therefore, enhancing the GPM’s efficiency for parking trajectory planning is paramount.

To improve the parking trajectory planning efficiency and safety, this paper proposed a data-driven intelligent parking trajectory planning method. First, the vehicle kinematics model is constructed based on the Ackermann steering principle, and the parking process is divided into three stages. Accordingly, the three-stage parking trajectory planning model is established and transformed into a DOP. Then, the proposed T-GPM is employed to solve the typical parallel parking DOPs offline so as to establish the parking trajectory database. With introducing the fuzzy theory (Yadav and Maurya, 2021), fuzzy rules are designed to deal with fuzzy input and the data-driven fuzzy logic parking trajectory planning method is proposed to generate parking trajectory rapidly. Finally, to validate the efficacy of the proposed approach, CarSim co-simulation tests and real car experiments are carried out, and experiment results are analyzed to verify the superiority of the proposed method.

The structure of this paper is outlined below: Sect. 2 gives the establishment process of parallel parking trajectory planning mathematical model; Sect. 3 describes the proposed three-stage Gaussian pseudo-spectral optimization algorithm; the fuzzy logic-based data-driven parking trajectory planning strategy is given in Sect. 4; Sect. 5 carries on the simulation and experiment comparative tests; Sect. 6 summarizes the work of this paper.

2 Parallel Parking Trajectory Planning Mathematical Model

2.1 Three-Stage Parking

The aims of the parking process can be concluded as driving a vehicle from an initial point to a terminal point without collision. Learning from the parking process of human driving, three stages of parallel parking are introduced in this work, including: approaching stage, C-type entering stage, and terminal stage. The description of the three stages is given in Fig. 1 and the detailed process are stated as follows: (1) approaching stage (Fig. 1(a)): according to daily parking experience, vehicles generally start parking near the front parking space, and this stage is the process from the starting position to the target parking space. During this process, the car will briefly regress a certain distance before entering the appropriate position for the next stage; (2) C-type entering stage (Fig. 1(b)): the vehicle will gradually move from the left side to the target parking space with a trajectory similar to C type, and eventually the entire car will enter the target parking space; (3) terminal stage (Fig. 1(c)): vehicle completely enters the target parking space and adjusts to be parallel to the parking space.

Fig. 1
figure 1

Three-stage parking process: (a) approaching stage (stage 1), (b) C-type entering stage (stage 2), and (c) terminal stage (stage 3)

In Fig. 1, it can be found that during each stage, the vehicle is located at the certain region or tracery. In this work, we define the width of the road as W1, the width of the parking space is denoted as W2, the length of the feasible parking region is represented by L2, and the length of parking space is defined as L3. Meanwhile, the four vertex points of the vehicle is denoted as \(V_{i}\)(\(i = A,B,C,D\)).

Therefore, during the first stage, the four vertex points of the vehicle should satisfy the following constraints:

$$ Stage\;{1}:\left\{ \begin{gathered} L3 < V_{i,x} < L2 \hfill \\ 0 < V_{i,y} < W1 \hfill \\ \end{gathered} \right.,i = A,B,C,D, $$
(1)

where \(V_{i,x}\) means the value along the x-axis and \(V_{i,y}\) means the value along the y-axis.

In the second stage, the circular arc theory (Zhang and Zhang, 2019) is introduced to avoid collision, where the vehicle moves counterclockwise as an arc. Briefly, the following constraint should be satisfied:

$$ \begin{gathered} stage\;2:\;\frac{{\tan \theta (t) \cdot x_{0} + 1 + V_{C,y} - \tan \theta (t) \cdot V_{C,x} }}{{\sqrt {(\tan \theta (t))^{2} + 1} }} \hfill \\ > \sqrt {(x_{0} - P_{x} )^{2} + ( - 1 - P_{y} )^{2} } , \hfill \\ \end{gathered} $$
(2)

where \(\theta (t)\) is the vehicle attitude angle (°), \((P_{x} ,P_{y} )\) is the coordinate of point P, and the center coordinate point O is defined as \(O(x_{0} , - 1)\).

In the stage 3, the vehicle completely enters the target parking space and adjusts to be parallel to the parking space, as shown in Fig. 1(c). In this stage, the four coordinates of the vehicle should meet the constraint conditions

$$ stage\;{3}:\left\{ \begin{gathered} 0 < V_{i,x} < L3 \hfill \\ - W2 < V_{i,y} < 0 \hfill \\ \end{gathered} \right.,i = A,B,C,D. $$
(3)

2.2 Three-Stage Parking Trajectory Planning Model

Drawing from the Ackerman steering principle and the vehicle kinematic diagram, the kinematic formula of a vehicle can be described as follows:

$$ \left\{ \begin{gathered} \dot{x}(t) = v(t) \cdot \cos \theta (t) \hfill \\ \dot{y}(t) = v(t) \cdot \sin \theta (t) \hfill \\ \dot{\theta }(t) = v(t) \cdot \tan \varphi (t)/L \hfill \\ \dot{v}(t) = a(t) \hfill \\ \end{gathered} \right., $$
(4)

where \((x(t),y(t))\) is the rear axle center point (m), \(\theta (t)\) is the vehicle attitude angle (°), \(v(t)\) is the vehicle speed (m/s), \(a(t)\) is the acceleration (\({\text{m/s}}^{{2}}\)), \(\varphi (t)\) is the front wheel angle (°), and \(L\) is the vehicle wheelbase (m).

Throughout the parking maneuver, the vehicle will follow the equations of Eq. (4). Meanwhile, the goal of the parking is to guide the vehicle to a designated position with allowed vehicle performance constraints. Accordingly, the initial and terminal constraints, along with the physical constraints, are outlined below

$$ \begin{gathered} |v(t)| \le v_{\max } ,|a(t)| \le a_{\max } ,{|}\varphi (t)| \le \varphi_{\max } \hfill \\ v(t_{0} ) = v_{0} ;a(t_{0} ) = a_{0} ;\theta (t_{0} ) = \theta_{0} ;\varphi (t_{0} ) = \varphi_{0} \hfill \\ v(t_{f} ) = v_{f} ;a(t_{f} ) = a_{f} ;\theta (t_{f} ) = \theta_{f} ;\varphi (t_{f} ) = \varphi_{f} , \hfill \\ \end{gathered} $$
(5)

where \(v_{\max }\) means the maximum parking speed (m/s), \(a_{\max }\) represents the maximum acceleration of parking motion (m/s2), \(\varphi_{\max }\) is the maximum front wheel angle (°), and \(t_{0}\) and \(t_{f}\) represent the start and terminal time (s), respectively.

For simplicity, we denote \(x(t) = [x(t),y(t),\theta (t),v(t)]^{{\text{T}}}\) and \(u(t) = [\varphi (t),a(t)]^{{\text{T}}}\) as the state and control vectors. Combining the kinematic formula and physical constraints with the three-stage parallel parking constraints, we define the three-stage parking trajectory planning model (TSPTPM) below.

TSPTPM: given the kinematic model of vehicle (4) and initial and the physical constraints (5), calculate an optimal parking trajectory to achieve the minimal/maximal performance index, where the three-stage constraints (1) ~ (3), physical constraints and pre-specified terminal conditions are satisfied during the parking process.

The TSPTPM definition allows for a variety of performance indexes. In this work, the minimal parking time performance index is chosen for trajectory planning. Therefore, the mathematical model of the TSPTPM can be described as a dynamic optimization problem (DOP) as follows:

$$ \begin{gathered} \min \; \, J = t_{f} \hfill \\ s.t.\;\dot{x}(t) = f(x(t),u(t),t) \hfill \\ \;\;\;\;\;\;\;x(t_{0} ) = x_{0} ,x(t_{f} ) = x_{f} \hfill \\ \;\;\;\;\;\;\;\;Stage\;1:\left\{ \begin{gathered} L3 < V_{i,x} < L2 \hfill \\ 0 < V_{i,y} < W1 \hfill \\ \end{gathered} \right.,i = A,B,C,D \hfill \\ \;\;\;\;\;\;\;\;stage\;2:\;\frac{{\tan x_{3} (t) \cdot x_{0} + 1 + V_{C,y} - \tan x_{3} (t) \cdot V_{C,x} }}{{\sqrt {(\tan x_{3} (t))^{2} + 1} }} \hfill \\ \;\;\;\;\;\;\;\; > \sqrt {(x_{0} - P_{x} )^{2} + ( - 1 - P_{y} )^{2} } \hfill \\ \;\;\;\;\;\;\;\;stage\;3:\left\{ \begin{gathered} 0 < V_{i,x} < L3 \hfill \\ - W2 < V_{i,y} < 0 \hfill \\ \end{gathered} \right.,i = A,B,C,D \hfill \\ \;\;\;\;\;\;\;x_{\min } \le x(t) \le x_{\max } ,u_{\min } \le u(t) \le u_{\max } , \hfill \\ \end{gathered} $$
(6)

where state vector \(x(t) \in {\mathbb{R}}^{4}\) and control vector \(u(t) \in {\mathbb{R}}^{2}\); \(f(x(t),u(t),t):{\mathbb{R}}^{4} \times {\mathbb{R}}^{2} \times {\mathbb{R}} \in {\mathbb{R}}\) is the kinematic model of vehicle function respects to time \(t \in {\mathbb{R}}\); \(x_{0}\) and \(x_{f}\) are the initial and terminal parking conditions, respectively; \(x_{\min }\), \(x_{\max }\), \(u_{\min }\), and \(u_{\max }\) are the boundary limits.

3 Three-stage Gaussian pseudo-spectral optimization algorithm

3.1 Legendre–Gauss-Based Pseudo-spectral Technique

Pseudo-spectral methods constitute a category of direct approaches employing collocation for numerical solution of optimal control problems, rather than analytical methods. The first step is to discretize the state and control histories. This discretization is accomplished by the use of global polynomials. In this work, the Legendre–Gauss (LG) collocation points are employed. This method makes use of the Nth-order Legendre Polynomial, bounded on the interval [-1,1]

$$ P_{LG} = \frac{1}{{2^{N} N!}}\frac{{d^{N} }}{{d\tau^{N} }}([\tau^{2} - 1]^{N} ), $$
(7)

where \(\tau \in ( - 1,1)\).

Since the LG points lie on the interval from -1 to 1, so the first step in this transcription is to change the time interval of the DOP from \(t \in [t_{0} ,t_{f} ]\) to \(\tau \in [ - 1,1]\). This is done using the mapping by

$$ t = \frac{{(t_{f} - t_{0} )}}{2}\tau + \frac{{(t_{f} + t_{0} )}}{2}. $$
(8)

The states and controls are approximated by utilizing a collection of Lagrange interpolating polynomials at N LG points, so that

$$ \begin{gathered} x(\tau ) \approx X(\tau ) = \sum\limits_{i = 1}^{N} {L_{i} (\tau )X(} \tau_{i} ) \hfill \\ u(\tau ) \approx U(\tau ) = \sum\limits_{i = 1}^{N} {L_{i} (\tau )U(\tau_{i} )} , \hfill \\ \end{gathered} $$
(9)

where \(\tau_{i} ,i = 1,2,...,N\) are the are the LG points and \(L_{i} (\tau )\) are the Lagrange polynomials of degree N-1 (Kang, 2010).

According to the properties of Legendre orthogonal polynomials, the LG points are acquired by solving the roots of the Legendre polynomial in the time domain \(( - 1,1)\). In this work, the Legendre polynomial (Liu et al., 2019) stated below is used for calculating these points

$$ \begin{gathered} P_{n + 1} \left( \tau \right) = (\tau - \alpha_{n} )P_{n} \left( \tau \right) - \beta_{n}^{2} P_{n - 1} \left( \tau \right),{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} n = 0,1,...,N \hfill \\ P_{0} \left( \tau \right) = 1,\;\;P_{ - 1} \left( \tau \right) = 0. \hfill \\ \end{gathered} $$
(10)

To solve Eq. (10), the following matrix is introduced:

\({\text{Q}} = \left( \begin{gathered} \begin{array}{*{20}c} \begin{gathered} \alpha_{0} \hfill \\ \beta_{1} \hfill \\ \end{gathered} & \begin{gathered} \beta_{1} \hfill \\ \begin{array}{*{20}c} {\alpha_{1} } & {\beta_{2} } \\ \end{array} \hfill \\ \end{gathered} \\ \end{array} \hfill \\ \begin{array}{*{20}c} {} & {} & {\begin{array}{*{20}c} {} & \ddots \\ \end{array} } \\ \end{array} \hfill \\ \begin{array}{*{20}c} {} & {} & {\begin{array}{*{20}c} {} & {} & {\begin{array}{*{20}c} \begin{gathered} \alpha_{n - 2} \hfill \\ \beta_{n - 1} \hfill \\ \end{gathered} & \begin{gathered} \beta_{n - 1} \hfill \\ \alpha_{n - 1} \hfill \\ \end{gathered} \\ \end{array} } \\ \end{array} } \\ \end{array} \hfill \\ \end{gathered} \right)\).

Based on the proof of (Liu et al., 2019), it has been demonstrated that the eigenvalues of the matrix \({\text{Q}}\) correspond to the roots of the Nth-order Legendre polynomial. Meanwhile, the values of \(\alpha_{n}\) and \(\beta_{n}\) are recommended as \(\alpha_{n} { = }0\) and \(\beta_{n} { = }n/\sqrt {4n^{2} - 1}\), respectively (Liu et al., 2019).

3.2 Three-Stage Discretization of Infinite DOP

Essentially, problem (6) is an infinite optimization problem. However, since there are three stages during the parking process, we proposed the three-stage-based Gauss pseudo-spectral method (named T-GPM) to discretize the DOP into an NLP.

First, combining with the three-stage parking division, the entire parking time interval is divided into three segments as \([t_{m - 1} ,t_{m} ]\)\((m = 1,2,3)\). Accordingly, the length of each segment is represented as \(\theta_{1} ,\theta_{2} ,\theta_{3}\). Time variable \(\tau\) then is introduced for three-stage time transcription

$$ \tau = \frac{2}{{t_{m} - t_{m - 1} }}t - \frac{1}{{t_{m} - t_{m - 1} }}(t_{m} + t_{m - 1} ),t_{m - 1} < t_{m} . $$
(11)

Using Eq. (11), each subinterval is transformed into the new interval [-1, 1]. Subsequently, the Kinematic model is transformed into three segments as follows:

$$ \dot{x}_{m} (\tau ) = \frac{1}{2}\theta_{m} f(x_{m} (\tau ),u_{m} (\tau ),\tau ),\;\;m = 1,2,3. $$
(12)

Using the Legendre polynomial to discrete the state and control vectors in each piecewise time interval \([t_{m - 1} ,t_{m} ]\), \(N_{m}\) LG points can be obtained, and the state vector \({\mathbf{x}}_{m} {(}\tau {)}\) and control vector \(u_{m} (\tau )\) are approximated as

$$ \begin{gathered} x_{m} (\tau ) \approx X_{m} (\tau ) = \sum\limits_{i = 1}^{{N_{m} }} {L_{m,i} (\tau )X_{m,i} } \hfill \\ u_{m} (\tau ) \approx U_{m} (\tau ) = \sum\limits_{i = 1}^{{N_{m} }} {L_{m,i} (\tau )U_{m,i} } , \hfill \\ \end{gathered} $$
(13)

where \({\mathbf{X}}_{m,i}\) and \({\varvec{U}}_{m,i}\) are the values of state and control vector under LG points;\(L_{m,i} (\tau )\) is the Lagrange polynomials during each time interval.

By taking the derivative of the state vector with respect to \(\tau\), we can obtain that

$$ \dot{x}_{m} (\tau ) \approx \dot{X}_{m} (\tau ) = \sum\limits_{i = 1}^{{N_{m} }} {\dot{L}_{m,i} (\tau )X_{m,i} + } \dot{L}_{m,0} (\tau )X_{m,0} . $$
(14)

Then, by combining Eq. (14) with Eq. (12), it is easy to obtain

$$ f(X_{m} (\tau ),U_{m} (\tau ),\tau ) = \frac{{2(\sum\limits_{i = 1}^{{N_{m} }} {\dot{L}_{m,i} (\tau )X_{m,i} + } \dot{L}_{m,0} (\tau )X_{m,0} )}}{{\theta_{m} }}. $$
(15)

Therefore, the kinematic model is also discretized using the LG points. Finally, problem (6) is transformed into a finite parameter optimization NLP problem.

4 Fuzzy Logic-Based Data-Driven Parking Trajectory Planning

4.1 Construction of Data-Driven Trajectory Set

T-GPM has the characteristics of high computation accuracy for solving DOPs. However, the calculation efficiency of Gaussian pseudo-spectral method is not stable and the low computation time cannot be guaranteed, which would affect the application of online parking trajectory planning. To tackle this issue, several typical parallel parking DOPs are established under some specific parking area and then solved by the proposed T-GPM.

Accordingly, the offline parking trajectory database is established with using these reference trajectories. Then, this work proposes the optimization data-driven fuzzy logical intelligent parking trajectory planning method to achieve online parking planning. To facilitate the simulation calculation and combine with the actual size of parallel parking space, the size of parallel parking space is defined as 6 m × 2.5 m in this work. Meanwhile, the reference parking trajectories are obtained with the vehicle located at position 1 m in front of the target parking space, where the 11 vertical positions are 1.0, 1.25, 1.5, 1.75, and 2 m, respectively. Meanwhile, the built-in Lagrange interpolation function is employed to fit the T-GPM calculated trajectory points to obtain the database set. As illustration, Fig. 2 shows the specific parking area and the fitted offline parking trajectories calculated by T-GPM. Finally, using the offline T-GPM computation and Lagrange interpolation fitting, the data-driven trajectory set is established.

Fig. 2
figure 2

Construction of parking trajectory set based on T-GPM

4.2 Fuzzy Logical Strategy

To achieve rapid parking, the optimization data-driven fuzzy logical intelligent parking trajectory planning method is proposed in this work. With using the fuzzy logic and database, the online parking trajectory planning method is proposed, and the frame of this algorithm is given in Fig. 3.

Fig. 3
figure 3

Frame of fuzzy logic parking trajectory planning

First, the first step of fuzzy logic planning strategy is to define membership function by fuzzification. In this work, membership function is used to quantify the membership degree of an element to a set. Selecting appropriate membership function can improve the accuracy and practicability of fuzzy logic. Triangle membership function, Gaussian membership function, trapezoidal membership function, and others are commonly used membership functions at present. The triangle membership function is usually used to describe the degree to which the value of a variable is near a certain central value, which is suitable for the case that the value range of a variable is limited and the change is smooth. To sum up, combined with the actual situation of parking, trajectory planning needs accurate and smooth trajectory, so this paper adopts the common triangle membership function to describe the membership degree of fuzzy subset.

In this work, five triangle membership functions defined as NB\NS\ZO\PS\PB are set up according to the parking trajectory set and the theoretical domain was defined as [1, 2]. Five triangle membership function domains include [0.75, 1.00, 1.25], [1.00, 1.25, 1.50], [1.25, 1.50, 1.75], [1.50, 1.75, 2.00], and [1.75, 2.00, 2.25], respectively. The triangle membership function is evenly distributed to ensure the integrity and interactivity among fuzzy subsets.

It can be seen in Fig. 3 that the input value is the horizontal coordinate of the parking starting point, and the output is the parking trajectory of the corresponding starting point. For fuzzification, the weight parameter is defined as \(K_{i} \user2{,}\;\;\user2{(}i\user2{ = 1,2,}...\user2{,}5\user2{)}\). Specifically, these parameters are calculated using the following formula:

$$ K_{i} = trimf\left( {d_{in} ,\left[ {Q_{1} \, Q_{2} \, Q_{3} \, Q_{4} \, Q_{5} } \right]} \right),\;\;i = 1,2,...,5, $$
(16)

where \(d_{in}\) is the input value (horizontal coordinates of parking point); \(trimf\left( \cdot \right)\) is the triangle membership function; \(Q\) is the coefficient on \(trimf\left( \cdot \right)\), which are selected according to fuzzy rule.

Then, the second step of fuzzy logical planning strategy is fuzzy inference. The key point of this step is designing fuzzy rules based on the optimization database. In fact, the design of fuzzy rules is highly flexible and depends on the specific characteristics of the system in question. In the current work, the fuzzy rules are designed based on the membership degree assignment and the detailed rules are given in Table 1.

Table 1 Fuzzy rules of variable membership assignment

Finally, the third step of fuzzy logical planning strategy is defuzzification. The fuzzy output value obtained by fuzzy logical planning strategy is mapped to the real world instead of being expressed in the form of fuzzy language. In this work, weighted gravity center method, which is the most commonly used and reasonable defuzzification method, is used as the defuzzification method, which encompasses all the data within the fuzzy subset. The fuzzy equation is solved as follows:

$$ U_{0} = \frac{{\sum\limits_{i = 1}^{5} {\mu (K_{i} ) \cdot K_{i} } }}{{\sum\limits_{i = 1}^{5} {K_{i} } }}, $$
(17)

where \(\mu (K_{i} )\) is the fitting locus point of database set and \(U_{0}\) is the calculated online parking trajectory vector.

4.3 Algorithm Implementation

In this work, membership function, fuzzy rules, and weighted center of gravity method are used to achieve the fuzzy logic processes of fuzzification, fuzzy reasoning, and defuzzification. By combining the optimization database with the fuzzy logic planning, the data-driven online parking method is proposed. The flowchart of the online data-driven fuzzy logic parking trajectory planning method is illustrated in Fig. 4. Specifically, below are the detailed steps provided.

Fig. 4
figure 4

Flowchart of the data-driven fuzzy logic online parallel parking trajectory method

Step 1: Detect the vehicle location, parking space, and environment detail and send the information to Step 2.

Step 2: Get the information and transmit the horizontal and longitudinal coordinates of the initial parking position to Step 3.

Step 3: Check whether the starting point lengthwise is 1 m away from the parking space. If the value exceeds 1 m, go to Step 4; otherwise, go to Step 5.

Step 4: Translate and guide the vehicle to a position 1 m away from the vehicle, and then perform Step 5.

Step 5: Import the parking trajectory optimization data base, which is established by applying the proposed T-GPM to solve DOPs offline. Then, go to Step 6.

Step 6: Set the membership function according to the optimization trajectory set and go to Step 7.

Step 7: Use the fuzzy rules and database to achieve fuzzy inference and calculate weight parameter \(K_{i} \user2{,}\;\;\user2{(}i\user2{ = 1,2,}...\user2{,}5\user2{)}\), and go to Step 8.

Step 8: Calculate the fitted trajectory points \(\mu (K_{i} )\) using the optimal trajectory set and go to Step 9.

Step 9: Use the defuzzification equation to calculate the parking planning trajectory and go to Step 10.

Step 10: Transmit the acquired trajectory to the vehicle controller for tracking.

5 Experimental Tests

5.1 Numerical Simulation

Numerical experiments are conducted on a model of an unmanned vehicle to confirm the efficacy of the suggested algorithm. Meanwhile, the vehicle and parking space adopted by (Qian et al., 2019) is used in this work. The detailed parking parameters and vehicle information are given in Table 2. All simulations are performed on a personal computer equipped with MATLAB 2019b software. Furthermore, the partial initial and terminal constraints are set below during the test. The number of LG points is set as 10, and the solving accuracy of NLP solver is 10–3

$$ \begin{gathered} v(t_{0} ) = 0;a(t_{0} ) = 0;\theta (t_{0} ) = 0;\varphi (t_{0} ) = 0 \hfill \\ v(t_{f} ) = 0;a(t_{f} ) = 0;\theta (t_{f} ) = 0;\varphi (t_{f} ) = 0. \hfill \\ \end{gathered} $$
(18)
Table 2 Parking parameter information

To verify the solution performance of the proposed T-GPM, we employed the T-GPM to plan the parking trajectories of the vehicle with starting points in front of the target parking space (x = 7 m, y = 1.0 ~ 2.0 m). The obtained trajectories are shown in Fig. 5. As illustration, Fig. 6 gives the curves of heading angle, speed, front wheel angle and acceleration under a certain starting point. Figures 5 and 6 show that the T-GPM may have potential application value for parking trajectory planning. Upon calculation, it is determined that the average computation time of T-GPM for planning a parking trajectory is 55.3 s, which is deemed insufficient for rapid parking. Furthermore, the T-GPM requires high computation platform, which also limits its practical application.

Fig. 5
figure 5

Parking optimization trajectory set by Gaussian pseudo-spectrum method

Fig. 6
figure 6

State curves of heading angle, speed, front wheel angle, and acceleration obtained by T-GPM

In contrast, the proposed optimization data-driven fuzzy logic parking trajectory planning method is tested. Four random starting points (7.0 m, 1.2 m), (7.0 m, 1.4 m), (7.0 m, 1.6 m), (7.0 m, 1.8 m) are chosen for comparison. The test results are presented in Table 3, indicating that both methods are capable of calculating parking trajectories. By analyzing the computation time of the two methods, it can be observed that the average parking planning time of fuzzy logic is 0.0011 s, and it can be concluded that more than 99% computation time is reduced by the fuzzy planning method when compared with GPM method, revealing the online efficiency of proposed strategy. In addition, the average deviation between the two paths is 0.0056 m, which shows the accuracy of the fuzzy logic trajectory planning, indicating that the proposed is feasible and effective. Accordingly, the trajectory comparison between T-GPM and fuzzy logic planning method is shown in Fig. 7. It can be seen that the trajectory differences of T-GPM and fuzzy logic planning are small, and the curves have good coincidence, revealing the performance of proposed method.

Table 3 Test result comparison of T-GPM optimization and fuzzy logical planning method
Fig. 7
figure 7

Comparison between T-GPM and fuzzy logic trajectory planning

To conduct additional validation of the proposed approach’s effectiveness, a comparative evaluation with two arcs method (Maoyue et al., 2021) and hybrid A*method (Huang et al., 2022) is conducted. During the tests, the starting position is set as (7.0 m, 1.5 m). Correspondingly, the parking paths obtained by the three methods are shown in Fig. 8; it can be found that the three methods can successfully guide the vehicle into the parking space. However, it is evident that the paths are different, where the safe distances of the proposed method and two arcs method are better than that of the hybrid method, which is quite close to the parking space edge and has collision risk. By comparing these trajectories in Fig. 9, it is founded that the trajectory of the propose method is similar with that of Hybrid A* method, and both are closer to the parking space when compared with that of two arcs method. Table 4 gives the computation performances of the three methods, where the planning time costs are 0.0011s, 0.1509s, and 1.8036s, respectively, revealing that the proposed method has very good online planning performance. Test result show that the data-driven fuzzy logic online parallel parking trajectory method can well planning the parking trajectory with high performance.

Fig. 8
figure 8

Parking trajectories of fuzzy logical planning method, two arcs method, and hybrid A*method

Fig. 9
figure 9

Fuzzy logic parallel parking trajectory

Table 4 Performance comparison of fuzzy logical planning method, two arcs method, and hybrid A*method

5.2 CarSim Co-simulation Experiment

To confirm the credibility of the proposed data-driven fuzzy logic trajectory planning method, the co-simulation of CarSim and Simulink software is conducted. The processor used in this work is Intel (R) Core (TM) i7-9750H CPU @ 2.60 GHz. In MATLAB 2019b, the fmincon nonlinear programming solver is used to find the minimum value of the constrained nonlinear multivariate function, and obtain LG points. Meanwhile, the cftool fitting toolbox is employed to fit the parallel parking trajectory, and then obtain a brand-new parallel parking trajectory through the triangular membership function. Furthermore, the trajectory tracking verification is achieved through joint simulation of the MATLAB-based block diagram design environment Simulink and the car dynamics simulation software CarSim 2019.

During the simulation tests, CarSim simulation software provides high-precision vehicle dynamics model, which makes simulation experiment data more reliable. Meanwhile, Matlab/Simulink software provides visual data modules, making the development and testing of algorithms more convenient and efficient (Zhang et al., 2022). In this work, CarSim is used to simulate and analyze the dynamic behavior of vehicles, using multi-body dynamics simulation methods to simulate the vehicle’s suspension, steering, braking, and power systems, as well as the vehicle’s interaction with the road surface. During the test, B-Class Hatchback vehicle in CarSim database is chosen for experiment and the relevant parameters are configured in Fig. 10.

Fig. 10
figure 10

Basic parameter Settings of CarSim model car

In this model, the input and output parameters are set according to the requirements of the Carsim model and Simulink model, where the input values are brake master cylinder pressure and steering wheel angle, and the output values are vehicle speed, heading angle, horizontal and vertical axis coordinates, and the horizontal coordinates of the left and right rear axle tires. In the simulation parking scenario, the space length is 6 m and the width is 2.5 m, and the lane width is 3.5 m. Meanwhile, Simulink co-simulation model is established in Simulink platform, as shown in Fig. 11, where the PID tracking algorithm is employed for trajectory tracking.

Fig. 11
figure 11

CarSim-Simulink co-simulation model

We set the starting position of the vehicle as (7 m, 1.3 m), and then running the simulation of the co-simulation model, the whole parking process is monitored. The parking process of the co-simulation test is given in Fig. 12. It is apparent that Fig. 12(a) shows the starting position of the vehicle, which is parallel to the parking space; as the parking process proceeds, the vehicle enters the second stage, where the vehicle follows the planned trajectory arc and no there is no collision with the left rear corner of the front parking space as shown in Fig. 12(b); finally, Fig. 12(c) shows that the vehicle parks to the target parking space and maintains a certain safe distance from the marking line around the parking space. Accordingly, Fig. 12(d) shows the whole process of parallel parking. It can be seen that this planning method can efficiently plan the parallel parking trajectory and the trajectory can be well tracked, revealing the effectiveness and potential application value of the proposed planning method.

Fig. 12
figure 12

Parking process of the co-simulation test: (a) parking start, (b) entering the parking space, (c) landing the parking space, and (d) the whole process of parallel parking

To further substantiate the effectiveness of the proposed method for different complex scenarios, angled parking and different parking spaces testing are conducted. The simulation results are shown in Fig. 13. Figure 13(a) and 13(b) give the parking results of the proposed method for different lateral and longitudinal starting points. Figure 13(c) and 13(d) exhibit the parking results of the proposed method for angled parking with + 10° and − 0° attitude angles. Figure 13(d) gives the parking process of the proposed method for 5.4 m length narrow parking space. Results show that this method can rapidly plan parking trajectories with different starting points and parking status, and can well satisfy the safety parking requirements of test vehicles. Meanwhile, the planned trajectories can also be well tracked by the designed PID tracking controller, further revealing the application value of the proposed algorithm.

Fig.13
figure 13

Simulation results of angled parking and different parking spaces testing: (a) lateral remote parking, (b) longitudinal remote parking, (c) angled parking with + 10° angle, (d) angled parking with -10° angle, and (e) parking test with 5.4 m length narrow parking space

5.3 Actual Experiment

To validate the practical utility of the proposed data-driven approach, the actual experiment is conducted. The tested vehicle is equipped with high-precision GPS positioning system, a Xavier processor platform, 4 cameras, and a millimeter-wave radar. The geographic position of the test vehicle is measured using a positioning and navigation device. The length and width of the parking space are 6 m and 2.5 m, respectively. By obtaining the starting point of the vehicle, the proposed method is employed to generate the parking trajectory, and then, the planned trajectory is sent to the Xavier processor, so that the tracking control system is executed. Figure 14 shows the planning and tracking trajectories of the actual experiment. Accordingly, Fig. 15 gives the parking process of the actual experiment. It is evident that the proposed method effectively plans parking trajectories for real vehicles, and the planned trajectories can be tracked. By analyzing the parking data, the maximal tracking error between the planned and tracked trajectories is 0.2426 m, revealing that the proposed method is applicable in real-world environment. Honestly, a better tracking method should be developed to adapt the proposed planning method.

Fig. 14
figure 14

Planning and tracking results of actual experiment

Fig. 15
figure 15

Parking process of the actual experiment

6 Conclusion

In this paper, a three-stage Gaussian pseudo-spectrum optimization data-driven fuzzy logic parallel parking trajectory planning algorithm is proposed. The main concept of this work is to adopt the proposed T-GPM to construct trajectory data so as to drive the fuzzy planning logic to obtain online parking trajectories. To improve the solving efficiency of GPM, three-stage parking trajectory planning DOP is established and the corresponding three-stage Gaussian pseudo-spectrum optimization is proposed. By solving the typical parallel parking DOPs offline, the parking trajectory database is obtained. Therefore, the fuzzy rules can be easily designed to achieve rapid parking planning. By combining the database with fuzzy logic, the data-driven fuzzy logic planning algorithm for parking trajectory planning is carried out for testing. Experimental tests on unmanned vehicle model reveal that the proposed method can decrease more than 99% computation time and obtain the same parking trajectories when compared with T-GPM trajectory planning, demonstrating the performance improvement of the proposed method. The experiment test on real car reveals that the proposed method is applicable in real-world environments. Since the current algorithm does not consider blind spots or dynamic objects, the extension of this method can be adding intelligent decision strategies tackle the dynamic scenarios for safe and efficient parking in real-world environments. Meanwhile, developing a better tracking method for the proposed planning method to achieve high-precision tracking is also a future work.