Time-optimal trajectory planning for autonomous parking of tractor-semitrailer vehicle based on piecewise Gauss pseudospectral method

For the autonomous parking problem of the tractor-semitrailer vehicle, a piecewise Gauss pseudospectral method is proposed as a trajectory planning scheme in this paper. Firstly, the trajectory planning problem is transformed into an optimal control problem by establishing a vehicle kinematics model for the low-velocity scene, the dynamic constraints including the physical constraints, the collision avoidance constraints, and the endpoint constraints. The optimal control problem are discretized into a nonlinear programming problem by piecewise Gauss pseudospectral method according to the movement area during parking process. The shortest time to complete parking is taken as the objective function. The Gauss pseudospectral method is further adopted to solve the nonlinear programming problem in the two parking stages. Three parallel parking conditions with different lengths of parking spaces and three vertical parking conditions with different widths of parking spaces are set for simulation verification based on Matlab/Simulink. The simulation results show that the proposed method can uniformly and effectively solve the trajectory planning problem of the tractor-semitrailer vehicle. Compared with the traditional pseudospectral method, a shorter parking time and a significantly higher convergence rate can be got with the method, which further indicates that the proposed method has good effectiveness and robustness.


Introduction
Trucks with large cargo capacity occupy a major position in the freight transport industry. Tractor-semitrailer are more and more widely used because of their large carrying capacity and low transportation cost. Due to the large outline size of the tractor-semitrailer and the hinge joint constraint between the tractor and the semitrailer, the tractor-semitrailer has higher requirements for the driver's experience and driving technology in the parking condition. Therefore, the development of autonomous parking systems is very important to improve driving safety and parking efficiency. An autonomous parking system mainly includes three layers: the perception layer, decision-planning layer, and execution layer. Motion planning belongs to the decision-planning level and its main role is to generate the best route for vehicles from the starting point to the destination, including path planning and trajectory planning.
Generally speaking, the current motion planning methods can be roughly divided into four categories. The first is the graph search method, which includes two steps: graph construction and path search. For an unstructured environment, literature 1 proposed a graph-based search algorithm and a discrete kinematic vehicle model to find a primitive path that is non-holonomic, collision-free, and safe. Literature 2 redesigned the Dijkstra algorithm to tackle situations in which the parameters of the networks may be uncertain by the form of special picture fuzzy numbers. Literature 3 presented Morphological Dilation Voronoi Diagram Roadmap (MVDRM) algorithm to address unsafe path computation accompanied by high time and space computation complexity problems of roadmap path planning methods in complex environments for mobile robots. The graph search method can quickly obtain the driving path and is widely used in global path planning. However, the planning results are relatively rough. The graph search method is usually used as a preprocessing for other methods.
The second kind is the random sampling method. The PRM method proposed in the literature 4 make full use of terrain and threat information, so that the UAV's route map can not only avoid terrain and threat, but also automatically track the terrain. A modified RRT* algorithm named Quick-RRT* was proposed in the literature, 5 which can generate better initial solutions and converge to the optimal solution faster than RRT*. Further, to improve the algorithm efficiency, many kinds of literature proposed some improvement strategies, such as PBG RRT, 6 EBG-RRT, 7 RRT-Connect, 8 Extend RRT, 9 etc. Compared to graph search methods, random sampling methods are more efficient and can be found as long as the solution exists. However, the shortcomings of the random sampling method are also obvious, that is, the solutions generated each time have a certain degree of randomness and may not be the same.
The third category is the geometric line construction method. The Dubins curve in literature 10,11 and the Reeds-Shepp curve in literature [12][13][14] are typical geometric line construction methods, which can obtain the shortest path but cannot deal with complex collision avoidance constraints. Literature 15 adopted a Clothoid curve, while the literature 16 used a S-shaped curve to generate smooth and continuous paths. Simple combinations of circles and straight lines can also be used to generate paths, such as in literature. 17,18 The parking paths obtained by the spline curves, cubic spline interpolation, and polynomial fitting curves used in literature [19][20][21] are smoother and collision-free. The advantages of this method are low computational complexity and easy path tracking of the output path.
The fourth category is the one based on machine learning or numerical optimization methods. In literature, 22,23 the Random Forest (RF) model and neural network algorithms was applied to learn the mapping relationship between control parameters and trajectories, and the trained model is used for parking trajectory planning. Literature 24 presented a path planning approach for robot social navigation by making use of Fully Convolutional Neural networks (FCNs) to learn from experts' path demonstrations. The use of FCNs allowed us to overcome the problem of manually designing/identifying the cost-map and relevant features for the task of robot navigation. Literature 25 realized path planning of mobile robot based on Qlearning algorithm of Markov decision process. Machine learning methods have fast computational speed, but are highly dependent on sample size and quality. In terms of numerical optimization methods, a search-resampling-optimization (SRO) framework is proposed in literature. 26 A hybrid A* algorithm is employed to generate a coarse path and a resampling process is implemented to pave a series of safe dispatch corridors (SDCs) along the coarse path. The resampled result is further fed into the optimization stage to facilitate the numerical solution. Literature 27 proposed a two-stage hierarchical method for trajectory planning of unmanned surface vehicle. This method included coarse path generation based on hybrid A* and trajectory solving based on numerical optimization. Literature 28 proposed an efficient hierarchical initialization technique based on the Dubins curve method when using numerical optimization methods for trajectory solving, which effectively improves convergence efficiency. In literature, 29 a homogenization layer was proposed to reduce the dimension and nonlinearity of the formulated optimal control problem in the planning layer and consequently improves the robustness and efficiency of the solution process. Literature 30 adopted Reeds-Shepp curve to provide initial guesses for trajectory planning of the entire system in the second layer. The above literatures used different initialization techniques to accelerate the convergence rate of trajectory solving process, which provides a high academic reference value. Literature 31 proposed a Successive Linearization in Feasible Set (SLiFS) algorithm to address the nonconvex collision avoidance constraints and the nonlinear vehicle dynamic constraints. For the trajectory planning of heavy mining trucks near the loading/dumping site of open-pit mines, literature 32 established a coarse to fine framework. Under the rough planning by an enhanced hybrid a* search algorithm, a small-scale nonlinear programming was used to obtain the optimal trajectory. Literature 33 proposed a parallel stitching strategy to solve the replanning problem caused by dynamic obstacles during the parking process and the proposed replanner also supported switching to a better homotopy class online. In literature, 34 a method of reconstructing corridors in an iterative framework is proposed to quickly solve the lightweight optimal control problem with only box constraints. An iterative computation framework is proposed to accumulatively handle the collision avoidance constraint and nonconvex kinematics constraint in curve trajectory planning task in literature. 35 In literature, 36 an optimization-based trajectory planning method is proposed to solve the motion planning problem of tractor-trailer vehicle in a curvy and tiny tunnel. This method has significant advantages over popular sampling and search-based algorithms in solving high spatial dimensions or harsh constraint conditions. In the literature, 37,38 Li et al., divided the parallel parking process of a single car into two stages. Interior-point method is used to solve the trajectory planning problem of parallel parking in each stage. Piecewise solution can effectively improve the success rate of solving single car parking trajectory. The numerical optimization method can directly and accurately describe the vehicle motion planning problem, and the solution process can be combined with the various intelligent optimization algorithms. Therefore, it has been favored by academic circles at home and abroad in recent years and it is also a research hotspot. However, in the numerical optimization method, as the number of state/control variables and constraints increases, the solution maybe unsuccessful or convergence rate is slow. This is also one of the focuses of research.
The above studies have made a positive contribution to the solution of the motion planning problem of unmanned vehicles. As a numerical optimization method, Gauss pseudospectral Method (GPM) has many advantages, such as a fast convergence rate and low sensitivity to the initial value, which make this method much more suitable for autonomous parking trajectory planning. However, due to extremely narrow parking environments relative to the larger body size of the tractor-semitrailer vehicle, more contour vertex than that of the ordinary vehicle, and complex constraints, the traditional GPM often has the phenomenon of non-convergence or slow convergence rate in the solution of parking trajectory.
In this paper, a trajectory planning method based on piecewise GPM is proposed to solve the problem of autonomous parking of the tractor-semitrailer vehicle. In order to improve the convergence success rate and efficiency of the algorithm when solving the trajectory, the parallel parking and vertical parking of the tractorsemitrailer vehicle are divided into two stages according to the parking area. The piecewise algorithm can automatically filter a suitable intermediate configuration as the connection point of the two stages. Reasonable constraints are set at the end of the first stage and the beginning of the second stage to ensure that the state variables and control variables of the two stages remain numerically continuous. Taking the shortest parking time as the optimization goal at each stage, the vehicle kinematics model, dynamic constraints, collision avoidance constraints, and endpoint constraints of two stages are established, and the autonomous parking trajectory planning problem is further described as the optimal control problem. By linearizing and discretizing the optimization problem, the above optimal control problem is transformed into a nonlinear programming problem within the framework of GPM. The optimal trajectory can be obtained by using piecewise GPM to solve the nonlinear programming problem. The simulation results of trajectory planning under vertical and parallel parking conditions indicate that this method can obtain an effective parking trajectory for the tractor-semitrailer vehicle, and the convergence success rate and efficiency are significantly improved.

