# A Real Time Algorithm for Versatile Mode Parking System and Its Implementation on FPGA Board
## 2 Autonomous and Versatile Mode Parking System (AVPS)
### Proposed Algorithm  
The tracking problem is characterized by uncertainty and ambiguities, which are inherent in the underlying scenario and the type of the used sensors in all robotics applications. As outlined in the introduction, we proceeded along the following lines. The real time algorithm, which combines all the parking modes, provides a well-suited methodology that is implemented after that on the FPGA board specifically achieved for the field of robotics research. The above proposed approach was discussed in a more explicit and concrete way in the rest of this paper. This methodology was designed to generate a real time algorithm, which combines the four parking modes of: parallel, perpendicular, head-in angled and head-out angled as shown in Figure 1.  
The idea behind AVPS comes from the current automatic and semi-automatic systems in a single parking mode: parallel, head-in angled, head-out angled or perpendicular. The proposed method combines all those modes assuming that the mobile robot used in this research, just like an autonomous platform, is able to calculate distance \(\mathrm{D}_{1}\) corresponding to the free parking place in the range preprocessing data from sensors 2 and 3 as shown in Figure 2. The target parking position is expected to the first free parking lot between two parked vehicles. Figure 6 shows the generic scheme (parking algorithm flowchart) of functional building blocks of the proposed Autonomous and Versatile mode Parking System (AVPS). The proposed algorithm presented in Figure 6 consists of generating a geometric path for the parking mode that corresponds to:  
Figure 6: Flowchart of the AVPS. * Detection of free parking space. * Measurement of distance \(\mathrm{D}_{1}\) corresponding to the free parking place. * Detection of the first corner of the first detected parked vehicle. * Measurement of distance \(\mathrm{D}_{2}\) corresponding to the travelled distance until detecting a second corner of the same parked vehicle indicated in operation c.
* Detection of the second corner of the same parked vehicle indicated in operation. * Testing if there is an existing slope? If yes, the proposed AVPS recognizes that the mode is head-in angled mode parking or head-out angled mode. If there is no slope, the same proposed AVPS recognizes intelligently that the configuration of the intelligent parking is a parallel parking mode or perpendicular parking mode. In these two cases, all decisions are made depending on the parking position of the parked vehicles in the parking environment. * If there is a slope, then the real time algorithm calculates the value of the angle \(\alpha\) as indicated in the flowchart AVPS proposed system in Figure 6, and the AVPS tests if distance \(\mathrm{D}_{2}\) is equal to \(\mathrm{K}*\cos\ \alpha\). * If \(\mathrm{D}_{2}=\mathrm{K}*\cos\ \alpha\), the mode is the head-out angled parking mode, and before executing the parking, the algorithm tests if \(\mathrm{D}_{1}\geq\mathrm{D}_{5}\). If distance \(\mathrm{D}_{5}\) allows for the parking operation with a safety margin on the right and on left of the vehicle, the algorithm generates a geometric path for the parking. If \(\mathrm{D}_{1}<\mathrm{D}_{5}\), the robot continues to move forward until detecting enough space to park in this configuration. If \(\mathrm{D}_{2}\
eq\mathrm{K}*\cos\ \alpha\), the appropriate mode is the head-in angled parking mode, and the same sequences will be repeated as illustrated above in h and in Figure 6.
* If there is no slope, then the real time algorithm tests and calculates the value of distance \(\mathrm{D}_{2}\). If \(\mathrm{D}_{2}=\mathrm{K}\), there will be another test of the value of the distance \(\mathrm{D}_{3}\) if it is less than or equal to \(\mathrm{D}_{1}\). If \(\mathrm{D}_{1}\geq\mathrm{D}_{3}\), the appropriate mode is \"parallel parking\", and the execution of this mode will also be realized with a safety margin on the right and on the left of the vehicle, and the algorithm generates a geometric path for this mode.