## 2 Collision Avoidance System
### Obstacle Detection Module  
The obstacle detection and tracking process comprises several phases, and improvements have been introduced in respect of previously implemented systems to increase detection reliability and avoid the system giving false negatives or positives. Described below are the phases executed by this algorithm. **Phase 1: Obstacle Detection and Tracking**  
A laser-scanner-based surroundings perception system is used to detect obstacles. It enables obstacles that the system considers may pose a risk to be detected. Specifically, a Sick LRS 1,000 long-range laser scanner is used, which, under normal working conditions can detect obstacles over 150 m distant. It uses a maximum update frequency of 10 Hz, a light aperture of up to 180\({}^{\circ}\) and an angular increase between beams that can reach 0.125\({}^{\circ}\). The obstacle detection algorithm comprises two fundamental blocks: an obstacle search block (grouping into sets the points comprising the obstacle detected by the laser scanner) and the obstacle tracking block. There is an extensive bibliography on this kind of algorithm (e.g., [39, 40, 41, 42]) and by taking this as a starting point the best proposals have been adopted, the main ones being [43]:  
* An iterative segmentation algorithm to avoid false groupings or the division of obstacles in complex environmental scenarios using different acceptance and rejection criteria. * Accurate kinematic variables calculation of obstacle displacement by identifying the lateral and front axes of the obstacle. The iterative algorithm aims to resolve the constraints found in the method proposed in [44] for segmenting the points and determining which of those points belongs to each obstacle. On the other hand, the determination requires the kinematic variables of the obstacles. This is a requirement imposed by [4] so that the pre-collision systems will work properly. This objective is achieved by implementing an algorithm to determine the main axes of the obstacle detected to obtain greater independence of the deviations in measurement and the tolerances included in the calculations. The proposed method in [43] attempts to solve the limitations of the other methods and ensures the orthogonality of the axes of the detected vehicles at any instant. This method assumes that, in general, at least three points of the axes of a rectangular shaped obstacle that has been detected are considered to be given by two perpendicular straight lines defined by the following parameters:  
* Line r\({}_{1}\): Gradient: m; y-intercept: b
* Line r\({}_{2}\): Gradient: \(-1/\)m; y-intercept: c  
A quadratic error minimisation process is performed (giving equal weighting to the error of each side) in order to find the axes, varying the number of points belonging to each of the straight lines r\({}_{1}\) and r\({}_{2}\) (\(n_{1}\) and \(n_{2}\), respectively, and with \(n_{1}+n_{2}=N\)). The method that minimizes the quadratic error leads to the following expressions from which the gradient of the straight line r1 can be deduced:  
\[ \begin{split} m^{4}\Bigg{[}n_{2}\sum_{i=1}^{n_{1}}\Bigg{(}-x_{i} ^{2}+\frac{1}{n_{1}}\sum_{j=1}^{n_{2}}x_{i}x_{j}\,\Bigg{)}\Bigg{]}+n^{3}\Bigg{[} n_{2}\sum_{i=1}^{n_{1}}\Bigg{(}x_{i},y_{i}-\frac{1}{n_{1}}x_{i}\sum_{j=1}^{n_{2}}y_{j }\,\Bigg{)}\Bigg{]}+\\ +m\Bigg{[}n_{1}\sum_{i=1}^{n_{1}}\Bigg{(}x_{i},y_{i}-\frac{1}{n_{ 2}}x_{i}\sum_{j=1}^{n_{2}}y_{j}\,\Bigg{)}\Bigg{]}+n_{1}\sum_{i=1}^{n_{2}} \Bigg{(}x_{i}^{2}-\frac{1}{n_{2}}\sum_{j=1}^{n_{2}}x_{i}x_{j}\,\Bigg{)}=0\,\, \,\text{if}\,\,n_{1}\
eq 0\,\,\text{and}\,\,n_{2}\
eq 0\\ \frac{1}{m^{2}}\sum_{i=1}^{n_{2}}\Bigg{[}\Bigg{(}y_{i}+\frac{1}{m }x_{i}-\frac{1}{n_{2}}\sum_{j=1}^{n_{2}}\Bigg{(}y_{j}+\frac{1}{m}x_{j}\, \Bigg{)}\Bigg{]}x_{i}\,\Bigg{]}=0\,\,\,\text{if}\,\,n_{1}=0\,\,\text{or}\,\,n_ {2}=0\end{split}