## 3 Methodology
#### 3.2.1 Analysis of the Impact of Sea-Surface Disturbance
The triangular membership function, which exhibits high sensitivity and can promptly respond to changes in the input, was selected because it allows the system to better handle external disturbances. Meanwhile, considering microcontroller limitations, straight-line mathematical descriptions are computationally simpler than curves. Thus, a triangular membership function was chosen in this paper. Next, fuzzy rules were designed and fuzzy inference was performed based on these rules to derive the fuzzy output. The fuzzy control rules are the core of the Fuzzy PID controller and were derived from expert experience [26]. According to the functions \(K_{p}\), \(K_{i},~{}K_{d}\), the fuzzy control rules were designed as follows. In cases of large values of \(|\mathrm{e}|\), to ensure fast response by the system, a larger \(K_{p}\) should be chosen. To prevent differential overflow caused by the sudden increase in the error at the beginning, a smaller \(K_{i}\) should be chosen, and to avoid excessive error accumulation, a smaller \(K_{i}\) should be chosen. When \(|\mathrm{e}|\) is moderate, to reduce overshoot while ensuring a certain response speed, \(K_{p}\) should be appropriately reduced. Under these conditions, the system is more affected, so \(K_{d}\) should be smaller and \(K_{i}\) should be set to a moderate value. When \(|\mathrm{e}|\) is small, larger values of \(K_{p}\) and \(K_{i}\) should be selected to ensure the steady-state performance of the system. Additionally, to enhance the system's anti-interference capability, when \(|\mathrm{ec}|\) is large, a smaller \(K_{d}\) should be chosen, and when \(|\mathrm{ec}|\) is small, a larger \(K_{d}\) can be chosen. Based on these considerations, the fuzzy control rules for \(\Delta K_{p}\), \(\Delta K_{i}\), \(\Delta K_{d}\) are shown in Tables 2-4 below. These designed control rules ensure that the rotating dual-grating electro-optical tracking system can quickly eliminate large errors and maintain system stability when the errors are small. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**ec**} & \multicolumn{5}{c}{**e**} \\ \cline{2-6}  & **NB** & **NS** & **ZO** & **PS** & **PB** \\ \hline
**NB** & PB & PB & PB & PS & ZO \\
**NS** & PB & PS & PS & ZO & NS \\
**ZO** & PB & PS & ZO & NS & NB \\
**PS** & PS & ZO & NS & NS & NB \\
**PB** & ZO & NS & NB & NB & NB \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Control-rule table for \(\Delta K_{p}\). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**ec**} & \multicolumn{5}{c}{**e**} \\ \cline{2-5}  & **NB** & **NS** & **ZO** & **PS** & **PB** \\ \hline
**NB** & NB & NB & NB & NS & ZO \\
**NS** & NB & NS & NS & ZO & PS \\
**ZO** & NB & NS & ZO & PS & PB \\
**PS** & ZO & ZO & PS & PS & PB \\
**PB** & ZO & PS & PS & PB & PB \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Control-rule table for \(\Delta K_{i}\). The final clear values of \(\Delta K_{p}\), \(\Delta K_{i}\), and \(\Delta K_{d}\) were obtained through defuzzification. In this paper, the centroid method was used for defuzzification, and its expression is given by Equation (14), as follows:  
\[u_{c}=\frac{\int X(u)u\mathrm{d}u}{\int X(u)\mathrm{d}u}, \tag{14}\]  
In the equation, \(u\) represents the fuzzy variable element and \(X(u)\) denotes the membership degree of \(u\).