# Design and Motion Simulation of an Underwater Glider in the Vertical Plane
## 3 Mathematical Model  
To facilitate the study and analysis of the six degrees-of-freedom motion of the marine vessel, two different reference coordinate systems [12] were established: the Earth-fixed reference coordinate system (E-XYZ) and the body reference coordinate system (O-xyz). The Earth-fixed reference coordinate system uses any point at sea level and sets the floating center position of the underwater glider as the origin of the body reference coordinate system. The motion reference coordinates are shown in Figure 4.  
The transformation matrix from the body-fixed frame O-xyz to the Earth-fixed frame E-XYZ is as follows:  
\[\mathbf{R}=\left[ \begin{array}{ccc}\cos\psi\cos\theta&-\sin\psi\cos\phi+\cos \psi\sin\theta\sin\phi&\sin\psi\sin\phi+\cos\psi\cos\phi\sin\theta\\ \sin\psi\cos\theta&\cos\psi\cos\phi+\sin\phi\sin\theta\sin\psi&-\cos\psi\sin \phi+\sin\theta\sin\psi\cos\phi\\ -\sin\theta&\cos\theta\sin\phi&\cos\theta\cos\phi\end{array} \right] \tag{22}\]  
Figure 4: Motion reference coordinates. The position of the glider \(\mathbf{b}=(x,y,z)^{T}\) is the vector from the origin of the earth reference frame to the origin of the body-fixed frame. The linear motion velocities and angular velocities of the glider are expressed as \(\mathbf{v}=(v_{1},v_{2},v_{3})^{T}\) and \(=(\omega_{1},\omega_{2},\omega_{3})^{T}\), respectively. For a vector \(\mathbf{x}=(x_{1},x_{2},x_{3})^{T}\), the skew-symmetric matrix is expressed as follows [13]:  
\[\overset{\wedge}{\mathbf{x}}=\left[ \begin{array}{ccc}0&-x_{3}&x_{2}\\ x_{3}&0&-x_{1}\\ -x_{2}&x_{1}&0\end{array} \right] \tag{23}\]  
For any vector \(\mathbf{y}=(y_{1},y_{2},y_{3})^{T}\), the vector product of \(\mathbf{x}\) and \(\mathbf{y}\) is expressed as  
\[\overset{\wedge}{\mathbf{x}}\overset{\wedge}{\mathbf{y}}=\mathbf{x}\times \mathbf{y} \tag{24}\]  
Subsequently, the kinematics of a glider can be written as  
\[\dot{\mathbf{R}}=\overset{\wedge}{\mathbf{R}}\overset{\wedge}{\omega} \tag{25}\]  
\[\dot{\mathbf{b}}=\mathbf{R}\mathbf{v} \tag{26}\]  
Let \(\mathbf{P_{E}}\) and \(\pi_{E}\) represent the total linear momentum and angular momentum of the UG in the Earth-fixed reference coordinate, respectively; \(\mathbf{P_{\Pi,E}}\) and \(\mathbf{P_{P,E}}\) represent the total momentum of the movable mass and piston in the Earth-fixed coordinate, respectively [13]. \[\dot{\mathbf{P}}_{E}=\overset{I}{\underset{i=1}{\sum}}f_{\mathbf{ext},i} \tag{27}\]  
\[\dot{\pi}_{E}=\overset{I}{\underset{i=1}{\sum}}\Big{(}\mathbf{x}_{i}\times f_{ \mathbf{ext},i}\Big{)}+\overset{I}{\underset{j=1}{\sum}}\mathbf{\tau}_{\mathbf{ext},j} \tag{28}\]  
\[\dot{\mathbf{P}}_{\Pi,E}=\overline{m}g\mathbf{k}+\overset{K}{\underset{k=1}{ \sum}}f_{int,\overline{m}} \tag{29}\]  
\[\dot{\mathbf{P}}_{p,E}=m_{p}g\mathbf{k}+\overset{K}{\underset{k=1}{\sum}}f_{ int,m_{p}} \tag{30}\]  
Here, \(k\) is a unit vector point in the direction of gravity, \(f_{\mathbf{ext},i}\) the external force exerting on the glider system, and \(\mathbf{\tau}_{ext,j}\) the external torque applied to the system. Vector \(x_{i}\) applies the point of application of the external force with respect to Earth's reference frame. The force \(f_{int,\overline{m}}\) exerts on the movable mass from the glider body, and \(f_{int,m_{p}}\) is the force applied from the glider body onto the piston. Let \(\mathbf{P}\) represent the total linear momentum of the glider-fluid system expressed in the body-fixed reference frame. Let \(\mathbf{\Pi}\) be the total angular momentum of the origin of the body coordinate. Let \(\mathbf{P_{\Pi}}\) represent the momentum of the moving mass and \(\mathbf{P}_{p}\) the momentum of the pistons in the body frame.