#### Abstract

The existing automatic parking algorithms often neglect the unknown obstacles in the parking environment, which causes a hidden danger to the safety of the automatic parking system. Therefore, this paper proposes parking space detection and path planning based on the VIDAR method (vision-IMU-based detection and range method) to solve the problem. In the parking space detection stage, the generalized obstacles are detected based on VIDAR to determine the obstacle areas, and then parking lines are detected by the Hough transform to determine the empty parking space. Compared with the parking detection method based on YOLO v5, the experimental results demonstrate that the proposed method has higher accuracy in complex parking environments with unknown obstacles. In the path planning stage, the path optimization algorithm of the algorithm combined with the Bezier curve is used to generate smooth curves, and the environmental information is updated in real time based on VIDAR. The simulation results show that the method can make the vehicle efficiently avoid the obstacles and generate a smooth path in a dynamic parking environment, which can well meet the safety and stationarity of the parking requirements.

#### 1. Introduction

The increasing number of vehicles leads to increasingly serious parking problems in modern cities. It is a quite challenging task for drivers to park their cars in a limited space. Therefore, the research of automatic parking systems has become a hot issue in the field of intelligent transportation. Parking space detection and path planning are the key technologies to realize automatic parking.

Parking space detection is the primary task of the automatic parking system. With the development of image technology and the improvement of sensor accuracy, vision-based automatic parking system has gradually become the main trend for automatic parking system due to its low cost and high detection speed and accuracy. Various visual-based parking technologies have been proposed in recent years. Wang et al. [1] used four fisheye cameras to construct a real-time visual automatic parking system surrounding the car body and used the Radon transform to extract the parking space features and detect the parking space. Suhr and Jung [2] proposed a monocular vision-based parking space marker recognition algorithm that used the peak value pair to perform line segment detection and cluster identification of marker lines in Hough space. This method could still effectively detect the parking space under the condition that the adjacent vehicles seriously blocked the parking space marker. The above-mentioned algorithms are not suitable for complex parking space; the accuracy of these algorithms is significantly affected by the transformation parameters. In recent years, target detection methods based on machine learning have been widely applied to parking space detection due to their high accuracy and speed in target recognition [3–5]. Xu and Hu [6] used the image collected by the four-way fisheye camera mounted on the car as input and adopted the YOLO (you only look once) v3 network structure to directly detect the parking space in the image. The algorithm has high recall and precision and can realize real-time detection. Kirtibhai Patel and Meduri [7] presented a Faster R-CNN-based object detection scheme to automatically map the parking space in a parking lot, instead of manually mapping them. The results show that the method decreases the human effort needed by up to a compelling 86%. Vu and Huang [8] proposed a multitask convolutional neural network with spatial transform for parking space detection. This method crops the local image area adaptively by integrating a convolutional spatial transformer network (STN) and considers the status estimation by designing a multitask loss function, which can reduce the error detection rate. The machine learning method has high detection speed and accuracy for known obstacles such as vehicles, but the misdetection rate of parking space detection is high for parking environment with unknown obstacles. Particularly in some unmanaged open-air parking spaces with obstacles such as stones, garbage boxes, and traffic cones, the accuracy of parking detection algorithm based on machine learning method will be significantly affected. VIDAR [9] is a visual-IMU-based detection and ranging method. The IMU (inertial measurement unit) is used to obtain the moving distance and attitude of the camera, and the height of the object in the image can be calculated through reverse perspective transformation. This method can detect various types of obstacles in the parking environment, and the change of external parking environment factors does not significantly influence the accuracy of parking space detection. In order to improve the accuracy of parking space detection, VIDAR is applied to parking space detection in this paper.

In addition to parking space detection technology, path planning is also a key technology to realize automatic parking of intelligent vehicles. The purpose of path planning is to find a feasible and safe path from the current state to the target state. The existing path planning algorithms applied to the automatic parking systems are mainly divided into two types: geometric methods and graph methods. The geometric method considers the minimum turning radius under the geometric constraints of the environment and solves the problem by combining geometric primitives, such as straight lines, circles, and spirals [10–14]. However, most of the studies that applied geometric methods to the automatic parking system did not consider the limitations of parking spaces, which did not work well in a narrow space environment. For the limited parking space environment, Yang et al. [15] and Maekawa et al. [16] generated a smooth parking track by reducing the turning radius and smoothing the path. Li et al. [17] used the preview algorithm to detect the curvature outliers in parking paths to solve the problem of planned curvature discontinuity between straight lines and arcs. The above-mentioned methods are simple but can only be operated under predefined conditions. In addition, these methods only targeted one or two of the three traditional parking spaces, lacking generality and complicated real-time calculation.

