# Cloud Incubator Car: A Reliable Platform for Autonomous Driving
## 3 High-Level CICar Architecture
### Decision-Making System
Figure 6: _Cont._  
The local planner uses a pair of waypoints (\(\mathrm{WP_{i}}\), \(\mathrm{WP_{i+1}}\)) supplied by the global planner to generate a set of possible trajectories to reach \(\mathrm{WP_{i+1}}\) from \(\mathrm{WP_{i}}\) (see Figure 7). For that, the perception system supplies a local map of up to 100 m around the vehicle (Figure 8a), which is completed with three constraint types: (a) the constraints that the vehicle detects on the way by means of the perception system (vehicles, pedestrian, bikes, curbs, and so on), (b) the limitations inherent in the vehicle characteristics (wide, high, kinematic model), c) the constraints derived from the traffic rules (one way, bidirectional way, traffic signs, etc.). To decrease the number of computations and to increase the performance, the perception system supplies a set of keypoints which are a representation of the surroundings of the vehicle. The keypoint set is obtained after applying a filtering process composed of two stages:  
1. Distance filter. All XYZ points beyond a maximum distance (\(\mathrm{d_{max}}\)) will be rejected. 2. High filter. All Z points higher than a maximum value (\(\mathrm{Z_{max}}\)) will be discarded. As shown in Figure 8b, we have simplified the initial XYZ local map to obtain a compact profile of the XYZ representation of the objects in the scene. Figure 6: SCP applied on a real map. (**a**) Selection of the initial point on the real map; (**b**) cross points found on a binary map; (**c**) possible trajectories on a binary map; (**d**) optimum trajectory on the real map. Figure 8: (**a**) Local map; (**b**) local filtered map. Figure 7: Local planner flowchart. After this, the corners of the objects in the scene are computed using the Harris algorithm [36]. The Harris algorithm is applied over an ROI (Region of Interest) in the forward direction of the vehicle. Figure 9 shows the results of corner detection in the ROI of two scenarios extracted from Figure 9b. This group of points calculated by the Harris algorithm are called keypoints (\(\text{KP}_{\text{i}}\)) and will be used in the next stage of the PPS to create a set of trajectories. In Figure 9, green crosses represent the keypoint set, a triangle with a 2 metre base represents the vehicle, a rectangle shows the ROI where the Harris detector is computed, and two red circles represent the origin and goal locations (\(\text{WP}_{\text{i}}\), \(\text{WP}_{\text{i+1}}\)). The trajectory generator module receives two waypoints (\(\text{WP}_{\text{i}}\), \(\text{WP}_{\text{i+1}}\)) and a set of keypoints [\(\text{KP}_{0}\),...,\(\text{KP}_{\text{k}}\)] representative of the environment around the vehicle for computing a set of trajectories between a pair of waypoints. The module uses the Bezier curves to generate possible trajectories between the waypoints, using the keypoints as control points. A Bezier curve of grade n can be generalized by the Equation (3) [33]:  
\[B(t)=\sum_{i=0}^{n}\Bigg{(} \begin{array}{c}n\\ i\end{array} \Bigg{)}P_{i}(1-t)^{n-i}t^{i},\ t\in[0,1] \tag{3}\]  
For example, the second-grade curve (\(n=2\)) is (see Equation (4)):  
\[B(t)=(1-t)^{2}P_{0}+2\ t\ (1-t)\ P_{1}\ +t^{2}\ P_{2}\ \,\ t\in[0,1] \tag{4}\]  
Being \(\text{P}_{0}\), \(\text{P}_{1}\), and \(\text{P}_{2}\) the control points, and \(t\) a real value between 0 and 1. A higher step of t allows a higher number of points to be obtained in the Bezier curve generation \(\text{B}(t)\). The trajectory generator module implements a set of second-grade Bezier curves displaced along the X-axis control point \(\text{P}1\). The development algorithm is shown in Algorithm 1, where _nCurves_ indicates the number of trajectory candidates which have been calculated. However, only one set will pass the security distance constraints and will be adopted as the trajectory (\(\text{Ti}[]\)). For each of them, a new control point \(\text{P}1\) is defined, one half to the left of the midpoint between \(\text{P}0\) and \(\text{P}2\), and the other half to the right.