## 4 Control Algorithm
### Fault-Coping Algorithm  
The major drawback of the leader-follower swarm-control method is that, if a fault occurs with the leader, the swarm cannot maintain its overall formation. To overcome this limitation, a fault-coping algorithm was applied in this study to bolster swarm control. The specific fault scenario considered in this study is a situation in which foreign substances are trapped in the thruster, leading to thruster malfunction. This is a common occurrence in marine platforms [23]. In this scenario, the overall system's current consumption increases due to the fluid resistance load of the foreign material in the thruster. Consequently, the rotational speed of the thruster decreases. Subsequently, as the foreign material blocks the thruster's drive shaft, the current diverges to the stall current value, and the thruster's rotational motion is forcibly halted. Consequently, unintended motion in a direction different from that of the platform's target motion occurs, making it impossible to maintain the swarm formation. Figure 6 illustrates a block diagram of the proposed fault-coping algorithm. The fault-coping algorithm operates as follows: First, when the mission starts, sensors mounted on the USV acquire data such as the overall current consumption, rotational speed of the thruster in RPM, and position information of the USV. Subsequently, the acquired data are input into the 'Check Threshold Block' to determine whether the state of data is more or less than the threshold value. A state of data similar to or less than the threshold value is considered normal, and the mission proceeds. During this time, the mission is repeated until a termination command is received from the user. If the value of the acquired data is greater than the threshold value, it is considered a fault state, and the 'Leader Change Flag' is raised. Consequently, the USV experiencing the fault terminates the system, and among the USVs that are currently not experiencing a fault, it transfers its authority and mission to the one that is the closest in distance. In the fault-coping algorithm, the check threshold block, which receives sensor data and determines their state, combines the 'Thruster Status Block', which identifies faults by comparing the values of the current, voltage, and RPM applied to the thruster to the threshold values, with the 'Platform Position Error Block,' which determines faults by comparing the current platform position, orientation, and heading data to the threshold values. Figure 7 depicts the thruster status block. The thruster status block determines faults based on the applied current, voltage, and thruster RPM. When a foreign object is trapped in the thruster and hinders its normal operation, the current applied to the system increases, and the RPM value decreases or is not detected. The system detects such conditions through internally mounted components, such as a coulometer and a reverse power detection circuit and uses this information to identify fault scenarios. In the thruster status block, the error used to determine the faults was calculated by subtracting the actual system current, voltage, and RPM values detected from the target current, voltage, and RPM values input to both thrusters. If the error did not exceed the threshold value, the system was considered normal. If the error exceeded the threshold, it was classified as a fault. To prevent false positives because of noise or similar problems, the threshold for the thruster status block was designed to require a sustained error larger than the threshold for at least 3 s for the state to qualify as a faulty one. The threshold was determined based on experimental considerations by referencing the results of previous studies [24; 25; 26]. These  
Figure 6: Block diagram of fault-coping algorithm.