RRT-Parking
Official implementation for paper "Model-based Decision Making with Imagination for Autonomous Parking"
view repo
Autonomous parking technology is a key concept within autonomous driving research. This paper will propose an imaginative autonomous parking algorithm to solve issues concerned with parking. The proposed algorithm consists of three parts: an imaginative model for anticipating results before parking, an improved rapid-exploring random tree (RRT) for planning a feasible trajectory from a given start point to a parking lot, and a path smoothing module for optimizing the efficiency of parking tasks. Our algorithm is based on a real kinematic vehicle model; which makes it more suitable for algorithm application on real autonomous cars. Furthermore, due to the introduction of the imagination mechanism, the processing speed of our algorithm is ten times faster than that of traditional methods, permitting the realization of real-time planning simultaneously. In order to evaluate the algorithm's effectiveness, we have compared our algorithm with traditional RRT, within three different parking scenarios. Ultimately, results show that our algorithm is more stable than traditional RRT and performs better in terms of efficiency and quality.
READ FULL TEXT VIEW PDFOfficial implementation for paper "Model-based Decision Making with Imagination for Autonomous Parking"
Self-parking is one of the key technologies to achieve autonomous driving. The Society of Automotive Engineers (SAE) J3016 standard defines five distinct levels of vehicle automation, including the parking assist technologies. The first three are progressions of assisted parking, i.e., driver assistance, partial automation and conditional automation. The fourth level is a near-automated technology called high automation; while the last one is totally automated, which is defined as full automation. Currently, the parking capabilities of a number of vehicles on the road nowadays are among level 1 and level 2. It is commonly recognized that autonomous parking is logically the first step towards commercial applications of self-driving, with fully automated vehicles. At present we are not yet at a stage where autonomous parking is completely achievable. However, many researchers are attempting to reach this stage through continuous research. Most car manufacturers and technology companies in the automation industry are expecting fully automated vehicles to be available by 2020, with self-parking as a primary feature.
For the realization of self-parking, the parking-planning task is that, when given a parking lot, we need to find the optimal collision free trajectory, under vehicle kinematic constraints to maneuver a car into a target place. Yet, there are several difficulties involved in this task. The combination of both moving forward actions and backward in parking planning means this process is more complex than on-road planning. Sometimes moving backwards slightly can make it easier for the car to maneuver to a narrower place. However, a negative result of this action is that it could lead to a decreased human-like trajectory performance, as well as a uncomfortable passenger experience. Moreover, the turning angle of the parking trajectory is typically bigger than on-road trajectory, therefore the corridor is much more narrow, which makes the influence caused by the difference of radius between inner wheels greater when moving forward, this is the same for the outer wheels, when moving backward.
The RRT algorithm is a popular method to solve motion planning problems. It was first proposed by Steven et al. [14], and has then been applied to the parking-planning task [8]. This method constructs a tree to store some accessible places from the start point, and then it randomly grows the tree to explore the whole space until the target point is close enough to the tree. Finally, a feasible trajectory will be generated. The RRT can easily take into account and handle complex environments with obstacles.
However, there is still a long way to go between the RRT and the practical parking planning tasks. When the car gets closer to the target point, a little bit of bias reduction needs to be executed with quite a few steps. This causes the car getting close to the garage quickly but then moves forward and backward over and over again in order to adjust to a perfect position. The whole parking process with RRT takes a long time and makes the final part of the trajectory complex. Bi-RRT [13] uses tree growing from target to reduce the search time, but the final part of the trajectory is still complex. We imagine that the car is already parked in the parking lot and then we try to drive the car out of the parking lot with various pre-defined driving strategies. After the operation we will obtain dozens of feasible driving-out paths, each with twenty nodes. By reversing these driving-out paths to parking-in paths, there will be a tree with dozens of paths and hundreds of nodes. Then we expand the target point, in RRT algorithm, to this well-defined model-based target tree. Once RRT tree reaches any node of the target tree, the final trajectory will be generated. Since the model-based target tree is well defined it results in the trajectory in target tree being very smooth. The car can get into the target position in one movement. With this target expansion, the RRT tree can get close to the target, with fewer steps and less time cost. In fact, model-based planning is more than ten times quicker than traditional RRT. Our algorithm is not only better but is more stable than traditional RRT, in planning time and quality. RRT still has another drawback, that its trajectory can be extremely complex. This is because every edge of the tree is generated towards a random direction. There are some methods to smooth the trajectory, but they do not take into account the kinematic constraints of a real car. This may not be a problem with on-road planning, but since the parking lot is much narrower than an on-road environment, the smoothed parking trajectory may be unfeasible. We propose an algorithm to smooth the trajectory obeying the kinematic constraints. The trajectory smoothed via our algorithm has a guaranteed feasibility. With these improvements, our algorithm can be applied in actual parking planning task.
Path planning for parking tasks [20] means to find a collision-free path from a given start point to a final target point in a parking lot. The very beginning stages of developing path planning methods is the car of Dubins et al. [6], as well as that of Reeds and Shepp et al. [19] in the domain of robotics. However, these two methods do not consider obstacles and continuous turning angles. Then some research have been done in the field of motion planning. Methods of motion planning for automated vehicles can be divided into four groups [7], including graph search-based planners, for example, Dijkstra algorithm [2], [1] and A-Star algorithm [16], sampling-based planners like RRT [14]
, deep learning-based planners like
[18], [4], [3] and numerical optimization like [5]. Our method is based on RRT, which belongs to the second group. RRT is one of the sampling-based planning methods. It has many improved branches, like Bi-RRT [13], RRT* [11], CL-RRT [12] and DD-RRT [25]. It has also been applied to parking planning task in [8]. Our method has achieved many improvements to the basic RRT. We expand the target point to a model-based target tree. This expansion allows for the generated path to be more smooth and human-like. However, a downside to the sampling-based approach is the uncertainty of planning time. Our expansion can make the planing time shorter and more stable. Another drawback of every sample-based planning algorithm is that every segment of the path is generated with random direction and target, which which results in the path being more complex and with some redundant nodes. Some smoothing algorithms already exist for this particular problem, including, cubic polynomials [21], quintic polynomials [22], [17], Bezier curves [24], [9], [23], B-splines [15] and Clothoids [10]. All of these smoothing algorithms have a common drawback: they violently distort the path into a smooth curve without considering the kinematic constraints of a real car. In this paper, we propose a new smoothing algorithm that takes the vehicle kinematic constraints into consideration. The path smoothed by our algorithm is guaranteed to be practical.We divide the parking tasks into three scenarios: perpendicular parking, parallel parking and echelon parking. Imagine the car is already parked in the parking lot, we define three different model-based target trees with three different scenarios. Each target tree has dozens of paths and hundreds of nodes. We then go on to expand the target point in RRT algorithm to this tree. Once the RRT tree reaches any node of the target tree the final trajectory is generated. This trajectory consists of two parts: a part from RRT tree and a part from the target tree. The model-based target tree makes the latter extremely smooth and enables a processing time of our algorithm more than ten times faster than the traditional RRT. Our algorithm is not only more efficient but more stable in planning time and quality. We use our smoothing algorithm to smooth the former part of the trajectory under vehicle kinematic constraints. Different from other smoothing algorithms, trajectories smoothed by our algorithm have guaranteed feasibility. This procedure is illustrated in Fig. 1.
In this paper, a basic algorithm is called ‘point pursuit’, which calculates the best turning angle to maneuver the car to get it closer to a particular point. Consider a vector
to indicate a car’s state. X and Y is its position in a 2D surface, is the orientation. As shown in Fig. 2, the car’s starting point is , the target point is . The car will move 0.1 meters with a fixed turning angle to point . Therefore, we need to find the best to make the distance between P and A as small as possible. The mentioned previously is an equivalent turning angle calculated by outer wheel turning angles and inner wheel turning angle .(1) |
(2) |
(3) |
(4) |
(5) |
(6) |
Algorithm ‘point pursuit’ will compute the best to minimize the distance. If this movement isn’t collision-free, we will decrease to find a smaller collision-free and increase to find a larger collision-free . We will choose a better between the two which makes the point A closer to point P. This algorithm is shown in Algorithm 1.
RRT was developed by Steven et al. [14], it is an algorithm designed to solve complex high dimensional motion planning problems by randomly building a space-filling tree. Firstly, the start point is the only point of the tree, the growing step is, we randomly sample a point P in free space and then choose the nearest point N in the tree to the sampled point P. Afterwards we find a feasible movement from point N to point A, making A and P be as close as possible. Then we add point A and the movement to the tree as a node and an edge. Repeating this process multiple times, the target point should be close enough to the tree. Then by backtracking the tree, we find a feasible path from the starting point to the target point. This algorithm is presented in Algorithm 2.
In the basic RRT algorithm, when the distance between the car and the target is small but still larger than tolerance value , it takes a great amount of effort to reduce the distance even slightly. The generated trajectory will be complex, and the car will move forward and backward multiple times to adjust to a perfect position. In order to solve this problem, we put forward a model-based target, which expands the target point to a model-based tree. As shown in Fig. 3, this model-based tree has hundreds of nodes. The RRT tree needs to get close to anyone of the target tree’s nodes. Then we connect the paths from RRT tree and target tree to generate the final trajectory. This expansion enables the algorithm to finish its task more easily and makes the obtained trajectory smoother. The last part of trajectory will be perfect because the target tree is generated by the well-defined model. The car will move to target position without any adjustment.
To implement this algorithm, we need to generate a target tree and redefine the basic RRT’s ‘random choice’ function. It is shown in Algorithm 3.
To generate the target tree, we divide the parking scenario into three groups: perpendicular parking, parallel parking and echelon parking. Each model is made up of a few pre-defined parking routes. To generate the models, we imagine the car is already parked within the parking lot, and then we try to drive the car out of the parking lot with various pre-defined driving strategies. After this operation, we will get dozens of feasible driving-out paths, and each path has twenty nodes. Reverse these driving-out paths to parking-in paths, there will be a tree with dozens of paths and hundreds of nodes.
![]() |
![]() |
![]() |
Perpendicular parking: Consider a car driving out of a perpendicular parking lot, it will go straight for sometime and then keep to a fixed turning angle. Since this angle changes from to per , we will get 31 different lines. Under the premise of a collision-free parking process, we will set the straight part as short as possible. Finally, as we pick 20 points per line as nodes of the model, we will get 620 nodes in the perpendicular model.
Parallel parking: A car is driving out of a parallel parking lot, it will move backward for a while and then keep a max turning angle until its body is half out of the parking lot. Then it will choose a fixed turning angle from to per at the rest of the path. In this part, we will also get 31 lines and 620 nodes, but considering that a car parking in a parallel parking lot would have two possible facing directions, the obtained data in our model is doubled up to 62 lines and 1240 nodes.
Echelon parking: Similar to perpendicular parking, a car in an echelon parking lot will go straight for a while and then keep a fixed turning angle. The difference is that in this circumstance the whole movement is backward. The fixed turning angle changes from to per . we will finally get 16 lines and 320 nodes.
Because of the random sampling of RRT tree nodes, there will always be some redundant nodes making the path complex. Therefore, we need an algorithm that can smooth it. There are already some smoothing algorithms for this problem, such as cubic polynomials [21], quintic polynomials [22], [17], Bezier curves [24], [9], [23], B-splines [15] and Clothoids [10]. Long Han et al. also proposed a path smoothing algorithm [8] for RRT-based parking planning. Both of these algorithms ignored the kinematic constraints of a car, which may cause the smoothed path to be unfeasible. By contrast, we have considered and worked on the vehicles kinematic constraints in our proposed smoothing algorithm, which ensures the generation of a feasible path. Our algorithm is based on the idea of Divide and Conquer. Firstly, for example, if the path has N nodes, we try to use ‘point pursuit’ algorithm within N steps to find a new path from start point to target point. If success, the new path is shorter than the original path. If not successful, we will divide the path into two paths from the mid-node and execute the same process to each path until success or they will have just one node. After connecting every resulting path, we will get a smoother path. The ‘point pursuit’ algorithm is under the car’s kinematic constraints, so the generated path is feasible.
As for parking planning, we modified the basic RRT algorithm with the model-based tree and smooth algorithm previously mentioned. Firstly, our algorithm will assign the parking task to one of three parking scenarios, and then corresponding functions are called to grow the target tree. A list of nodes in the target tree will be sent to the Algorithm 3. Finally, we will run the RRT algorithm to generate a parking path. In every step of RRT, the Algorithm 3 will choose a target point for it. RRT will check if the bias is under the tolerance value after every 1000 steps, which means that the RRT will run at least 1000 steps. If the bias is under the tolerance value, the RRT algorithm is terminated and we will start the smoothing algorithm to smooth the path before outputting it.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Scenarios | Perpendicular Parking | Parallel Parking | Echelon Parking | |||
---|---|---|---|---|---|---|
Target Type | Target Point | Model-based Target | Target Point | Model-based Target | Target Point | Model-based Target |
Max Steps | 9000 | 1000 | 5000 | 1000 | 13000 | 1000 |
Min Steps | 4000 | 1000 | 2000 | 1000 | 6000 | 1000 |
Average Steps | 6250 | 1000 | 3000 | 1000 | 8750 | 1000 |
Max Time | 4.85s | 0.20s | 2.28s | 0.23s | 10.30s | 0.20s |
Min Time | 1.46s | 0.12s | 0.13s | 0.17s | 2.98s | 0.17s |
Average Time | 2.54s | 0.17s | 0.92s | 0.20s | 5.28s | 0.18s |
Our algorithm is programmed in C++ and executed on a personal computer with Ubuntu operating system. Our algorithm can generate the parking trajectory. We test the algorithm in three typical scenarios: perpendicular, parallel and echelon. The result is shown in Fig. 4. We will compare the result with basic RRT.
In our experiment, there are two main advantages in the model-based target. Firstly, the target tree extends the target point out of the parking lot obstacles and expands the target point from one point to hundreds of nodes, which makes the RRT tree easier and quicker in reaching its target. Then the RRT tree needs to search a smaller space with fewer steps to get close enough to the target tree. The searched space is shown in Fig. 5. Generally, the more branches in the target tree, the smaller space needed to search, because of the reduction of search space and steps, our algorithm will have a speed boost. The steps and time cost in our algorithm compared to basic RRT is presented in Table I. After hundreds of tests, we confirmed that the basic RRT takes thousands of steps, and in some worse conditions, it takes even over ten thousands of steps. In comparison, our algorithm always takes 1000 steps and never fail. As previously mentioned, our algorithm will not stop before 1000 steps. Usually, the basic RRT costs 0.13s 10s for calculation, ours always takes about 0.2s.
Secondly, the final part of our parking path is more smooth and the safe margin is bigger. The reason is as follows: every RRT algorithm has a connection zone in the path. The RRT tree will connect to the target point in the connection zone. In basic RRT, the connection zone is around the target point, while in our algorithm it is the place where the RRT tree connects to the model-based target tree. The final part of parking path in basic RRT includes the connection zone, resulting in it being extremely complex. The vehicle will move forward and backward multiple times inside parking lot to adjust to a suitable position. Since it is usually narrower inside the parking lot, the adjustment may cause a collision. The final part of our algorithm is generated from the well defined model, very smooth and human-like. The vehicle will move into a perfect position in just one step.
The last part of the path is shown in Fig. 6. The connection zone of our algorithm is outside the parking lot, where it is much wider and safer. The target tree has hundreds of nodes, which makes it much easier to connect. The connection zone will also be very smooth. The connection zone of our algorithm is shown in Fig. 4.
One drawback of sample-based planning algorithms is that every segment of the path is in a random direction, which makes the path complex and causes redundant nodes. As mentioned before, There are already some smoothing algorithms for it. Both of these smoothing algorithms have a common drawback, they violently distort the path into a smooth curve, while not considering the kinematic constraint. As shown in Fig. 7, the distortion can result in collision at some point. Our smoothing algorithm used the point_pursuit algorithm to re-plan a path based on the path generated by RRT. As mentioned in part III, paths smoothed by our algorithm will be feasible. The path before and after smoothing is presented in Fig. 7. We can see the path is much smoother after the procedure. From the car’s moving perspective, in Fig. 8, when it is maneuvering in the pre-smoothed path, the turning angle of the front wheel will shake between and , the facing angle of the car will also shake. But these two angles will be far more stable and human-like in the smoothed path.
We have tested our algorithm in various complex parking scenarios. Including narrow slot of highly limited space. As shown in Fig. 9, our algorithm works very well in such an environment.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
This paper introduced imagination into RRT algorithm to expand the target point to a model-based target tree, which makes the algorithm quicker and the generated trajectory smoother. We also proposed a smoothing algorithm considering vehicle kinematic constraints to generate feasible trajectory.
Our method still has some drawbacks, for example our car has to drive with a fixed speed. In the future we will use deep reinforcement learning to generalize the vehicle speed to a continuous value and explore an unknown space to locate an available parking lot. We will also test our algorithm in the real world.