# Enhancing Autonomous Vehicle Navigation with a Clothoid-Based Lateral Controller
## 3 Adaptive Lookahead Distance
Figure 3: (**a**) Fréchet distance between curves \(P(t)\) and \(Q(t)\), representing the minimum leash length needed to connect points on the two paths (**b**) \(P(t)\) and \(Q(t)\) in the context of adaptive lookahead distance algorithm. This concept is illustrated using Figure 3a and a simplified equation (Equation (4)) given below:  
\[\text{FD}(P,Q)=\underset{\gamma,\delta}{\text{inf}}\max_{t}\{\text{d}(P(\gamma(t) ),\;Q(\delta(t)))\} \tag{4}\]  
In Figure 3a, we have two curves, \(P(t)\) and \(Q(t)\), represented by the blue and red lines, respectively. These curves represent the paths of two objects (e.g., vehicles) over time. It is to be noted that calculating the exact Frechet distance can be computationally intensive, and various algorithms and heuristics are used to approximate it efficiently in practice. Calculating the Frechet distance in real-time implementation involves finding a discrete approximation of the continuous Frechet distance between two trajectories. The implementation of the Frechet distance evaluation in discrete time is provided in Appendix A. Figures 4 and 5 underscore the significance of the method employed for dynamically updating the lookahead distance at each time step. This updating process relies on two key factors: the curvature of the reference path ahead, which the vehicle is expected to follow, and the vehicle's current positional deviation from this path (includes current cross-track error, heading error, etc.). In Figure 4b, it is evident that the Frechet distance increases notably with the expansion of the lookahead distance, especially when the path's curvature is significant. This phenomenon arises due to the substantial dissimilarity between the clothoid trajectory fitted between the vehicle's present coordinates and its target destination (Figure 4a) and the reference path that the vehicle is intended to track. The observation that the Frechet distance exhibits monotonic growth as the discrepancy between the locally fitted clothoid and the reference path increases enables the application of a threshold-based approach to ascertain an appropriate lookahead distance. This threshold value ultimately becomes one of the tunable parameters in the clothoid-based lateral controller. Similarly, Figure 5 shows the variation in the minimum Frechet distance (minimum of all the Frechet distances obtained for lookahead distance varying from 5 to 20 m) with the initial cross-track error of the vehicle. Again, as the cross-track error increases, the deviation between the local clothoid fitted between the vehicle's current coordinates and the target point on the reference path and the part of the reference path between the closest point on the reference path, in relation to the vehicle's current position and the target point, increases. In addition to the initial cross-track error, the Frechet distance will also depend upon the vehicle's current yaw angle and its initial curvature, since the clothoid controller uses that information too while obtaining the optimal clothoid curvature rate as illustrated in Figure 2.  
Figure 4: (a) Fictorial representation of deviation between the locally fitted clothoid and the reference path. (b) Variation of Fréchet distance with respect to the distance between the current vehicle coordinates and the target point. After careful consideration of all these various factors (initial cross-track error, initial yaw angle, and initial curvature) and their influence on the Frechet distance, we have determined a standardized threshold value of 0.5 m for the Frechet distance through comprehensive simulation testing. This established threshold will be consistently applied in all subsequent lateral control simulations.