The graph-searching algorithm applied to the automatic parking system is developed from the existing robot path planning algorithm. The graph-searching methods include Hybrid- or RRT [18–20]. These methods first construct a graph from the environment and then find an optimal path in the graph. These methods apply vehicle kinematics constraints based on the existing path planning methods of mobile robots. The most common planning methods for mobile robots are the traditional grid method based on the heuristic genetic algorithm, the artificial potential field method [21–23], and the algorithm based on node search [24]. All these methods have a strong ability of path finding and strong adaptability of path planning in various complex parking environments. However, in the field of automatic parking, these methods need to consider vehicle kinematics constraints. Dolgov et al. [25] proposed a vehicle kinematics algorithm (Hybrid-) that was applied in DARPA’s Urban Challenge. Zheng and Liu [18] adopted the RRT algorithm to search the parking path of vehicles with constraints. Target preference and double RRT strategies were used to optimize the algorithm, which improved the path search efficiency. However, the path generated by this method is not smooth, and the path quality is often poor. In order to solve the above problem, Zhang et al. [26] designed a smooth parking path planning method under irregular and narrow conditions based on the Hybrid- algorithm and the OBCA algorithm. However, the above planning methods do not consider the changes in the parking environment. Thus, it is difficult to apply these methods to the actual parking scene because the path cannot be adjusted during the parking process.

To improve the practicability of path planning algorithm, Shen et al. [27] adopted the dynamic window method based on the improved algorithm and combined the dynamic characteristics of intelligent vehicles to conduct local obstacle avoidance and path planning for vehicles in view of the unknown and changing environmental information around the vehicles. As explained so far, the application of machine learning methods in automatic parking systems has the defect of missing the detection of generalized obstacles. Parking paths and detecting parking spaces may encounter obstacles. In addition, the path planning by the geometric method is only for one or two of the three traditional parking spaces, which lacks generality and complicated real-time calculation. In this paper, the VIDAR method is used to detect the generalized obstacles, and the Hough method is used to complete parking space detection. Combined with the algorithm and the Bezier method, a smooth trajectory in line with vehicle motion constraints can be generated in various complex parking environments. In the process of automatic parking, VIDAR is used to update the environmental information in real time to achieve dynamic planning and improve the reliability and safety of planned paths. This method has universality in various complex parking environments.

The remainder of this paper is organized as follows. Section 2 focuses on the process of parking space detection based on VIDAR. In Section 3, we introduce the formation of the path, which is generated from the algorithm combined with the Bezier curve. In Section 4, experimental results of parking space detection and the simulation results of path planning are given. In Section 5, we draw the conclusion of the algorithm in this paper.

#### 2. Parking Space Detection Based on VIDAR

VIDAR is used to detect generalized obstacles in complex parking space environment, which can effectively improve the accuracy of parking space detection. Parking space detection based on VIDAR mainly includes three parts: obstacle detection based on VIDAR, obstacle extraction, and parking space detection.

##### 2.1. Obstacle Detection Based on VIDAR

In a machine vision system, the pinhole imaging model (see Figure 1) is often used to determine the mathematical relationship between the object point and the imaging point of the object in the world coordinate system. The corresponding coordinate of the intersection point of the obstacle and the road plane in the imaging plane coordinate system is . The coordinate origin of the plane coordinate system is , which is the intersection point between the image plane and the optical axis of the camera. The effective focal length of the camera is *f*, the installation height of the camera is *h*, the pixel size of the camera is *μ*, and the pitch angle of the camera is .

The horizontal distance *d* between the object point and the camera can be obtained by

