## 3 Methodology
#### 3.2.1 Analysis of the Impact of Sea-Surface Disturbance  
When a ship navigates on the sea surface, it encounters complex sea-state disturbances. According to available data, sea states are classified into levels ranging from 0 to 9. For an 180,000-ton bulk carrier, the rolling frequency at a sea state of level 5 is 0.1 Hz. According to the International Maritime Organization's Convention on Standards of Training, Certification, and Watchkeeping (COLREGs), sea state level 5 is characterized by wind speeds of 17.2-20.7 m/s (33-40 knots), resulting in rough sea conditions that typically induce a ship attitude angle of approximately 10\({}^{\circ}\). Therefore, a negative disturbance sine wave with an amplitude of 10\({}^{\circ}\) and a frequency of 0.1 Hz, opposite in sign to the ship attitude disturbance amplitude, was added at the input of the loop to simulate feedforward compensation. The trajectory of the grating's rotation angle as a function of time before the negative disturbance was applied is shown in Figure 6, while the trajectory after the negative disturbance was applied is shown in Figure 7.  
Figure 6: Grating rotation trajectory before the addition of negative disturbance. Figure 7: Grating rotation trajectory after the addition of negative disturbance. It can be observed that after the addition of the negative disturbance with feedforward compensation, the rotation trajectories of the two gratings exhibited irregular and complex changes. During actual scanning, the rotation speed of the dual gratings will experience abrupt changes when the rotation direction is altered, resulting in significant servo control errors. Therefore, it is necessary to design a novel control system to correct the servo control errors caused by the complex disturbances of the sea surface. 2.2 Design of the Fuzzy PID Control System for the Rotating Dual-Grating Two-Dimensional Scanning Model Based on Inertial Navigation Feedforward Technology  
To achieve stable and rapid scanning of the rotating dual grating in the two-dimensional plane on the sea surface, a controller system combining a rotating dual-grating two-dimensional beam scanning model based on inertial navigation feedforward technology with Fuzzy PID control was designed. The Fuzzy PID can dynamically adjust the parameters of the PID controller based on real-time feedback from the system, thereby reducing overshoot and improving the response speed and accuracy of the scanning. Compared to traditional PID control algorithms, Fuzzy PID control enhances the system's performance when it is faced with sea-surface disturbances and system variations, improving the system's robustness. Furthermore, if the system exhibits uncertainty and nonlinearity, its control performance may degrade. Fuzzy PID control utilizes fuzzy logic processing to ensure that the dual grating system maintains stability and efficiency even under complex sea-surface conditions [24]. The system dynamics are described by differential equations, which were obtained by combining experimental methods with the derivation of the formula principles [25], as follows:  
\[\left\{ \begin{array}{l}v=L\frac{di}{dt}+Ri+k_{b}\frac{d\theta}{dt},\\ k_{b}i=l\frac{d\theta}{dt^{2}}+kf\frac{d\theta}{dt},\end{array} \right. \tag{11}\]  
where \(v\) is the armature control voltage; \(L\) is the armature inductance; \(i\) is the armature current; \(R\) is the armature resistance; \(k_{b}\) is the back electromotive force constant; \(\theta\) is the motor's rotational angle; \(J\) is the motor's moment of inertia; and \(k_{f}\) is the damping coefficient.