Simplified kinematics model of the tractor-semitrailer vehicle
The outline of the tractor-semitrailer is simplified, and the tractor and semitrailer are equivalent to rectangular rigid bodies that can be rotated. The hinged joint is located at the center of the rear axle of the tractor. Under the condition of autonomous parking on a flat road, the dynamic characteristics such as sideslip caused by tire lateral force can be ignored due to the low driving velocity. The established tractor-semitrailer autonomous parking kinematics model is shown in Figure 1.
The golden rectangular block represents the tractor, the front axle is the steering axle, and the rear axle adopts the form of a double-axle arrangement. The pink rectangular block represents the semitrailer, the rear axle adopts the form of a triple-axle arrangement. O 1 and O 2 are the rear-axle center points of the tractor and semitrailer, respectively. L 1 and L 2 refer to the length of the tractor and semitrailer. Both the width of the tractor and semitrailer are W . L f 1 and L f 2 indicate the front suspension of the tractor and the semitrailer, L r1 and L r2 are the corresponding rear suspension. L w and L c are the wheelbase. u 1 and u 2 refer to the heading angle. O 3 indicates the instantaneous turning center of the tractor and semitrailer, r c and r t denote the corresponding turning radius. u refers to the front wheel steering angle. A tractor-semitrailer vehicle is described as a tractor towing one semitrailer. Kinematics of the concerned tractor is expressed by: Where (x, y) refers to the mid-point of the rear-wheel axis of the tractor (see point O 1 in Figure 1), v c and a indicate the corresponding velocity and acceleration along with the vehicle's forward direction, respectively. j and v are the differential of acceleration and frontwheel steering angle, respectively. The tractor's yaw According to the velocity equal relationship between tractor and semitrailer at the hinged point. The relationship between v c and v t can be deduced as follows: v c = v x v y 0 ½ T c = ½v c cosu 1 v c sinu 1 0 T . By equation (2) and using (1) with the trigonometric identities, the sought semitrailer yaw dynamic can be converted into the following equation: As a result, v t can be expressed by the following v c -related equation: The coordinate values of the tractor contour vertexes ABCD can be calculated by the center point O 1 according to the geometric position relationship, as follows: The relationship between the rear-axle center points O 1 and O 2 of the tractor and semitrailer can be further expressed as: Similar to the tractor, the coordinate values of the semitrailer contour vertexes EFGH can be obtained from the coordinate value of the center point O 2 . The calculation equation is as follows: Constraint conditions Physical constraints. The tractor will be constrained by its own kinematic and dynamic characteristics during the parking process. Consequently, inequality constraints are defined for some state variables and control variables of the tractor-semitrailer vehicle as follows: Where v max , a max , j max , u max , v max denote the maximum velocity, the maximum acceleration, maximum change rate of acceleration, the maximum steering angle of the front wheel, and the corresponding maximum angular velocity allowed during the parking process. Du max is the maximum included angle between the tractor and the semitrailer allowed to prevent folding loss during the movement.
Collision avoidance constraints. The process of autonomous parking is actually the process in which the vehicle avoids collision near the parking space and finally enters the target parking space. In the whole parking time domain [t 0 t f ], collision not only with obstacles but also with the edge of the road should be avoided. Li 38,39 used rectangles to describe the contours of vehicles and obstacles, and the main idea of collision avoidance is that the two rectangles do not overlap. In order to limit the vehicle vertex always outside the obstacle contour or the obstacle vertex always outside the vehicle contour, an algebraic inequality based on the graphic area was used to establish the constraint. The simulation results in the literature show that this method can effectively avoid collision. However, there are errors in the actual trajectory tracking process of the vehicle chassis actuator, and the continuous accumulation of such errors may lead to collisions. Therefore, in this paper, the expansion coefficient a of the object is introduced into the algebraic inequality constraint equations proposed by Li, and the expansion coefficient a is set to be greater than 1, which means that the vehicle and the obstacle are expanded to ensure that there is enough gap between the vehicle and the obstacle to avoid collision. The constraint diagram after adding the collision avoidance idea in literature 38,39 to the expansion of vehicles and obstacles is shown in Figure 2 to make the paper coherent. Taking the following situation as an example: the tractor contour vertex A and the semitrailer contour vertex G do not collide with the obstacle parking space p 1 p 2 p 3 p 4 and the contour vertex p 4 of the obstacle parking space does not collide with the tractor ABCD and the semi-semitrailer EFGH as shown in Figure 2, the updated equation after adding the expansion coefficient a to the inequality constraint in literature 38,39 is as follows: Where a refers to the expansion coefficient of the tractor, the semitrailer, or obstacles. According to the inequality constraint of literature, 38,39 the collision avoidance constraint of the whole parking process can be updated to the equation (10) after adding the expansion coefficient a: Where, S C c , P i, 1 , P i, 2 , P i, 3 , P i, 4 ð Þand S D d , P i, 1 , P i, 2 , ð P i, 3 , P i, 4 Þ represent the sum of the triangle areas composed of the tractor contour vertex C c and the semitrailer contour vertex D d with the four contour vertices of the i-th obstacle. On the contrary, S P i, j , C 1 , C 2 , C 3 , C 4 À Á or S P i, j , D 1 , D 2 , D 3 , D 4 À Á respectively denotes the sum of the triangular areas composed of the contour vertex P i, j of the i-th obstacle with the tractor or semitrailer contour vertices. S P i , S c , and S d are the corresponding rectangular area.
In addition to meeting the above collision avoidance constraints, the vehicle should always be within the Endpoint constraints. Based on the above kinematic model and constraint conditions, the tractor-semitrailer vehicle can complete collision-free parking from the start time t 0 to the end time t f . At moments t 0 and t f , the tractor-semitrailer vehicle is considered to be in a static state, and the steering angle of the front wheel is zero. The center point O 1 of the rear-axle of the tractor is at the specified position at the time t 0 , and both the tractor and semitrailer heading angles are zero. At time t f , all vertices of the tractor-semitrailer vehicle shall be in the parking space. However, the heading angle at the parking completion time needs to be based on whether it is a vertical parking condition or a parallel parking condition. The former is p 2 , and the latter is 0. Endpoint constraints can be summarized as follows: Where L P indicates the length of the parking space along the road, w p refers to the length of the parking space along the Y-axis. In inequality (11), a minus sign is added before w p , mainly because the parking space is placed below the x-axis of the coordinate system, as shown in Figure 3. If the parking space is sufficient, the heading angle is allowed to deviate from the target heading angle to a certain extent.