The obstacle detection method based on VIDAR is consistent with the principle of the camera ranging model, which is based on the further analysis of the height difference between object points belonging to 3D obstacles and road plane when the monocular camera moves. The obstacle detection method based on VIDAR collects two adjacent frames of images when the monocular camera is moving and uses the height difference between the obstacle points and the ground points to screen the obstacles. The imaging schematic diagram of the static obstacle is shown in Figure 2. Assume that the imaging point of the first obstacle on the imaging plane is *A*. Due to the movement of the camera, the axis on the imaging plane moves from the axial direction, the imaging point of the obstacle after moving is *B*, and *A*′ and *B*′ are, respectively, the road plane points corresponding to points *A* and *B*. The distance index of feature points on a horizontal plane is , and the horizontal distance from the camera to *A*′ and *B*′ is *d*_{1} and *d*_{2}. *d*_{1} and *d*_{2} can be calculated by

It can be seen from Figure 2 that if object points belong to ground points with no height, the relationship between *d*_{1} and *d*_{2} is . If the object point belongs to 3D obstacle with height, the relationship between *d*_{1} and *d*_{2} is . Therefore, can be used to determine whether the object point belongs to obstacle or not. The judgment method of feature points is as follows: if , the object point belongs to the 3D obstacle; if , the object point does not belong to 3D obstacle. Since can be calculated by using IMU to obtain camera attitude data, VIDAR can quickly accurately and quickly detect obstacles.

##### 2.2. Obstacle Extraction

The MSER (Maximally Stable External Regions) algorithm is widely used in image registration and region matching. In this paper, the feature points are extracted using the image region matching method based on MSER [28]. The method based on VIDAR is used to remove the nonobstacle points with no height from the feature points. Thus, the obstacles in the images can be detected quickly.

VIDAR is used to screen the matching points of two adjacent frames in the automatic parking movement, and the set of obstacles after screening is *C*, . The matched images after screening are shown in Figure 3.

In order to determine the space where the obstacle is in the image, the *K*-means clustering algorithm is used to perform clustering analysis for the coordinate data set *C*, which is composed of *n* obstacle matching points.

Cluster the obstacle point in the data set and , respectively, represent *K* clustering centres. *K*-means clustering algorithm is shown as follows [29]: Step 1: initialize and select *K* objects as the centre of the initial cluster. Step 2: calculate the Euclidean distance between the data and the clustering centre by formula (3), and divide the data with a close distance into one category: Step 3: recalculate the seed centre of this class by Step 4: traverse all obstacle point data and repeat step 2 and step 3 until the seed centre no longer changes.

The *K* value can be better determined by plotting the *K*-SSE curve and by finding the inflection point down. The elbow method was used to determine the selection of *K* value in the *K*-means algorithm, and the SSE value can be calculated by formula (5) to obtain the *K*-SSE curve [30]. According to the K-SSE curve analysis (see Figure 4(a)), there is a very obvious inflection point when . It can be seen that when , the data set clustering effect is the best. It is determined that is the optimal *K* value for clustering. According to the optimal *K* value of *K*-SSE curve clustering, the clustering results of obstacle points in the parking space are obtained (see Figure 4(b)).

**(a)**

**(b)**

Reasonable expansion is made according to the position of the obstacle points around the edges of each *K*-means cluster. The yellow rectangular region is used to frame and divide the clustering region of each obstacle point (see Figure 5).

The clustering regions taken by yellow rectangles in Figure 5 are denoted as *O*, and the remaining area is the nonobstacle area, denoted as *F*.

##### 2.3. Parking Space Detection

Hough transform method [31], the most mature straight line detection method, is used to detect the parking line in the nonobstacle area *F*. The basic idea of the Hough transform is to measure space point into a parameter space curve. The points with the same parameter characteristics intersect in the parameter space after transformation, and the characteristic curve is detected by judging the degree of accumulation at the intersection points. Its duality formula iswhere is the distance between the origin to the line closest point and is the angle between the *x*-axis and the line connecting the origin with that closest point.

Obstacles are extracted according to the above section, and Hough detection is carried out in nonobstacle areas. The detection edge line segments in the obstacle areas are removed adaptively to reduce the pixels involved in the transformation and the influence of the background interference line segment.

In the real world, due to illumination, unexpected occlusion and blurring of the parking line, and other factors, Hough transform usually cannot detect a complete line, but many line segments. In order to remove the noise interference of the detection of parking lines, we set up a library of linear equations by inherent characteristics of parking lines. The expression of the equation in the library is . The linear equation of each line segment is calculated by the coordinate of two endpoints of the line segment. Any edge line is taken as the reference line to judge the equation with the others. If the equation of two lines is approximately the same, the two lines are judged as a parking line. All parking lines can be determined until all detected edge lines are judged.

