## 2 Materials and Methods
### Control Algorithms  
During testing, the Pixy2 camera followed a designated travel route using a Line Tracking program. The line was converted into a vector, and the alignment of this vector with the screen's axis of symmetry (Figure 10a) indicated that the vehicle's direction \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Setting** \\ \hline Auto exposure correction & On \\ Auto white balance & On \\ Auto white balance on power-up & On \\ Flicker avoidance & On \\ Min frames per second & 61 \\ Tuning & \\ Edge threshold & 29 \\ Maximum line width & 210 \\ Minimum line width & 59 \\ White line & Off \\ Camera brightness & 36 \\ Expert & 7 \\ Edge distance & 3 \\ Line extraction distance & 2480 \\ Maximum line compare & 10 \\ Minimum merge distance & 16 \\ Line filtering & 27 \\ Intersection filtering & 5 \\ Barcode filtering & 0 \\ Default turn angle & 0 \\ Delayed turn & Off \\ Manual vector select & Off \\ Default program & Line tracking \\ Program select on power-up & Off \\ Debug & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Camera settings in PixyMon v2 version 3.0.24 software. Figure 9: The distances of the transceiver mounts (SDt) and the camera (SDc) from the vehicle’s drive axis in the horizontal plane. was correctly aligned with the designated route. Consequently, the vehicle achieved full forward speed. When a discrepancy occurred between the designated travel route and the vehicle's direction, the vector deviated from the screen's axis of symmetry (Figure 10b). The parameters presented in Table 1 were selected based on extensive trials. The most influential parameters for vehicle control include camera brightness, which must be adjusted according to the intensity of the lighting. Maximum line width and minimum line width are critical for detecting the line along which the vehicle moves. If the line width is set too narrow, darker areas on the surface may be detected as a guiding line, disrupting the vehicle's movement. Conversely, if the line width is set too wide, the line may not be detected, causing the vehicle to lose navigation. The minimum line length parameter was adjusted to ensure that the detected guiding vector extends across the entire field of view of the camera. If the value is set too low, this can cause significant disruptions in determining the vehicle's direction vector. The vector's coordinates can be used to calculate its deviation from the screen axis. Based on this, the error, as presented in Formula (1), is calculated following the procedure outlined in the software available on the manufacturer's website [35]. Depending on the direction of the vector's deviation, the error can take either positive or negative values. \[error=m\_x1-X\_CENTER \tag{1}\]  
where:  
\(m\_x1\)--the x-coordinate of the end of the vector;  
\(X\_CENTER\)--the x-coordinate of the screen center. Based on the error information, the duty cycle of the PWM signal (0-400) is calculated using Equation (2):  
\[PWM=0.5\text{-}error^{2}-20\text{-}abs(error)+410 \tag{2}\]  
where:  
_error_--error according to the Equation (1). Figure 10: Vector when the direction of the AGV aligns (**a**) and does not align (**b**) with the direction of the designated route of travel. As seen in Equation (2), the speed decreases to a minimum value before starting to increase again. Once the minimum of the function is reached, the direction of the wheel's rotation is reversed. In optocoupler-based control (Figure 11), the time during which the reflective optocoupler does not reflect light (i.e., when it is above the black line) is measured. The accumulation of time (successive values corresponding to a certain duration) begins when the AGV moves off the route marked by the line (with the reflective optocoupler above the black line). The longer the reflective optocoupler stays in this position, the greater the accumulated time. The accumulation stops when the reflective optocoupler moves outside the black line, at which point the accrued time starts to decrease.