# Cloud Incubator Car: A Reliable Platform for Autonomous Driving
## 3 High-Level CICar Architecture
### Decision-Making System
Equation (1) shows how the search directions are obtained by the algorithm in function of the angle \(\theta_{0g}\) \[directions=f\big{(}\theta_{og}\big{)}=\begin{cases}N,&-45\leq\theta_{og}<-135\\ W,&-135\leq\theta_{og}<135  
2. If the distance is not equal to 0, p\({}_{0}\) is set to p\({}_{0}\) = CP\({}_{1+1}\), and the algorithm goes to step 2. 2. If there is a clear route, the algorithm finishes, and the path is composed of the points [p\({}_{0}\),pm\({}_{1}\),...,pmn\({}_{n-1}\)p\({}_{\rm g}\)], with pm\({}_{1}\),...,pmn\({}_{n-1}\) being the midpoints obtained from the pairs of points from the cross-point vector [p\({}_{0}\),CP\({}_{1}\),CP\({}_{2}\),...,CP\({}_{n}\);p\({}_{\rm g}\)]. Figure 5 shows a binary map in the form of a square which will demonstrate the SCP algorithm in operation. Figure 5a shows how the SCP algorithm generates the cross points in the direction 'N', given the information (p\({}_{0}\), p\({}_{\rm g}\), \(\theta_{0}\)). In the example with \(\theta_{0}\) = 60\({}^{\circ}\) and Table 5, the angles \(\theta_{1}\) y \(\theta_{2}\) are \(-120^{\circ}\) and \(-60^{\circ}\) respectively. Figure 5: Example of the Search for Cross Points (SCP) working between p\({}_{0}\) and p\({}_{\rm g}\) with initial angle \(\theta_{0}\) = 60\({}^{\circ}\). (**a**) Scenario without change of direction; (**b**) Obtained trajectory in scenario without change of direction; (**c**) Scenario with change of direction; (**d**) Obtained trajectory in scenario with change of direction. As shown in Figure 5a, the cross points \(\rm CP_{i}\) are generated in a zigzag in the direction 'N' until a direct path to the destination is found. Figure 5b shows the route generated between the midpoints of the segments from the set [\(\rm p_{0}CP_{1}\); \(\rm CP_{1}CP_{2}\); \(\rm CP_{2}CP_{3}\); \(\rm CP_{3}CP_{4}\); \(\rm CP_{4}P_{8}\)]. In Figure 5c, a more complex scenario with a different \(\rm p_{8}\) is shown. In this case, when the SCP algorithm reaches \(\rm CP_{5}\), an end of route occurs when it no longer follows the 'N' direction. At this point, the Euclidean distance between \(\rm CP_{4}\) and \(\rm CP_{5}\) is 0, and the algorithm changes the search direction from 'N' to 'E', with \(\theta_{1}=60^{\circ}\) and \(\theta_{2}=-60^{\circ}\). With the change of direction, it is possible to calculate a new \(\rm CP_{5}\). Figure 5d shows the route generated between the midpoints of the segments from the set [\(\rm p_{0}CP_{1},\,\ldots,\rm CP_{14}P_{8}\)]. The SCP algorithm can increase the number of routes calculated with a greater number of initial starting angles. Figure 6a shows a real map of the Technical University of Cartagena where an initial point \(\rm p_{0}\) and a final point \(\rm p_{8}\) (blue and red crosses) have been selected. The SCP algorithm has been executed with initial angles \(\theta_{0}\) from 20 to 80 degrees, with 2-degree increments. After its execution, the SCP has calculated three possible trajectories. Figure 6b shows the cross points found, and Figure 6c the trajectories created from the set of midpoints from the three calculated trajectories. Figure 6d shows the optimal path calculated as the shortest between points \(\rm p_{0}\) and \(\rm p_{8}\). The optimal path is partitioned in waypoints (\(\rm WP_{0},\,\ldots,\,\rm WP_{i},\,\ldots,\,\rm WP_{n}\)). The waypoints will be used by the CICar to establish short missions between them using the local planner module. The CICar location is provided by a DGPS unit on board the vehicle. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Directions** & **Angle \(\theta_{1}\)** & **Angle \(\theta_{2}\)** \\ \hline N & \(-180+\theta_{0}\) & \(-\theta_{0}\) \\ S & \(\theta_{0}\) & \(180-\theta_{0}\) \\ E & \(\theta_{0}\) & \(-\theta_{0}\) \\ W & \(-180+\theta_{0}\) & \(180-\theta_{0}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Calculation of angles \(\theta_{1},\,\theta_{2}\), depending on the direction.