The line with the same equation is regarded as the same line, and the line is appropriately extended to obtain parking lines (see Figure 6(a)). According to the fixed characteristics of parking lines, four adjacent parking lines satisfying the conditions of parking lines are extracted as parking mark lines. The intersection points of the four extracted parking lines are taken as the four corners of the parking space, and the line segments connected by adjacent corners are taken as the parking lines. Four parking lines can be, respectively, expressed as *C*_{1}, *C*_{2}, *T*_{1}, and *T*_{2} (see Figure 6(b)).

**(a)**

**(b)**

Record the parking space composed of parking lines *C*_{1}, *C*_{2}, *T*_{1}, and *T*_{2} as *P*_{free}. The length of parking lines and the parking space *P*_{free} surrounded by four parking lines need to satisfy the following conditions where is the threshold value of the length of the parking line and *O* for every obstacle clustering regions.

According to the detection results in Figures 5 and 6, the information of parking spaces and obstacles in the parking area can be obtained to realize the detection of empty parking space. Parking detection results are shown in Figure 7.

#### 3. Path Planning

The planned path is composed of two partial paths. One is the constraint path planned by algorithm, and the other is the reverse path designed by parking space information.

##### 3.1. Vehicle Constraints

The planned path is composed of two partial paths. One is the constraint path planned by algorithm, and the other is the reverse path designed by parking space information.

In automatic parking, kinematics and dynamics constraints should be considered in the study of vehicle movement. The parking space can be simplified due to the vehicle’s low speed and small tire slippage, and the actual kinematics model can be carried out by combining the vehicle model parameters. The kinematics model of the vehicle can be simplified to a pure rolling, which is called a nonholonomic constraint model. The vehicle shape is simplified into a rectangle. The kinematics model of the vehicle is shown in Figure 8.

From Figure 8, we can get the following relationship:where is the coordinate of the centre point of the rear wheel axle of the vehicle; is the longitudinal velocity of the centre point of the front axle, and *a* is the acceleration; we define as the steering angle of the centre point of the front axle of the vehicle (the angle between front wheel direction and body direction); *θ* is the included angle between the centre axis of the vehicle and the horizontal direction; *L* is the front and rear wheel wheelbase; *L*_{P} is the distance between the front axle and the front end of the vehicle; *L*_{r} is the distance between the rear axle and the rear end of the vehicle; is the width of the vehicle; *R* is the connection between vehicle instantaneous centre *C* and rear wheel axle.

It can be known from formula (8) that when the value of the current wheel angle is the maximum, the steering radius *R* of the vehicle at this time is the minimum, . In plane coordinates, the path curve can be expressed as , and its curvature formula can be obtained as follows:where *k*_{max} is the maximum curvature of the curve and the constraint relationship between the curvature *k* of the curve path planning and the minimum steering radius *R*_{min} is

##### 3.2. Set Transition Target Point

In order to make full use of the known information, in the whole parking process of the car, the position information of the parking space can generally be obtained by the external sensor (see Section 2.3). The way of reverse path can be used to plan the last section of the automatic parking back into the storage path and set the intermediate transition target point .

Parallel, vertical, and tilted parking spaces are the most common parking spaces. This paper considers the three most common parking spaces as research scenarios. Assume that the vehicle has been parked in the parking space. The coordinate points at the position 0.75 of the long axis of the parking line and the middle position of the short axis are taken as the final parking point , which corresponds to the coordinates of the centre point of the rear axis in the vehicle kinematics model. is the other endpoint of the reverse path, which is the target point based on algorithm. Three parking path models are as follows.

As shown in Figure 9, the three kinds of automatic parking reverse paths are all composed of straight lines and arcs. The relative position relationship between and on the reverse path can be deduced and determined by the basic path method in literature [26]. When the vehicle exits from the parallel parking space (see Figure 9(a)), it will first move a distance of *d*_{p} along the long axis parking line and then move to by two arcs with continuous curvature. The radius of the first arc is *R*_{1} and the arc angle is *θ*_{1}; the radius of the second arc is *R*_{2} and the arc angle is *θ*_{2}. When the vehicle exits from the vertical parking space (see Figure 9(b)), it will first move along the long axis parking line for a distance and then move to the target point through an arc path with a radius of *R*_{3} and an arc angle of *θ*_{3}. When the vehicle exits from the tilted parking space (see Figure 9(c)), it will first move along the long axis parking line for a certain distance and then move to the target point through an arc path with a radius of *R*_{4} and an arc angle of *θ*_{4}.

