# Three-Dimensional Modeling of a Robotic Fish Based on Real Carp Locomotion
## Three Dimensional Dynamic Model and Motion Equations of the Robotic Fish
### Hydrodynamic Forces Acting on the Tail  
As shown in Figure 6, hydrodynamic forces depend on the tail motion and there are five main hydrodynamic forces acting on the tail. Inertial fluid force is \(F_{V}\), lift force is \(F_{J}\), thrust force is \(F_{F}\), lateral force is \(F_{C}\) and drag force is \(F_{D}\). It is considered that tail fin of the robotic fish flaps in constant flow representing by \(U_{m}\) so that the inertial and lift forces influence the caudal fin. Afterwards, thrust force and lateral force components are calculated by using inertial fluid and lift forces. The value of constant flow is determined as 0.08 m/s to reduce the turbulent effects [35]. According to Figure 6, \(F_{V}\) is a proportional force to the acceleration and it is calculated by Equation (2) and the lift force is also vertical to the flow and it is defined as Equation (3):  
\[F_{V}=\pi\rho LC^{2}\dot{U}\sin(\alpha)+\pi\rho LC^{2}U\dot{\alpha}\cos(\alpha) \tag{2}\]  
\[F_{J}=2\pi\rho LCU^{2}\sin(\alpha)\cos(\alpha) \tag{3}\]  
here, the chord length is \(2C\), the span of the caudal fin is \(L\), density of the water is \(\rho\), relative speed at the center of caudal fin is \(U\) and the angle of attack is \(\alpha\). Relative speed and angle of attack variables are time dependent and the first derivative of these should be obtained, smoothly. These forces are separated into the thrust force on the x-axis and lateral force on the y-axis components:  
\[F_{F}=(F_{V}-F_{J})\sin(2\pi-\sum_{i=1}^{N}\theta_{i}) \tag{4}\]  
\[F_{C}=(F_{V}-F_{J})\cos(2\pi-\sum_{i=1}^{N}\theta_{i}) \tag{5}\]  
If motion of the robotic fish is considered in the x-axis direction, the relative speed on the center of caudal fin in the y-axis direction is expressed by the following equation:  
\[ \begin{array}{ll}u_{f}=&l_{1}\dot{\theta}_{1}\cos(\theta_{1})+l_{2}(\dot{ \theta}_{1}+\dot{\theta}_{2})\cos(\theta_{1}+\theta_{2})\\ &+l_{3}(\dot{\theta}_{1}+\dot{\theta}_{2}+\dot{\theta}_{3})\cos(\theta_{1}+ \theta_{2}+\theta_{3})\\ &+l_{4}(\dot{\theta}_{1}+\dot{\theta}_{2}+\dot{\theta}_{3}+\dot{\theta}_{4}) \cos(\theta_{1}+\theta_{2}+\theta_{3}+\theta_{4})\\ &+a_{5}(\dot{\theta}_{1}+\dot{\theta}_{2}+\dot{\theta}_{3}+\dot{\theta}_{4}+ \dot{\theta}_{5})\cos(\theta_{1}+\theta_{2}+\theta_{3}+\theta_{4}+\theta_{5}) \end{array}  \tag{6}\]  
Relative speed on the center of caudal fin \(U\) is determined by \(\sqrt{{U_{m}}^{2}+{u_{f}}^{2}}\), because \(U_{m}\) and \(u_{f}\) are perpendicular to each other. The thrust force \(F_{F}\) pushes the robotic fish in the forward direction. Figure 6: Hydrodynamic force distributions acting on the tail. The drag force \(F_{D}\) acts on the fish body in the flow direction by the friction. The definition of the drag force is presented in Equation (7):  
\[F_{D}=\frac{1}{2}\rho C_{D}V_{f}^{2}S \tag{7}\]  
where, \(C_{D}\) is the drag coefficient, \(V_{f}\) is the relative speed of the robotic fish and \(S\) is the area of the main body. The head of the robotic fish is assumed as conic and the value of drag coefficient is defined as 0.5. Both hydrodynamic and external forces act on the robotic fish tail. These forces are called with \(\tau_{i}=[\tau_{1},\tau_{2},\tau_{3},\tau_{4},\tau_{5}]^{T}\) which affect to the \(i\)th link, and can be expressed by:  
\[\text{if}\left\{ \begin{array}{l}active\_link\rightarrow\tau_{i}=F_{C}l_{i} \cos(\sum\limits_{i=1}^{N}\theta_{i})-F_{F}l_{i}\sin(\sum\limits_{i=1}^{N} \theta_{i})+T_{i-1}^{u}\\ passive\_link\rightarrow\tau_{i}=F_{C}l_{i}\cos(\sum\limits_{i=1}^{N}\theta_{ i})-F_{F}l_{i}\sin(\sum\limits_{i=1}^{N}\theta_{i})\end{array} \right|_{last\_link \to l_{i}=a_{i}} \tag{8}\]  
The designed robotic fish is driven by three active joints that generate the thrust force. These joints are actuated by three DC servo motors with input torques \(T_{i}^{u}=A_{\max}\sin(2\pi f_{T}t\pm\Delta_{i})\). \(A_{\max}\) is the amplitude of input torque, \(f_{T}\) is the frequency of input torque and \(\pm\Delta_{i}\) is the phase angle between the two input torques.