Description of autonomous parking problem of the tractor-semitrailer vehicle
Without losing generality, the Bolza problem of nonlinear optimal control includes the following aspects: The differential equation of system dynamics is: The path constraints are: Boundary constraints are: The objective function is: Where: x and m are the state variables and control variables of the control system respectively, and satisfy the following conditions: x t ð Þ 2 R n , m t ð Þ 2 R m . min c is the objective function of the optimal control problem. The state variable x t ð Þ is continuously differentiable in the time domain [t 0 , t f ]. However, the control variable m t ð Þ can be discontinuous in the time domain [t 0 , t f ]. c 1 and c 2 are inequality path constraints and equality path constraints respectively. The objective function can be formulated according to the actual demand of the controlled system. In a controlled system whose initial state and termination state has been determined, the objective function is usually set to an optimal time or minimum energy consumption.
Autonomous parking technology is to help drivers improve parking efficiency, reduce road occupation time, and avoid traffic congestion on the premise of absolute safety. Hence, the shortest autonomous parking time is set as the objective function of the optimal control problem in this paper, that is, min (t f À t 0 ). Comprehensively considering the equations (1), (8), (10), (11) the nonlinear optimal control problem of autonomous parking optimal trajectory planning can be described as: Piecewise GPM for solution GPM can transform the above optimal control problem into a nonlinear programming problem through variable discretization, and then solve it by numerical optimization method. The advantages of GPM such as being insensitive to initial values, high accuracy, and fast convergence make it very suitable for the solution of trajectory planning. However, due to extremely narrow parking environments relative to the larger body size of the tractor-semitrailer vehicle, more contour vertex than that of an ordinary vehicle, and complex constraints, the traditional GPM often has the phenomenon of non-convergence or slow convergence rate in the solution of parking trajectory. Piecewise GPM is proposed to solve the above-mentioned problems. The algorithm is derived as follows: Time-domain transformation. The time-domain of the optimal control problem of trajectory planning is t 2 t 0 , t f Â Ã . The first premise of Piecewise GPM is to divide the time domain into p subintervals, that is 0 = t 0 \t 1 \ Á Á Á t q \ Á Á Á \t pÀ1 \t p = t f . Hence, the step length of each time domain t p ð Þ is: Since the interval of discrete points selected in the GPM is t 2 À1, 1 ½ , the subintervals need to be transformed in the time domain, that is, the variable t is converted to t as follows: After transformation, the Bolza problem of each subinterval is transformed into a standard objective function problem, which is described as follows: s:t: Where x q ð Þ and m q ð Þ are the state variables and control variables to be optimized in each time domain t q ð Þ respectively.
Discretization of variables. The control variables and state variables in GPM need to be discretized at the position of the configuration points. Then the Lagrange interpolation function is constructed based on the configuration points to approximate the original function. In the interval t 0 , t f Â Ã the zero point of Legendre polynomial of order N is set as the configuration points, and its polynomial is: After discretization, the state variables can form N + 1 variables. Using N + 1 Lagrange polynomial as the basis function to approximate the original variable, the state variables can be expressed as: The basic function of the Lagrange polynomial in equation (23) is: However, the control variables can be approximated by N Lagrange polynomials as basis functions. After approximation, the control variable and the corresponding basis function of the Lagrange polynomial can be expressed as: Constraints and objective function transformation. GPM can convert differential equation constraints into algebraic constraints. The derivative of the state variable at t = t k can be obtained by deriving from equation (24), which can be approximately expressed as: Combined with equations (22) and (28), the algebraic constraints of the kinematic equation can be obtained as follows: The path constraints and boundary constraints after discretization in each time domain are expressed as: In addition, the objective function can be approximately transformed into the following equation by Gauss integration: Where e k is the Gaussian integral weight coefficient. The above is the theoretical basis of the piecewise GPM. By transforming the Bolza optimal control problem into a standard NLP problem, it provides the feasibility for solving the optimal trajectory.
The piecewise GPM in autonomous parking of the tractorsemitrailer vehicle. Compared with the single vehicle parking, the parking process of the tractor-semitrailer has the following characteristics: the addition of semitrailer leads to a longer overall vehicle body, the more contours, and the more calculation of the trajectory solution. The kinematic constraint between the tractor and semitrailer, and the collision avoidance constraints of the semitrailer make the constraints more complicated. The traditional Gauss pseudospectral method for solving the parking trajectory may not converge or converge slowly. Li et al., 36,37 divided the automatic parking process of a single vehicle into two stages for extremely small parking space conditions, and used the interior point method to solve the optimal trajectory in each stage. The simulation results show that the method can effectively improve the success rate and efficiency of the solution. Referring to the division of single car parking area in different stages in the literature, 36,37 this paper divides the autonomous parking process of a tractor-semitrailer into two stages according to the parking area. At each stage, the pseudo spectral method is used to solve the optimal collision-free trajectory with the goal of minimizing the parking time. Corresponding endpoint constraints need to be added at the boundary between the two stages to maintain continuity in the values of vehicle state variables and control variables. The advantage of the segmented solution is that the one-time solution of the original complex whole parking trajectory can be divided into two stages of relatively simple parking trajectory solution. The reason is that the collision avoidance constraint and the endpoint constraint are simplified in the process of piecewise solution, so as to improve the success rate and convergence efficiency of the trajectory solution of the autonomous parking of the tractor-semitrailer. The first stage is the movement of the vehicle from the initial position to the vicinity of the parking space, while the vehicle position and heading angle will be adjusted to facilitate further entry into the parking space. During this phase, the vehicle runs longitudinally without boundary constraints, so the driving area of the vehicle corresponding to this stage is called the free motion region. At the end of this stage, part of the semitrailer body may has entered the parking space. The second stage is that the vehicle moves until the vehicle body is fully into the parking space and the heading angle reaches the target attitude. At this stage, the vehicle has a range limit in the longitudinal direction and strictly meets the collision avoidance constraints during the movement. Therefore, the vehicle needs to continuously adjust its position and attitude to meet the final goal, and the corresponding allowable driving area is called the adjustment region. Two parking phases correspond to two parking areas, as shown in Figure 4.
The state variables at the junction of the two stages shall be further constrained to ensure its continuity. At the same time, the position of the contour vertices of the tractor and semitrailer also shall be constrained according to the parking area. The constraint equations are as follows: Tractor : Semitrailer : The pseudo-code of the piecewise GPM to solve the autonomous parking of the tractor-semitrailer vehicle is shown in the Table 1 below:

Simulation and validation
According to the autonomous parking kinematics model of the tractor-semitrailer vehicle, the trajectory solving program based on piecewise GPM was written on the Matlab platform. Taking an actual tractorsemitrailer vehicle as the simulation object, the tractorsemitrailer vehicle parameters and physical constraints are shown in Table 2.

The simulation of the vertical parking condition
Three vertical parking spaces with different widths are designed to verify the robustness and universal applicability of the piecewise GPM. The width of parking space is 3.14, 3.90, and 4.68 m, respectively, that is, 1.2, 1.5, and 1.8 times the vehicle width. The length of the parking space under three working conditions is 16 m. The rear-axle center point of the tractor is regarded as the observation point of the parking process and the initial state is set to x 0 = 20, y 0 = 4:5, which is  As can be seen from Figure 5 and the partially enlarged figure, in the case of three parking spaces, there is no collision between the vehicle and the road boundary, or between the vehicle and the obstacles during the parking process. There is no in situ steering under the three parking conditions. The heading angle of the vehicle at the beginning and completion time of parking meets the constraints. When the width of the Maximum included angle between the tractor and the semitrailer 1.48 rad  Figure 6. Continued parking space is 1.8 times that of the vehicle, the vehicle can complete the parking process with one reverse, as the curve of the rear-axle center is shown in Figure 5(a).
In the parking space, the vehicle makes a small adjustment in the left and right directions, so that the termination position is in the center of the parking space, and the total time is 19.59 s. When the width of the parking space is reduced to 3.90 m, the vehicle completes parking by adjusting the body posture before entering the parking space through a forwardbackward maneuver. The sign of velocity in Figure 6(b) changes once, which is consistent with the maneuver, and the total time is 26.62 s. When the width of the parking space is only 3.14 m, the vehicle completes parking after fine-tuning the body attitude through 13 times of forward-backward maneuvers, and the total time is 139.93 s. With the gradual reduction of the width of the parking space, the vehicle completes the attitude adjustment by increasing the number of forwardbackward maneuvers, and finally parks into the parking space, which is consistent with the actual situation of manned driving. However, the parking time increases accordingly. It can be seen in Figure 6 that the planning results of state parameters and control parameters are strictly limited in the constraint range of Table 2, which indicates that GPM strictly implements the constraints in the solution process.