**(a)**

**(b)**

**(c)**

Through the reverse path of the above three kinds of parking spaces and combining with the location information of the target parking space extracted in Section 2.3, the appropriate target point position under the three kinds of parking spaces can be calculated. Automatic parking can be finished directly without adjusting parking posture by designing reversed driving-out paths, the path is smoother, and the safety margin is larger than the method by algorithm.

##### 3.3. Path Planning Based on Algorithm

###### 3.3.1. Algorithm

The algorithm is one of the most classical robot path tracking methods. It is more convenient to impose vehicle motion constraints based on algorithm planning, making it easier to meet vehicle kinematics constraints [18, 27, 28]. The algorithm is used to generate the planned path in the process of automatic parking of ego vehicles. The algorithm is a heuristic search algorithm, which is the most effective method to find the shortest path in the static network. The process of algorithm is as follows.

Set the starting point as the initial node and the intermediate transition target point (see Section 3.2) set above as the target node. The evaluation function is used to generate a global optimal path. Each time, the node with the smallest value of the evaluation function is selected, and the destination point to be reached is found through the algorithm. Finally, the global optimal path from the initial position to the target position is generated. The cost estimation function of algorithm iswhere is the total cost estimation function from the initial node to the target node, is the actual cost from the initial node to the current node *n* in the state space, and is the optimal cost estimation of the path from the current node to the target node.

To ensure the safety of the automatic parking process, the method of obstacle edge expansion is adopted to avoid the collision between the outer edge of the vehicle and the obstacle. The expanded distance should be larger than half of the width of the vehicle, and a certain safe distance *da* should be reserved to avoid the planned path clinging to obstacles. The maximum expansion of distance of obstacles is (see Figure 10).

As shown in Figure 11, the planned path based on algorithm avoids the danger of collision with surrounding obstacles by means of obstacle extension. The initial path generated is *I*_{1}.

###### 3.3.2. Path Optimization

The initial path *I*_{1} obtained by algorithm is composed of multiple straight line segments. The path has too many abrupt turning points, which does not meet the requirements of vehicle kinematics. Therefore, it is necessary to optimize the path curve.

To solve the problem above, the greedy strategy is used to smooth path trajectory *I*_{1}; specific algorithm steps are as follows: connect the target point from the initial point as the starting point. If obstacles exist in the path of connection, the next turning point on the path is taken as the starting point, which is connected to the target point . Repeat the above operation until the path of connection between the point and the target point does not pass through obstacles. Make ; that is, the point is regarded as the target point; repeat the above operation until the initial starting point is connected with the target point . The path *I*_{2} optimized by the greedy strategy is as follows (see Figure 12). The blue line represents the initial path *I*_{1}, and the red line represents the planning path *I*_{2} optimized by the greedy strategy.

Then, the Bezier formula is used to smooth the planned path *I*_{2}. The Bezier curve can fit any number of control points, and the degree of the Bezier polynomial is related to the position of the control points. Nodes are evenly inserted from *P*_{0} to . *P*_{0} and of the path are seen as data points, and the necessary turning points in the planning curve are seen as control points.

Start from *P*_{0}; a node is set at every interval distance *s* between the control point and the data point. The last node of a straight path is the necessary turning point *J*_{i}, , and then starting from the necessary turning point *J*_{i}, a node is set for every fixed distance of path *s*, until it reaches to . Suppose the number of control nodes is *n*. *P*_{0} is denoted as *J*_{0}, is denoted as , and the intermediate nodes are denoted as . The node from *J*_{0} to *J*_{n} is fitted by Bezier as shown in

