# Three-Dimensional Modeling of a Robotic Fish Based on Real Carp Locomotion
## 3 Implementations of the Fish-Like Motion
### Guidance and Trajectory Tracking
Roll, pitch and yaw angles \((\phi,\theta,\psi)\) are also rigid body orientations with respect to the earth-fixed frame. In order to validate the accuracy of the designed model, simulations are examined in this section. Figure 17a shows the closed loop forward speed responses of the robotic fish from 0.1 m/s to 0.4 m/s. These speed values are chosen as observed speed ranges of the carp. Figure 17b shows the orientation control that includes yaw angles of the robotic fish model during 40 s simulation time. The control performance of the closed loop system is summarized in Table 1.  
Another key point is to realize pitch and roll motions together. In Figure 18, these motions are performed for step and stairs references. The closed loop control performance of the roll and pitch motions are illustrated in Table 2.  
In order to validate the closed loop system, two different path trajectories are also generated in earth-fixed frame for 3D trajectory tracking. First path is a 3D sinusoidal path (P\({}_{1}\)) reference and the second path is a 3D CCW circular path (P\({}_{2}\)) reference. Trajectory tracking responses indicate the  
Figure 16: Thrust force of the robotic fish for free-swimming motion during 80 s.  
Figure 17: Closed loop responses of the 6-DoF system during 40 s simulation time: (**a**) Forward speed control; (**b**) Yaw angles tracking control. 6-DoF motion responses including positions, yaw, roll, pitch and also link angles are given in Figure 21. The robotic fish swings the flexible tail to keep the P\({}_{1}\) reference during closed loop tracking. \[\Delta S(k+1)=-\beta S(k) \tag{29}\]0 3D P\({}_{1}\) tracking control performance. \[\Delta S(k+1)=-\beta S(k) \tag{29}\]1 Errors for P\({}_{1}\) tracking. \[\Delta S(k+1)=-\beta S(k) \tag{29}\]2 P\({}_{1}\) tracking responses: (**a**) 6-DoF responses; (**b**) Link angles. Figure 22 shows the closed loop P\({}_{2}\) tracking performance during a 64 s simulation time. Diameter of the P\({}_{2}\) is 8 m and depth is 1.28 m. Initial positions of the robotic fish and P\({}_{2}\) reference begin the origin at X = 0 m, Y = 0 m, Z = 0 m.  
The robotic fish turns around the CCW direction to track the P\({}_{2}\) reference with a speed of 0.4 m/s. Figure 23 also presents the P\({}_{2}\) tracking errors of speed and orientation angles. 6-DoF motion responses are given in \[\Delta S(k+1)=-\beta S(k) \tag{29}\]3 When the robotic fish reaches the steady state, link angles become stable and generate small amplitudes. As shown in Table 3, the tracking errors of P\({}_{1}\) and P\({}_{2}\) references on the x, y and z axis are evaluated by Root Mean Square Error (RMSE) performance index and given as:  
\[\Delta S(k+1)=-\beta S(k) \tag{29}\]4  
\[\Delta S(k+1)=-\beta S(k) \tag{29}\]5 Errors for P\({}_{2}\) tracking. \[\Delta S(k+1)=-\beta S(k) \tag{29}\]6 3D P\({}_{2}\) tracking control performance. All of the simulation results show that the bio-inspired non-linear dynamic model of the robotic fish is suitable to mimic biological features of Carangiform carp. In this way, biomimetic modeling can be easily implemented to the robotic fish prototype in the future work.