# Evaluation of PID-Based Algorithms for UGVs
## 3 Methodology
### Control System and Controller Selection for UGV Navigation  
The robot control system is a MIMO (Multiple Inputs and Multiple Outputs) system equipped with various controllers. Due to the lack of knowledge regarding the speeds of each track, its control is achieved by obtaining the position and orientation of the UGV. Through the ROS platform, it is possible to acquire both the position and orientation of the robot via various published \"topics\", as well as the linear and angular velocity of the robot through the \"cmd_vel\" topic. Since it is not possible to directly control the UGV's speed, we assume the velocities as control variables but treat them as indicators to understand the UGV's movement.  
Given that we are dealing with a differential structure, it only has two axes, x and z, with the \(x\)-axis corresponding to linear velocity and the \(z\)-axis to angular velocity. To ensure system safety, software protection has been included where the sum of these two components cannot exceed 1. In other words, 1 is considered the system's maximum speed, and 0 is the minimum speed. Table 2 provides several examples illustrating how the robot should move based on the values obtained from the \"cmd_vel\" topic.  
The \"controller\" publishes the commands, but the voltage applied to the UGV is controlled by a driver managed by the \"microcontroller\". The microcontroller operates as a state machine, adjusting the voltage sent to the tracks based on the \"cmd_vel\" topic.  
Initial tests established the maximum and minimum voltage limits for the reliable operation of the solenoid valves and tracks. These tests involved gradually applying voltage and observing the effects on speed, steering, and stability. Using the results, functions were created to model how the solenoid valves and tracks respond to voltage variations. This allowed the development of rules to optimize the UGV's performance and ensure efficient operation.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Linear Velocity (v)** & **Angular Velocity (w)** & **Behavior** \\ \hline v = 1 & w = 0 & Front Linear Movement \\ v = \(-\)1 & w = 0 & Back Linear Movement \\ v = 0 & w = 1 & Rotate Anti-Clockwise \\ v = 0 & w = \(-\)1 & Rotate Clockwise \\ v = 0.5 & w = 0.5 & Circular Movement Anti-Clockwise \\ v = 0.5 & w = \(-\)0.5 & Circular Movement Clockwise \\ \hline \hline \end{tabular}
\end{table}
Table 2: Behavioral responses based on “cmd_vel” values.  
Figure 2: Process of acquiring the variables to be implemented in the algorithms of the PID control.  
The references R1 and R2 are desired values from the UGV's trajectory planning system, serving as inputs for the controllers. Errors e1 and e2 are calculated as the difference between desired and actual values. The controllers send corrections to the microcontroller, which adjusts the tracks to align the UGV's movement with the planned trajectory.  
The UGV's various controllers can be selected based on the operating circumstances. For example, a controller can be activated to maximize traction and stability on inclined or slippery terrain, thereby improving safety and efficiency. Additionally, the ability to dynamically switch controllers helps reduce environmental impacts, such as choosing a gentler controller in sensitive areas where soil and vegetation preservation is critical, thereby avoiding inevitable damage to the surrounding ecosystem. The use of multiple controllers in forestry operations is a significant innovation in this context. This methodology provides technical advantages and enhances the sustainability of operations in challenging environments, showcasing the technology's ability to tackle diverse challenges while promoting more ethical and effective practices in navigating these machines.  
The next section discusses different types of controllers developed for controlling the robot, such as the ON-OFF controller and various PID controllers for managing different variables.