After inserting nodes according to the above method, all nodes are fitted by formula (13). We can obtain Bezier curve *I*_{3} with continuous curvature. As shown in Figure 13, the blue line represents planning path *I*_{2} and the green line represents smooth path *I*_{3} fitted by Bezier curves Compared with the planned path *I*_{2}, the smooth path *I*_{3} mainly changes near the key turning point, and the node positions in other straight path regions are unchanged. The node whose position remains unchanged after Bezier smoothing is taken as the new path node, and the node position set is denoted as *P*, .

###### 3.3.3. Real-Time Obstacle Avoidance Strategy

Considering that the environmental information in the actual parking environment is relatively complex and changeable, it is inevitable that unknown dynamic obstacles will appear in the movement process of the ego vehicle, which will change the environment. A real-time obstacle avoidance strategy is proposed in the parking process to realize the real-time obstacle avoidance of automatic parking. VIDAR is used to update the parking environment information. Real-time obstacle avoidance strategies are as follows. Step 1: the intelligent vehicle moves from the starting point *P*_{0} to the new node *P*_{i} at a constant speed on the planned path, and the vehicle position coordinates after the first movement are *P*_{1} Step 2: when the path moves to the new node *P*_{i}, use VIDAR to detect generalized obstacles on the path (see Section 2.1), and update the parking environment information If any feature point on the planning path satisfies , it indicates that there is no new dynamic obstacle, and it continues to move to the new node *P*_{i+1} at a constant speed along the original path If the feature points on the planning path satisfy , it indicates that there are new dynamic obstacles. Let the next node closest to the vehicle *P*_{i+1} be P0, namely, , and the coordinate position of the target point *P*_{g} remains the same. Generate a new parking path from node *P*_{0} to according to the path planning smoothing method (see Section 3.3.2) Continue moving at constant speed to the target point on the new planning path. Step 3: until , it indicates that the vehicle has reached the target point according to the planned path and parking stops

##### 3.4. Integrated Planning

Two monocular cameras installed on the front and rear cover in the centre of the ego vehicle are used to collect environmental information. The front-end monocular camera is used for the path planned by algorithm to obtain the images, and the camera on the trunk cover is used for the final reversed path to obtain the images. The overall process of parking detection and path planning based on VIDAR is shown in Figure 14.

The overall steps of parking space detection and path planning based on VIDAR are as follows:(1)Zhang Zhengyou’s camera calibration method is used to obtain the camera parameters fixed on the detection vehicle, and the camera and IMU are used to carry out image acquisition and inertial data acquisition, respectively, during the parking movement to complete the update of camera parameters.(2)The obstacle points are detected by VIDAR, and the data set *C* composed of the obstacle points is clustered by the *K*-means clustering method. Each cluster region is denoted as the obstacle region *O*, and other regions are denoted as the nonobstacle region *F*.(3)In the nonobstacle area *F*, the improved Hough transform method is used to detect the parking space, and the detected parking space *P*_{free} satisfies the condition: .(4)Based on the detected target parking space, the exit path is simulated as the parking path, and the parking trajectory can be inversed to determine in the parking area, and the appropriate intermediate target point is set.(5)The starting point is taken as the initial node, and is taken as the target node. algorithm is used to carry out path planning between the two nodes and then smooth the planned path.(6)When the vehicle is parking along the planned path at a constant speed , the parking environment information is updated in real time. The vehicle moved to by using the real-time obstacle avoidance strategy (see Section 3.3.3).(7)After arriving at the point , the vehicle moves to the point along the backward path of step (4) and finally completes the automatic parking.

#### 4. Experiments and Evaluation

This section aims to verify the effectiveness of the method proposed in this paper. Firstly, the experimental platform of this paper is introduced. Secondly, in the parking detection stage, the target detection results of the proposed method are compared with the results of the YOLO v5 method, highlighting the important role of VIDAR in effectively reducing the rate of missed parking detection and improving the accuracy of parking detection. Finally, the reliability of the improved path planning algorithm based on the algorithm is verified by simulation. The simulation results show that the proposed method can generate smooth paths in different parking spaces.

##### 4.1. Experimental Vehicle Platform Construction

