# Road Traffic Gesture Autonomous Integrity Monitoring Using Fuzzy Logic
## 3 Foundations for System Design
### Mathematical Foundation  
Given that there are \(n\) identical cars in a gridlock at a four-legged intersection, \(n\geq 4\), where \(n\) is a natural number. It can be shown through mathematical induction that cars on one lane can be dispersed through a voting scheme. When \(n=4\), there will be one car on each lane. Let \(P(m)\) be the number of cars on the lane, where \(m\) is a natural number. \(P(m=1)\) holds true for the Leading car, since three cars can vote to disperse one car. When \(n\succ 4\), there can be more than one car on the lane. Let \(k\) be the arbitrary index of a car on the lane. Assuming that \(P(m=k)\) is true, want to show that \(P(m=k+1)\) is also true for the next car on the lane. If \(P(m=k)\) is true then the car will vacate its position for the next car after receiving the green light vote. That is \(P(m=k+1)\) will be voted for to leave the intersection. Hence \(P(m=k+1)\) is also true. Because \(P(m=1)\) is true for \(n=4\) and \(P(m=k)\Rightarrow P(m=k+1)\) is true for \(n\succ 4\), \(P(n)\) must be true for all \(n\geq 4\). Therefore, the number of vehicle nodes per intersecting lane required for the fuzzy classification model inferred from the principle of mathematical induction should be \(n\geq 2\). Thus, at least two microcontrollers per lane will suffice for the ad hoc vehicular network, each vehicle hosting one microcontroller, resulting in at least eight microcontrollers for addressing the gridlock conflict. Four input variables can be determined from the mutual characteristics of the positions of two cars \((x_{1},y_{1})\) and \((x_{2},y_{2})\) with corresponding membership functions. The positions of two cars \((x_{1},y_{1})\) and \((x_{2},y_{2})\) can be displayed graphically on the cartesian coordinate system as follows, Figure 1.  
The straight line passing through the two points in Figure 1 has a gradient \(m\), (1), that remains constant along its entire length. By definition,  
\[m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}} \tag{1}\]  
In a ratio, \(y_{2}-y_{1}\) is referred to as the numerator while \(x_{2}-x_{1}\) serves as the denominator. The shortest distance between the two points will be given by the length \(l\) of the line, (2), connecting them at an angle of inclination \(\alpha\) to the horizontal. By definition,  
\[l=\left((x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}\right)^{\frac{1}{2}} \tag{2}\]  
Thus, the mutual characteristics shared by the two points are length (distance), numerator, denominator, and an angle of inclination. These characteristics, namely, distance, numerator, denominator, and angle of inclination, are necessary and sufficient for their mutual description and will serve as input to the fuzzy logic model. However, the car's GPS coordinates are based on the geodetic coordinate system. For vehicles whose wheelbase remain on the ground, the altitude component can be ignored (set to one unit). Hence, GPS location coordinates would be transformed into Cartesian coordinates, using (3) and (4). \[x=radOfEarth*\cos(latitudeGPS)*\cos(longitudeGPS) \tag{3}\]  
\[y=radOfEarth*\cos(latitudeGPS)*\sin(longitudeGPS) \tag{4}\]  
where \(radOfEarth\) is the radius of the Earth, \(latitudeGPS\) and \(longitudeGPS\) are the real-time latitude and longitude values obtained from the GPS module connected to a micro-controller respectively. Given a four-legged intersection, four linguistic output variables will suffice to indicate vehicle positions on its northern, eastern, southern and western lanes. It is necessary to  
Figure 1: Car positions on the Cartesian plane. establish the relative position of each car from the next. Thus, one car can be _behind_ the other, one on the _left_, one on the _right_ or one _ahead_ for \(n\geq 4\), where \(n\), a natural number is the number of cars in gridlock conflict at the intersection. Four output variables (East, North, West and South) each with four membership functions (Ahead, Left, Right and Back) will be needed.