The simulation of the parallel parking condition
Similar to the vertical condition, the length of parking spaces is set to 1.2 times, 1.5 times, and 1.8 times the total length of the tractor-semitrailer vehicle respectively in parallel parking conditions, that is, 25.58, 21.32, and 17.10 m. The width of the parking space is 3.5 m, and the road width is also 3.5 m according to relevant legal standards. The initial position is set to x 0 = 40, y 0 = 1:75. The simulation results are shown in Figures 7 and 8. The completion time of parking under the three parallel conditions is 24.31, 37.17, and 148.87 s. When the length of the parking space is large and medium, the vehicle stops in the center of the parking space through a forward-backward maneuver. As can be seen from Figure 7(a) and (b), the signs of speed have changed once, as shown in Figure 8(a) and (b). However, when the length of parking spaces becomes extremely small, the vehicle also adjusts its posture through a large number of forward-backward maneuvers for collision-free and finally stops in the center of the parking space. With the decrease in parking space length, the number of forward-backward maneuvers and parking time increase.
The vertexes of the vehicle contour in the planning result diagram seem to be in contact with the edge of (c) the parking space or the road boundary, but in fact, the vehicle and the obstacle have been expanded, so there is enough distance between them to ensure no collision, and the value of the safety distance can be adjusted by the expansion coefficient a in equation (10). In the algorithm, the vehicle is required to be in the center of the parking space as far as possible when parking is completed, which has made it convenient for passengers to get up and down and the movement of adjacent vehicles, and at the same time, and make the vehicle itself have enough maneuvering space when leaving the parking space. The GPM method can be successfully and effectively applied to the trajectory solution of autonomous parking of tractor-semitrailer vehicle. Meanwhile, the advantages of the piecewise GPM method in the convergence success rate, CPU calculation time, and optimal goal can be demonstrated through comparative analysis. The comparison results of the two methods are shown in Figures 9 and 10. When the parking space is large or medium, both methods can converge. The difference is that the piecewise GPM can obtain a shorter parking completion time. However, when the length or width of the parking space is extremely small, the traditional GPM fails to converge, and the piecewise GPM can still converge. Piecewise GPM is superior in terms of calculation time. With the increase in parking space width, the vertical parking time of piecewise GPM is 51.36% and 41.13% of the traditional GPM. With the increase in parking space length, the parallel parking time of piecewise GPM is 48.40% and 39.27% of the traditional GPM. This is mainly because the number of constraints in the divided parking area is reduced by the piecewise GPM to improve the convergence rate.
A numerical animation demonstration video of the planned trajectory can be obtained at the following website: https://www.bilibili.com/video/BV1aS4y1Y7fY/.

Conclusions
In this paper, an autonomous parking trajectory planning method using piecewise GPM in different parking areas for the tractor-semitrailer vehicle is proposed. By establishing the tractor-semitrailer vehicle kinematics model, physical constraints, endpoint constraints, and obstacle avoidance, the parking trajectory planning problem are transformed into an optimal control problem. Taking the shortest parking completion time as the optimal objective function, the reasonable initial value of the problem is obtained by the solution without constraints. The constraints are reset according to different parking areas, and the final trajectory is obtained by a faster convergence rate.  The vertical parking conditions of three parking spaces with different widths and the parallel parking conditions of three parking spaces with different lengths are selected for trajectory planning simulation. The results show that the obtained trajectory meets the constraints in the process of autonomous parking. Compared with the traditional GPM, the proposed method has a faster convergence speed.