The algorithm proposed in this paper is developed and tested on the experimental platform (see Figure 15). The experimental platform takes a pure electric vehicle as the main body, which is also equipped with experimental equipment such as camera, IMU, electronic power steering gear, and laptop. Path simulation experiments are generated by using MATLAB. The geometry of the pure electric is known, vehicle length , vehicle width , and wheelbase . The monocular camera fixed in the centre of the front of the ego vehicle is used to collect the image of the parking environment. The mounting height of the camera is 0.715 m, and the camera pitch angle is 0 degrees. In the stage of camera calibration, Zhang Zhengyou’s camera calibration method is used to obtain the relevant parameters of camera. IMU, as vehicle information acquisition equipment, can collect the information of the motion state of the ego vehicle. As a processor, the laptop can deal with the output signal of each sensor in real time and decide the subsequent movement of the vehicle.

##### 4.2. Parking Space Detection Accuracy Analysis

YOLO series is representative of the target recognition framework based on artificial intelligence deep learning technology. YOLO v5 is the most superior machine learning approach that has been widely used in current parking space recognition due to its high accuracy and speed in target recognition. The parking environment of the experiment was recorded using the Da Ying camera, and the camera attitude data was recorded by HEC295 IMU. The image data and the camera attitude data were processed by the obstacle detection methods of YOLO v5 and VIDAR.

In the real world, some parking spaces may have some nonstandard phenomena; for example, underground parking spaces may have debris (cardboard boxes, traffic cones, etc.) and accumulation phenomena. The outdoor parking spaces may have a parking space phenomenon, and parking spaces are occupied by chairs, stones, and other unknown obstacles. These conditions will affect the accuracy of parking space detection; especially, the obstacle detection method based on machine learning cannot detect positional obstacles. Four images of parking spaces occupied by unknown obstacles were selected, and obstacles were detected using YOLO v5 and the proposed method. The results are shown in Figure 16.

**(a)**

**(b)**

**(c)**

**(d)**

In this paper, the experiments were carried out in underground and open parking spaces. After three weeks of experiments, 872 experimental images of parking spaces were collected. YOLO v5 and the proposed VIDAR-based parking detection methods were used to detect the parking spaces in each collected parking image. Under the same experimental conditions, the detection results of the two methods are compared. Accuracy and recall rate were used as quantitative indexes. The precision *P* and the recall rate *R* can be obtained aswhere TP represents the number of samples that correctly detect empty parking space; FP represents the number of samples wrongly detected as empty parking spaces; FN represents the number of samples that are actually empty parking spaces but wrongly detected as nonempty parking spaces.

Under the same experimental conditions, YOLO v5 and VIDAR parking detection methods are used for the comparative experiment of parking detection. Figures 17(a) and 17(b) show the obstacle detection results based on YOLO v5 and VIDAR, respectively, while Figures 17(c) and 17(d) show the parking detection results based on Hough transform.

**(a)**

**(b)**

**(c)**

**(d)**

It can be seen from Figures 17(a) and 17(c) that the result of the parking space by YOLO v5 is incorrect and the parking space with unknown obstacles is identified as empty. YOLO v5 can accurately detect known types of obstacles. Cartons are unknown target types in the training dataset of YOLO v5. Therefore, the method based on YOLO v5 cannot detect cartons as obstacles. In the case of unknown obstacles (carton, traffic marker, etc.) in the parking space, the accuracy of the parking detection method based on YOLO v5 is significantly affected. Figures 17(b) and 17(d) show that the method proposed in this paper can directly and accurately detect all generalized obstacles. Compared with the YOLO v5 method, the proposed method can effectively reduce the false rate of parking space detection.

From Tables 1–3, it can be seen that compared with the parking detection method based on YOLO v5, the method proposed in this paper has higher detection accuracy and recall rate, especially in the outdoor parking lot. This is because the outdoor parking lot may be unmanaged for a long time. Obstacles such as small rocks, garbage bags, traffic cones, pedestrians, and other obstacles often exist in the parking space, which greatly affects the accuracy of parking space detection methods based on YOLO. It can be seen from the above parking space experiment results that, compared with the YOLO method, the parking space detection method based on VIDAR has stronger accuracy and robustness.

##### 4.3. Path Planning Experiment

