# Evaluation of PID-Based Algorithms for UGVs
## 3 Methodology
### PID Controller
#### 3.4.4 PID Vector Field
Potential fields can be applied in robot navigation for obstacle avoidance and collision prevention scenarios [41]. Vector fields differ from potential fields in that they do not always represent the gradient of a potential. Instead, the vector field simply indicates a desired direction of movement. As we can see, the vector field force (black arrow) will guide the robot between it starting point (green dot) and its goal (red dot). The following steps represent the process of the Vector Field algorithm:  
1. Calculation of the Orientation Angle (\(\chi^{t}\)): In this step, the desired orientation angle (\(\chi^{t}\)) is calculated for the robot to move from the first waypoint (\(w1\)) to the second waypoint (\(w2\)). \[\chi^{t}=atan2(w2_{y}-w1_{y}\,\ w2_{x}-w1_{x})\] (1)
2. Calculation of Position Along the Trajectory (S*): Here, the robot's position along the trajectory between the waypoints is determined. The vector connecting the current  
Figure 14: Representation of the variables in the Vector Field algorithm. Figure 12: Trajectory with the Vector Field algorithm. Figure 13: Typical magnetic field in navigation with the Vector Field algorithm. position (z) and the first waypoint (\(w1\)) is projected onto the vector between \(w1\) and \(w2\), giving a measure of where the robot is along the trajectory. \[\mathrm{S}^{*}=\frac{(z-w1)^{T}(w2-w1)}{||w2-w1||}\] (2)
3. Calculation of Distance to the Trajectory (\(\varepsilon\)): This step calculates the distance between the robot's actual position (\(z\)) and the closest point on the trajectory between the waypoints. This helps understand how far the robot is from the desired path. \[\varepsilon=||z-(\mathrm{S}^{*}(w2-w1)+w1)||\] (3)
4. Determination of the Side of the Trajectory (\(\rho\)): Here, a value (\(\rho\)) is calculated to indicate which side of the trajectory the robot is on. This is achieved using the cross product between the vector connecting the waypoints (\(w2-w1\)) and the vector from the current position (\(z\)) to the first waypoint (\(w1\)). The sign of this value indicates whether the robot is to the left or right of the trajectory. 5. Verification of Position Relative to Waypoint 2: If the value of \(S^{*}\) is greater than 1, it means the robot has passed the second waypoint. In this case, the robot transitions to the next waypoint, as it has reached the destination of the current waypoint. 6. Change of Waypoint: The transition to the next waypoint in the trajectory is made. 7. Continuation of the Process: If \(S^{*}\) is less than 1, it means the robot is still between the waypoints, and its navigation continues. 8. Defining \(\varepsilon\) as \(\rho\varepsilon\): In this step, the value of \(\varepsilon\) is updated to \(\rho\varepsilon\), which represents the distance of the robot to the trajectory, considering which side of the path the robot is on. 9. Verification of Distance to the Trajectory: If the absolute value of \(\varepsilon\) is greater than a predefined threshold \(\tau\), it indicates that the robot is significantly far from the desired path. 10. Calculation of Desired Angle (\(\chi^{d}\)): If the robot is far from the trajectory, \(\chi^{f}\) is calculated as the difference between the reference angle \(\chi^{f}\) and the product of \(\rho\) and \(\chi^{c}\), where \(\chi^{c}\) is a correction factor. \[\chi^{d}=\chi^{f}-\rho*\chi^{c}\] (4)
11. Otherwise (Trajectory Distance Within the Limit): If the absolute value of \(\varepsilon\) is less than or equal to \(\tau\), it means the robot is close enough to the trajectory. 12. Calculation of Desired Angle with Correction (\(\chi^{d}\)): In this scenario, \(\chi^{d}\) is calculated as the difference between the reference angle \(\chi^{f}\) and the product of \(\chi^{c}\), \(\tau\), and a factor \(k\). \[\chi^{d}=\chi^{f}-\chi^{c}\Big{(}\frac{\varepsilon}{\tau}\Big{)}^{k}\] (5)
13. End of the Process: The process concludes here.