Several years ago, there were some publications about perfect parallel parking, e.g. “Requirements for a perfect s-shaped parallel parking manoeuvre in a simple mathematical model.” (Rebecca Hoyle, 2003) or “Ein mathematisches Modell zum Parallelparken” (Norbert Herrmann, 2003). They concluded that the ideal strategy for perfect parking is to drive as close as possible next to the vehicle parking in front of your car with your rear axle aligned to the other car’s back and then driving two arcs backwards. However, this assumption is not true in every scenario. In fact, this may even lead to a collision with the other car. In this blog post, I propose an alternate strategy, which is better in some scenarios. Instead of only considering the parking space length (as Hoyle and Herrmann did), I also consider the required street width. A link to the implemented simulator can be found at the end of the article.

## Why are the existing assumptions wrong?

If your car has a very small turning circle and you perform the parking maneuver as described, you might end up with your engine compartment in the other car’s trunk. Herrmann actually took this problem into account but he did not review the strategy description. Instead, it may be necessary to stop a bit earlier. For long cars or cars with a large turning circle, this strategy requires a lot of space. In this case, the alternate strategy may be suited better.

The alternate strategy is constructed similarly as the original one. However, I introduce a phase of straight driving between the two arcs. As a result, the start position is usually some centimeters away from the other car. The strategy may allow shorter parking spaces, narrower streets, or both. On the other hand, some configurations can require the exact opposite. Therefore, it is usually a good idea to simulate both strategies.

The strategy looks as follows:

The variables mean the following:

- b: Distance of rear axle to car back
- f: Distance of rear axle to car front
- w: Car width
- h: Obstacle width
- R: Car’s turning circle radius
- a: Turn angle

## Phase 1: Turn left

The first question is how much to turn. As can be seen in the image, we need to turn until the front right corner of our car has passed the obstacle. This angle can be calculated and immediately gives the minimum park space length g:

If the obstacle is very wide, high turn angles may be necessary. In the implementation, I limited the angle by 90° and used an alternate calculation for the parking space length for these limit cases.

## Phase 2: Drive forward

In the second phase, we need to drive forward. The question is, how far? In simple scenarios, we need to drive exactly f (so the rear axis is at the obstacle’s corner). This allows us to exactly pass the obstacle. However, for high turn angles, this may be too far. Then, we need to drive so far, such that the resulting rotation center of the subsequent right-turn is exactly r-w away from the obstacle’s corner. Using a bit of vector arithmetic, we get the following neat formula:

## Phase 3: Turn right

The last phase is self-explanatory. We need to turn right until we are parallel to the street again. Nothing special here. After that, we are q away from the obstacle and o behind the parking space.

## Implementation

The implementation takes the car’s dimensions and calculates the minimum parking space length and street width, along with the driving parameters. Additionally, it shows an animation of the parking maneuver. Both strategies are implemented. For the original strategy, I used Herrmann’s formulas. These result in slightly odd paths for wide obstacles. The program contains some basic error checking but failure cannot be ruled out. After all, the program is just meant as an illustration. You can download the implementation here (Windows executable, .Net framework 4.5 required).