Parking experiments were conducted in a grid diagram with generalized obstacles, and the algorithm based on node search was used to plan the path. The Bezier curve can fit any number of control nodes when the generated path is smoothed by the Bezier formula (12). The optimization method of the Bezier curve is to insert a node every certain distance *s* on the generated path and finally fit all the nodes to complete the smooth optimization of the path. The set insertion distance *s* significantly impacts the smoothing result. When more nodes are inserted, the distance s between these nodes becomes shorter than before. It could further induce small deviation of the smooth path (generated by Bezier curve) from the original path, finally reducing the possibility of collision. When the distance between the nodes is too large, the smooth curve is prone to deviate from the existing straight path and collide with obstacles. When the distance between the nodes is too small, the vehicle curvature constraint formula cannot be satisfied, which will increase unnecessary calculation and overall calculation time. The node distance parameters *s* = 0.4, *s* = 0.8, and *s* = 1.5 were used to analyze the simulation results as shown in Figure 18.

**(a)**

**(b)**

**(c)**

Table 4 shows that there is a slight difference in the path generation time for node distance parameters *s* = 0.4, *s* = 0.8, and *s* = 1.5. However, the success rate of collision-free path generation is much higher when *s* = 0.4 than that when *s* = 0.8 and *s* = 1.5. Thus, *s* = 0.4 is the optimal node distance parameter.

Therefore, the path optimized by the Bezier formula (12) sets a control node at every interval distance 0.4. The simulation results of path planning of the algorithm are shown in Figure 19. The blue line segment in Figure 19(a) represents the initial trajectory generated by the algorithm, the green line segment in Figure 19(b) is the path after greedy strategy, and the red line segment in Figure 19(c) shows the path optimized by the proposed algorithm. The optimized planned trajectory eliminates the redundant abrupt turning points, can effectively avoid the obstacles, and has the advantage of smoothness that meets the kinematics requirements of the vehicle in actual motion.

**(a)**

**(b)**

**(c)**

Another advantage of the path planning algorithm in this paper is that the path planning is real-time. In this paper, VIDAR is used to directly and quickly detect generalized obstacles. In order to cope with changes in the parking environment, the VIDAR algorithm is used to update the parking environment information in real time; then, a real-time obstacle avoidance strategy is added in the process of path planning (see Section 3.3.3). In the process of driving along the predetermined trajectory, the ego vehicle can avoid obstacles in real time and replan the path after forecasting the collision situation, which can effectively reduce the occurrence of a collision. This method proposed is reliable and accurate and can generate a safe obstacle avoidance path under a dynamic environment. As shown in Figure 20, after the moving obstacle is detected (red square), the simulation results of parking paths comparison with real-time obstacle avoidance strategy are shown in (a) and (b). It can be seen that the algorithm in this paper can effectively improve the safety of automatic parking motion by adding a real-time obstacle avoidance strategy.

**(a)**

**(b)**

The proposed path planning algorithm can generate the planned path in the parking environment with generalized obstacles. The algorithm is tested in three typical parking spaces, namely, vertical parking space, parallel parking space and tilted parking space, and parking (see Figure 21). The simulation results show that the path is composed of the path planned by algorithm and the reverse path designed by parking space information. Not only can the path generated avoid the obstacles effectively, but also the path on the turning point is smooth; this method can meet the continuity of the parking requirements very well.

**(a)**

**(b)**

**(c)**

#### 5. Conclusion

In this paper, VIDAR is introduced into parking space detection to detect the generalized obstacles, which significantly reduces the missed detection of unknown obstacles and improves the accuracy of parking space detection. An improved path planning method based on the algorithm is proposed. The generated trajectory is smooth and meets the kinematic constraints of vehicles. The proposed method is suitable for various parking spaces and meets the requirements of automatic parking movement. At the same time, the parking environment information is updated by VIDAR to make the path planning real time, which ensures the reliability of path planning.

The method proposed in this paper requires a large amount of computation. Therefore, reducing the computation time and improving the efficiency of the proposed method will be the next research direction. At the same time, the automatic parking system mainly consists of three parts, including parking space detection, path planning, and tracking control. Parking detection and path planning have been introduced in detail in this paper, and the next research direction will mainly focus on tracking control function of automatic parking so as to achieve a complete automatic parking system.

#### Data Availability

No data were used to support this study.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported in part by the National Natural Science Foundation of China under Grant 51905320, the China Postdoctoral Science Foundation under Grants 2018M632696 and 2018M642684, the Shandong Key R&D Plan Project under Grant 2019GGX104066, and SDUT & Zibo City Integration Development Project under Grant 2017ZBXC133.