Research and experiments on electromagnetic-driven multi-joint bionic fish

Abstract Based on the characteristics of high-frequency swing during fast swimming of fish, this paper designs a bionic fish-driven joint based on electromagnetic drive to achieve high-frequency swing. Aiming at the characteristic parameters of high-frequency swing control, the Fourier transform is used to separate the characteristic parameters and then compared the driving accuracy of the joints in open-loop and closed-loop. The comparison results show that the closed-loop control is performed after Fourier transform. Under the same driving conditions, the closed-loop control method can improve the joint driving accuracy. Then a bionic fish robot composed of three joints is designed according to this method and Kane method is used to model it dynamically and combined with the central pattern generator control method to complete model simulation and related experiments. The experimental results show that the bionic fish prototype can swim faster under high-frequency swing under electromagnetically driven joints.


Introduction
Recently, underwater robot has been increasingly applied to a variety of situations, such as data collection underwater monitoring and underwater exploration for salvage, for example, Bluefin 21 was applied in the search for Malaysia Airlines Flight 370 [1]. It is well known that the vast majority of current underwater vehicles use screw propeller for propulsion because it is simple and easy to control. However, due to its large size, this type of underwater robot also has the disadvantages of difficulty in moving in small spaces, low movement efficiency, and high noise. With the acceleration of human exploration of the ocean and the continuous development and improvement of the discipline, fish that move flexibly downstream have become the object of imitation for most scholars studying new underwater robots today [2,4,5,6].
Fish can swim flexibly in the water, with strong mobility, and can complete the turning radius less than 0.3 BL. At the same time, fish can also coordinate each fin in the water, making use of the external fluid environment to make its movement achieve more than 80% swimming efficiency and long-term endurance [47]. For the convenience of classification, the fish propulsion modes are mainly divided into BCF (body and/or cadudal fin) and MPF (median and/or paired fin) modes according to different body parts used in swimming propulsion [7,8,9]. At present, most of the BCF propulsion mode bionic fish adopt a joint tandem mechanism [10,11,12,13,14]. In the past decades, many efforts have been devoted to developing robotic fish, which involves the studies of fish swimming propulsive mechanism, actuators, motion control, and so on. For example, Lauder and Tangorra [15] explored the theory of body and finbased movements from the perspective of biology; Yu et al. [16] developed robotic fish to examine the control mechanism of central pattern generator (CPGs); Butail et al. investigated the feasibility of regulating the collective behavior of zebrafish with a free-swimming robotic fish; and Wang et al. [17] investigated the path following control based on ribbon-fin propelled underwater vehicle.
Before the development of fish-like actuator, it is necessary to study the swimming mechanism of fish. Many scholars have also made important achievements in the swimming mechanism of fish [18,19]. Servo motor system is currently popular due to its good controllability and integration. The team of MIT David Barrett [20] successfully developed the first bionic robot fish "Robo Tuna" 8 years later; the team developed a new version: bionic yellowfin tuna "VCUUV" [21]. The front part of the body is composed of a rigid body, and the fish tail part is an articulated free swinging mechanism which adopts a crescentshaped tail fin. Its swimming speed is up to 1.25 m/s (0.5 BL/s), and it has the turning maneuverability of up to 75 • /s. However, it should be noted that the servo motor system not only provides powerful power output but also brings higher energy consumption and lower energy conversion efficiency, especially in the case of reciprocating clockwise and counterclockwise rotation. At the same time, the system based on servo motor is not easy to miniaturize in practical application, which leads to the large volume of bionic robot fish, and its large volume brings the problems of high production cost and maintenance trouble. At the same time, most of the bionic fish use single-joint or double-joint swing, and the number of joints is small, which cannot well simulate the swimming posture of live fish in the water. The rudder drive has the advantage of simple attitude control, which can simulate the swimming attitude of live fish realistically [22,23]. One of the representative is the "fish-G9" bionic fish from the University of Essex in the United Kingdom [24]. Its tail fin is controlled by three rudders, which can realistically simulate the swimming posture of live fish in the water. However, the steering gear does not have the same high strength and explosive force as the servo motor. At the same time, the steering gear group with high reduction ratio is added to reduce the response speed of the steering gear. The movement of fish in the water is usually realized by the reciprocating swing of fins, which is different from the traditional motor control based on speed or position closed-loop mode. However, the swing stiffness of bionic fish joint driven by actuator is too large, and the actuator is usually closed-loop position control, which has poor response to speed changes. With the development of intelligent materials, bionic fish made of intelligent materials have come out one after another [25]. For example, Shuxiang et al. [26] made attempts to propel robotic fish with shape memory alloy and Heo et al. [27] addressed the design of a biomimetic fish robot actuated by piezoceramic. Yet, the effective vibration frequency or driving force of the two actuators is limited. Therefore, a kind of driving element which can realize small angle swing is needed, especially for medium-sized bionic fish. The electromagnetic actuator satisfies this condition. In recent years, many researchers have considered the design, optimization, and application of solenoid as a widely used electromagnetic actuator. The solenoid is wound by a coil and placed in the magnetic field generated by the permanent magnet. When the current passes through the coil, the corresponding driving force is generated according to the Ampere law. Although the electromagnetic actuator is gradually applied to all kinds of robots, its application in small-and medium-sized bionic mechanical fish is rarely reported. In 2011, Li Jing [28] of Northwestern Polytechnical University of China and others used electromagnetic linear actuators as bionic muscles to achieve their millisecond response speed. In 2014, Frith and others [29] at the Singapore University of Technology and Design made an electromagnetically driven elastic actuator suitable for use as a muscle-like structure that can generate stress and strain when embedded in a solenoid coil. In 2015, Song and Lee [30] of Xijiang University in South Korea developed a solenoid actuator with a ferromagnetic plunger and applied the solenoid actuator to a multi-segment micro-robot to generate linear and rotational motion. Therefore, using this new electromagnetic actuator as the actuator of biomimetic robot fish, it is easy to achieve joint miniaturization and reliable underwater sealing. At the same time, using electromagnetic drive, it is convenient to simulate the fin swing of bionic fish at high frequency; at the same time, it also has the advantages of small volume and lightweight. This paper first introduces the design and control of the driving joints of a bionic robotic fish based on electromagnetic drive and builds a three-joint electromagnetically driven bionic tuna dynamic model. Then, based on the results of the dynamic simulation, the prototype and experiment of the bionic tuna are completed. Through comparative analysis, it is verified that the bionic fish prototype can achieve rapid swimming performance by electromagnetically driving the joints at high frequency.

Design and simulation of bionic and electromagnetic-driven joints
In this section, we will design the electromagnetic actuator according to the shortcomings of the above actuators, which is characterized by the simple structure of the driving joint and easy to achieve reliable underwater sealing. At the same time, the electromagnetic drive can simulate the fin swing of the bionic fish at high frequency, and it also has the advantages of small volume and lightweight.
The propulsive force of tuna fish mainly comes from the fluctuation of its spine, which can be regarded as a traveling wave from the head and neck to the tail, and the amplitude of the wave increases gradually. This traveling wave is called fish body wave for short [18].
According to the fish body wave control theory of biomimetic tuna, we determined that the fish body is 450 mm in length, 120 mm in width, and 60 mm in height. The body weight of the fish is less than 1 kg, and the maximum striking angle of the caudal fin is greater than 25 • and less than 35 • . Figure 1 shows the appearance of the bionic fish.
As shown in Fig. 1, the external contour of the whole fish is mainly composed of head, body, swinging joint, pectoral fin, and caudal fin. The section perpendicular to the spine axis is an ellipse with the ratio of length to width of 2 and converges rapidly into a caudal stalk at the rear. The swinging joint is composed of three electromagnetic driving joints in series to realize the straight-line cruise of the fish The tail fin is designed to imitate tuna and is crescent-shaped; the pectoral fin is driven by the steering gear to assist the fish to rise and dive in the water. After the tail swing model of bionic tuna is established, the underwater force is analyzed and the relevant parameters of the electromagnetic actuator are designed.
According to Biot-Savart's law [23], the electromagnetic induction strength near the coil follows the formula: where B is the magnetic induction, μ 0 is the vacuum permeability, I is the current, d l is the wire length, and R is the corresponding distance vector. The axial magnetic induction intensity of the coil can be calculated by Eq. (1), and the direction is determined by the right-hand rule, as shown in Fig. 2: where r is the radius of round wire, and θ is the angle between coil axis and magnetic field direction. In addition, the coil can be regarded as a large number of toroidal coils, as shown in Fig. 3.
There are four important shape-related parameters in the magnetic drive model [1]. It is marked in blue color in Fig. 3. The green line represents a circular current, the origin is located in the center of the  coil, and the magnetic induction intensity generated by the coil is represented by B s , and its size can be expressed by Eq. (3): where x is the coil thickness, r is the circle diameter, N is the total number of coils per layer, and n is the number of coil layers.
In Eq. (3), N/h and n/(D − d) can be used to convert them into continuous variables. In order to solve this integral, the following simplification is proposed.
The magnetic induction intensity generated by the circular current changed by r at the same point is constant, and it is equal to the magnetic induction intensity generated by r d = (D+d) / 2, and x / r d = tan β is obtained, which simplifies to get where β 1 is the maximum angle between the coil and the left edge, and β 2 is the maximum angle between the coil and the right edge. If β 1 and β 2 are regarded as independent variables, the magnetic induction produced by the coil at each point along the x-axis can be expressed by Eq. (4), that is, B S is constant at any point in the narrow space when x is constant. It is found that BS is linearly correlated with I, N, and n, and inversely proportional to h, as shown in Fig. 4. Figure 4 shows the relative intensity curve of the magnetic induction interval along the x-axis between the two magnets when the coil is located in the middle of the two magnets. Among them, red represents the magnetic induction intensity B s , which changes along the x-axis with the movement of the coil. B ml and B mr represent the magnetic induction produced by the left and right magnets, and the green curve is the magnetic force produced by the coil movement.
Metal alloy magnets include Nd 2 Fe 14 B magnets, samarium cobalt (SmCo) magnets, AlNiCo magnets, and ferrite magnets. The main raw materials of ferrite magnets include BaFe 12 O 19 and SrFe 12 O 19 . It is made by ceramic technology. It is hard and brittle. It has good temperature resistance and low price. It is widely used. However, the magnetic field distribution of common ferrite high-strength magnetic tile is uneven, which is related to the particularity of the arc of the tile. The magnetic line of force is concave in the middle and convex on both sides. AlNiCo magnet is an alloy composed of Al, Ni, Co, Fe, and other trace metal elements. The casting process can be processed into different sizes and shapes with good machinability. Cast AlNiCo permanent magnet has the lowest reversible temperature coefficient, and its working temperature can be as high as 600 • C. Generally, the higher the temperature resistance of the magnet, the weaker the magnetic force. The magnetic force is inversely proportional to the temperature resistance. Like ferrite, ferrite is also more resistant to high temperature than Nd 2 Fe 14 B. SmCo are divided according to their composition. As a rare earth permanent magnet, SmCo has highmagnetic-energy product (14-28MGOe), reliable coercivity, and good high-temperature resistance. But its material price is too expensive and its use is limited. Therefore, according to the type and use environment of the magnet required by this project, after experimental comparison and analysis, it is decided to choose Nd 35 H brand magnet, and its specification is 60 × 26 × 2.5 mm and its maximum working temperature range is 120 • which is suitable for motor magnetic tile. It is used to drive the magnetic tile on both sides of the electromagnetic joint to drive the power coil to realize the swing of the electromagnetic joint [28]. The finite element simulation of permanent magnet by ANSYS Maxwell software is shown in Fig. 5. According to the simulation results in Fig. 5, it can be seen that the electromagnetic strength of the permanent magnet increases rapidly from 340 mt to 850 mt when the abscissa in Fig. 5(b) is in the range of 76 mm to 104 mm, which is due to the high magnetic field strength inside the permanent magnet. It can be seen from Fig. 5(a). Therefore, with reference to the actual joint structure design, it is focused on the research that the strength can be close to the constant slope line within 15 mm from the magnet surface, and the electromagnetic strength is between 240 mT and 340 mT. In addition, ANSYS finite element analysis is carried out for the electromagnetic coil, and Maxwell module is used to simulate the electromagnetic strength of the electrified coil, as shown in Fig. 6.
According to Fig. 6(b), the magnetic field intensity curve at 25 mm along the axis of the coil center is taken. It can be seen that the magnetic field strength of the coil is lower than that of the permanent magnet in the range of 15 mm. In order to facilitate the calculation, the magnetic field of the coil can be obtained from 2 to 17 mT by fitting it with the first-order function. Because of its low magnetic field intensity, it has little effect on the motion of the system and can be ignored in the calculation.  Substituting the electromagnetic strength data of permanent magnet and electrified coil into the corresponding formula, the curve of corresponding joint thrust and deflection angle is obtained, as shown in Fig. 7.
As shown in Fig. 7 when the joint position is determined, the thrust on the electromagnetic coil is basically a function of the coil current.
From the spatial magnetic field intensity distribution in Fig. 8, it can be seen that when the coil is deflected by a certain angle, the magnetic field intensity in the bionic fish joint is not symmetrically distributed along the spiral coil swing axis, but it is concentrated at the closer coil. But the magnetic field strength of the coil far away is relatively weak.   Method two is different from method one, in which the two coils of the bionic fish joint pass the same current at the same time under any circumstances, so as to obtain greater torque. Although it consumes more energy and is less efficient than the first control method, this method can obtain greater torque in a short time, which is in line with the fast escape instinct of fish under external stimuli. It can be used for quick start of bionic fish in emergency situations.
According to the torque distribution diagrams obtained by the two joint control methods shown in Figs. 10 and 11, it can be seen that in the first method, the driving coil can obtain a larger torque while the driving current is small, which is suitable for bionic fish at low speed and large cruising under swing conditions; the dual coils driven by mode two can obtain greater torque, which is suitable for swimming in the emergency avoidance or escape mode without considering the driving efficiency of bionic fish.

Single-joint electromagnetically driven bionic fish control
With the bionic fish tail fins swinging rapidly, its control is different from the traditional closed-loop control of speed and position. Its control targets are swing frequency, amplitude, zero offset, and phase difference between joints and fish joints [9]. This section will use the fast Fourier transform (FFT) to calculate and control the swing and zero offset of a single joint of the bionic tuna [33,34].
Since the force of the first joint of the bionic tuna is the largest, the joint is used as a control target for attitude control [11]. The swing amplitude of the first joint is set to 6 • , the swing frequency to 2 Hz, and the zero offset to 0 • . Then the joint movement is driven by driving electromagnetic and the realtime swing angle of the joint is obtained through the Hall sensor. Then, the sampling frequency is set to 100 Hz and 1024 data points are collected in each group.
Based on the data of the electromagnetically driven joint under open-loop driving, we can see from In Fig. 12(b), the joint swing frequency swings around 2 Hz. This is due to the sampling rate Fs and the total number of samples N. The frequency resolution Fr is Therefore, it can be obtained that the frequency resolution is 0.098 Hz, which is in accordance with the trend of the curve of Fig. 12(b). According to Eq. (5), if you need to improve the frequency resolution, you can reduce the sampling rate and increase or decrease the number of samples at the same time, but this will also reduce the system response speed. At the same time, through comparison, it can be found that the joint swing frequency is almost constant in the open-loop mode. Therefore, under the condition that the setting conditions are not changed, Proportion Integration Differentiation (PID) closed-loop control is performed on the joint swing amplitude and the zero-offset amplitude [35,36]. The control flowchart is shown below.
The deviation e(t) between the swing amplitude of the joint and the input value R(t) and output value Y (t) of the zero-offset amplitude is taken as the input of the controller. Then, the e(t) is expressed as: The PID control algorithm is The transfer function is In the expression, K p is the proportional coefficient, T i is the integral time constant, and T d is the differential time constant. The tracking values of joint swing and zero point offset are measured. After many adjustments and measurements in the extended critical scale method, K p is set to 0.44, T i is set to 4, and T d is set to 2.5. The control program is written according to the control flowchart in Fig. 13 and the joint swing data is read to get Fig. 14.
Combining the open-loop control data of Fig. 12 and the closed-loop control data of Fig. 14, it can be seen that after Fourier transform, the zero-offset amplitude and joint swing amplitude of the bionic fish joint are separated from the original data and then compared by PID calculation for the smooth control of joints. By comparing Fig. 12 with Fig. 14, it can be seen that under the same setting parameters, the amplitude control error after closed-loop control is reduced from 0.4 • to 0.02 • , and the zero-offset error is reduced from 2 • to 0.25 • . The motion status of the bionic fish joints is more in line with the parameter setting requirements.

CPG control analysis of multi-joint bionic tuna based on Kane dynamic model
At present, there are three common motion control methods for bionic fish: the motion model fitting method based on the fish body wave curve [14], the control method based on the equivalent simplified hydrodynamic model, and the imitation center pattern generator model [37,38,39]. Among the bionic control methods, the bionic control method based on CPG has been established and improved one after another. In this paper, for multi-joint bionic tuna, a CPG-based control method is used [40,41,42].
Suppose the bionic tuna has n joints, where joint 0 represents the head of the bionic fish and joint n-1 represents the caudal fin joint, let the world coordinate system of the bionic fish be O E -X E Y E Z E [43]. The local coordinate system of each swing joint is O i -x i y i z i (I = 1,. . . ,n-1), where the origin of the local coordinate system O i at the end of each joint, x i shaft along the axis of the connecting rod. The axis is perpendicular to the horizontal plane where the connecting rod is located z i . The axis direction follows the right-hand rule. The length of each joint of the fish body is l i and the quality is m i , and the bionic fish joint linkage mass distribution is set evenly. Its center of gravity G i (x i g ,y i g ,z i g ) coincides with geometric center G i (x i c ,y i c ,z i c ). Definition θ 0 means the angle between the axis of joint 0 and the x-axis of the world coordinate system, and θ i (I = 1, . . . , n-1) represents the angle between the link axis of joint i and the link axis of joint i-1. At the same time, R 0 E is defined to represent the transformation matrix from the world coordinate system The rotation matrix of the coordinate system is O i+1 -x i+1 y i+1 z i+1 , so that ( Fig. 15): Since the dynamic analysis in this section is limited to the movement of the bionic fish in the horizontal plane, the position coordinates (x, y) of the head joints and the relative rotation angles of each joint θ 1 , θ 2 , . . . , θ n-1 are selected as bionics. The generalized coordinates of the fish are (x, y, θ 1 , θ 2 ,. . . ,θ n−1 ), and then the generalized speed of the system is expressed asq = (ẋ,ẏ,θ 1 ,θ 2 , . . . ,θ n-1 ).

Kinematic Analysis of Bionic Tuna
Let − → r Oi represent the position vector of the local coordinate system origin O i and the world coordinate system origin O E of each joint, and its expression in the local coordinate system O i -x i y i z i is given as: Among them, (i = 1,. . . ,n-1),the position vector − → r Ci of the center of mass C i of each joint link to the origin O E of the world coordinate system in the local coordinate system O i -x i y i z i is expressed as:

Analysis of Angular Velocity and Angular Acceleration
During the movement of the bionic tuna in the water, the expressions of the angular velocity ω i and the angular acceleration − → β i of the joint i in the world coordinate system in its local coordinate system

Linear Velocity and Acceleration Analysis
During the movement of the bionic fish, the velocity of the centroid point C i of the joint i relative to the world coordinate system − → v C i and acceleration − → α C i are expressed in the local coordinate system O i -x i y i z i as:

Kinetics Analysis
Before solving the generalized inertial force and generalized motive force of the bionic tuna, the fluid mechanics analysis of the bionic tuna is first performed. Since this section focuses on the planar motion of the bionic tuna, it is assumed that the buoyant gravity it receives in the vertical plane is balanced.

Hydrodynamic Analysis
In order to facilitate the analysis, the calculation method under the large Reynolds number is adopted, and the more important fluid force is selected for solving, for example, differential pressure resistance, inertial resistance, etc. In order to conveniently describe the motion of bionic tuna in fluid, first the relative speed of bionic tuna relative to fluid − → v R i and relative acceleration − → α R i are defined: Among them, − → v F i , − → α F i are the expression of the velocity and acceleration of the fluid in the world coordinate system in the local coordinate system O i -x i y i z i (I = 1, . . . , n-1). The bionic tuna test environment is static, so its fluid velocity acceleration is set to 0.

Additional Mass
When the bionic tuna swims in the water, the nearby fluid movement 6 × 6 will be driven by the fish's swing, so that it produces an additional mass effect. The additional mass force can be described by an additional mass matrix. For an object completely immersed in an unbounded fluid, its additional mass coefficient can be regarded as a constant: where F * A i is the inertial force due to additional mass, M * A i is the inertia moment due to additional mass, ω i and v R i are the skew-symmetric matrices, and I A i represents an additional mass matrix.

Force Analysis of fish
During the movement of the fish body, it is affected by the differential pressure resistance and the crosssectional resistance. Here, it is calculated using the common form under the large Reynolds number: where ρ represents the fluid density, v R i represents the relative speed of joint i, C D and C F represents the resistance coefficients in the y-axis and x-axis directions, and S x i and S y i represents resistance coefficients in the y-axis and x-axis directions.
The resulting resistance moment is expressed as:

Force Analysis of Caudal Fin
During exercise, the fluid will cause lifting resistance to the tail fin, and its stress is shown in Fig. 16. During the movement, the fluid velocity through the upper and lower surfaces of the caudal fin is different, and the pressure difference between the two sides of the caudal fin forms a lift [44] With reference to relevant literature, the relationship between the resistance of the tail fin lift is The angle between the caudal fin axis and the direction of fluid motion is α,so that the expression of the lift L and the resistance D in the local coordinate system of the joint O n−1 -X n−1 Y n−1 Z n−1 is The acting moment of the tail fin is

Driving Torque of the Joint
The driving torque generated by the joint will balance the interaction torque with other driving joints and fluids when the bionic fish is moving; let the torque provided by the joint i be in the local coordinate Therefore, under the system's acting force and acting moment, the acting force F i and acting moment M i of each joint are

Generalized Inertial Force
The Kane method calculates the generalized inertial force of the system by using the deflection velocity ∂vC i /∂q r (r = 0, ..., n + 2) and the deflection angular velocity ∂ω i /∂q r (r = 0, ..., n + 2) degrees. The generalized inertial force formula of the system is where K inr represents ggeneralized inertial force, F ini is for joint forces, and M ini represents the acting moment of joint.
The generalized inertial force generated by the additional mass is Thus, the generalized inertial force of the bionic fish when it moves underwater is obtained.

Generalized Driving Force
At the same time, when the Kane method calculates the generalized main power, the generalized main power of the bionic fish is obtained by summing the scalar product of the main power acting on each particle in the particle system and the deflection velocity of the point, as follows:

Kane Equation
According to the principle that the generalized inertial force and the generalized main force in the Kane equation are equal, the Kane equation of the system is constructed: By solving this Kane equation, the key motion parameters of the bionic fish's propulsion speed are calculated [45].

Simulation of bionic fish dynamics model
A validation simulation of the Kane dynamics model is given below. A set of amplitude parameters is selected, and the key simulation parameters of bionic tuna are given in Table I. Fig. 17 shows the results of simulation experiments under a set of CPG parameters.
The CPG drive frequency is set to 3 Hz, the phase difference between the joints to 0.3π , and the swing amplitudes of each joint to be 0.26 rad, 0.26 rad, and 0.12 rad; the drive signals of each joint and the bionic fish's water moving speed is shown in Fig. 16.  Among them, Fig. 17(a) is the CPG control signal of the bionic tuna, and Fig. 17(b) is the forward swimming speed of the bionic fish; it can be seen from Fig. 17 that after 2 s of acceleration, the bionic fish swimming speed is stable at 0.16 m/s; by setting different driving frequencies and phase differences of the joints, a swimming speed change diagram of the bionic tuna underwater is obtained, as shown in Fig. 18.
According to the dynamic simulation data of bionic tuna, it is known that the swimming speed of bionic fish increases with increasing frequency; when the frequency is kept constant, the phase difference of joint swing gradually increases in the interval [0, 0.5π ]. The swimming speed of bionic fish increases first and then decreases gradually, but the amplitude of the speed change has less influence on the relative frequency.

Experiments of the bionic fish prototype
The overall design of bionic tuna based on theoretical analysis is shown in Fig. 19.
The bionic tuna prototype is mainly divided into three parts: fish head, swing joint, and caudal fin. The interior of the bionic tuna fish head is designed as a closed compartment for installing a control circuit board. The power cable is connected to the battery through a waterproof switch; the control cable and the sensor cable are connected to the first joint, the second joint, and the third via the battery compartment.  The electromagnetic coil of the joint is connected to the angle sensor; the bionic tuna's pectoral fin servo is directly connected to the main control board. The elliptical vertebral shape of the fish head is beneficial to reduce the water resistance. The internal control system of fish head mainly includes the main control circuit board, wireless communication module, power regulator module, attitude measurement module, and joint drive module. The circuit board installation is shown in Fig. 20.
Among them, the switch regulator module uses two groups of MP2451 switches, the regulator chip outputs 5V and 13.5V DC power to the main controller and the board bridge driver, respectively, and the main control chip uses STM32F405 control chip. Wireless communication uses NRF24L01, shortdistance transmission speed is fast and stable and reliable; the bionic fish attitude sensor uses MPU6050 three-axis gyroscope, which is used to measure the bionic fish head swing frequency and yaw angle, which can control the swimming direction of bionic fish in closed loop. According to the driving mode of the electromagnetic coil, the coil control method of mode two is adopted, and the electromagnetic driving board composed of three H-bridges is designed to drive the three joints of the bionic fish [46].

Experimental Test of Swing Factor
The experimental setup is shown in Fig. 21. As shown in Fig. 21, the infrared camera is fixed on the upper bracket of the bionic tuna prototype; the bracket is made of aluminum profile and its size is 1.6 m × 0.6 m × 1 m;a rotatable base is installed along the vertical axis of the center of gravity of the bionic tuna, and the bionic tuna fish body is supported by the base to simulate its suspension in the water; the bionic tuna powers the bionic fish control system through a DC power supply; the bionic tuna sensor data pass. The serial communication module feeds back the data to the LabVIEW host computer and displays it. The bionic tuna prototype is shown in Fig. 22. Figure 22 (a) is a prototype of bionic tuna. There is an infrared marker lamp bead on the back of the bionic fish, which is captured and displayed by an infrared camera. The display picture is shown in Fig. 22 (b). An infrared indicator lamp is fixed at the top and the end of the head to observe the swing amplitude of the head and tail of the bionic fish, and then an infrared indicator lamp is fixed at each  rotating joint to observe the swing amplitude of the head and tail of the bionic fish. Finally, an indicator light is fixed at the connection position between the bionic tuna and the rotating base to indicate the swing center of the bionic tuna. Infrared camera can capture the infrared light of lamp beads, which can effectively filter out the interference of environmental visible light, and is conducive to the observation of bionic fish posture and later data analysis.
In the process of high-frequency swing, the upper computer for data acquisition of bionic fish motion posture is designed. The joint angle sensor and three-axis gyroscope angular accelerometer sensor inside the bionic tuna are used to feed back the swing data of bionic fish and the data after Fourier transform of single-chip microcomputer to the upper computer quickly, which improves the measurement accuracy of motion posture and strengthens the operator's understanding of bionic gold observation of the realtime movement state of gunfish. This topic uses the visa interface of LabVIEW, and the data acquisition host computer interface is shown in Fig. 23.
Through the bionic tuna data acquisition software, the LabVIEW command is sent to the lower computer, and then the movement parameters of the bionic tuna are returned to the computer; through the waveform chart display, finally the data are transferred to the later stage for analysis.
The bionic tuna is installed on the rotating base, the center of gravity is on the rotating axis of the rotating base, and then the infrared marker lamp beads are pasted on the front of the head, the center of gravity, the rotation center of the bionic fish joint and the end of the caudal fin respectively; then the infrared camera is arranged on the upper end of the bionic fish, and different control frequencies, amplitude, and phase difference of the joint are set to control the swing of the bionic fish through the LabVIEW video capture. Then the images are processed and compared with the data collected and calculated by the sensor. Finally, the coordinates of the top of the head and the trailing edge of the tail fin in the plane are obtained. The motion test posture of the bionic tuna prototype is shown in Fig. 24.
The maximum swing of the head and tail is tested under different frequencies and different phase differences and then the swing factor is calculated under different conditions according to Eq. (32), as shown in Table II: As the bionic tuna driven by electromagnetic joints continues to increase swing frequency, the swing amplitude of its head and tail gradually decreases, and as the swing phase difference between the joint fish joints increases, its swing amplitude also gradually decreases.
The bionic tuna prototype has different swing frequency and joint phase differences, and the head swing factor is in the range of the head swing factor of the plover. As the test is performed in air, the air resistance of the fish is less. The swing amplitude is large, and most of the swing factors are in the interval [0.3, 0.4]. Through the data collected in the above table, and processing the data, the following images are obtained.
It can be seen from Fig. 25 that with the increasing of the swing frequency, the swing amplitude of the head and tail of the bionic tuna driven by the electromagnetic joint gradually decreases, and with the increase of the swing phase difference between the joints, the swing amplitude also gradually decreases.

Bionic tuna underwater cruise experiments
The control parameters of the bionic fish under the small head swing factor can be obtained in this section [16]. This section will test the transformation relationship between the bionic tuna swimming speed, amplitude, and phase difference at different frequencies.  The underwater experimental environment of the bionic tuna is a glass basin with a size of 1.5 m × 0.5 m × 0.5 m, and the power line of the bionic tuna is connected with the internal control circuit of the fish body after being sealed by watertight adhesive. By controlling the swing frequency of the bionic tuna and the phase difference between the joints, different swimming speeds and joint swing curves of the prototype in water were obtained.
Because this test will be performed in a pool, the bionic tuna prototype needs to be watertight-treated and tested before the experiment, and the prototype is completely immersed in the pool by adding a weight block. The control parameters are selected as f = 2Hz and ϕ = 0.2π to get the motion sequence diagram of bionic tuna prototype in underwater linear cruise in Fig. 26.
From Table III, it can be seen that when the frequency reaches 4 Hz and the phase difference between the joints is 0.2π and 0.3π , the bionic tuna swims at a maximum speed of 0.16 m/s. The above data are obtained through actual collection through the above table, and the data are processed to obtain the curves in Fig. 27.
As shown in Figs. 26 and 27, the tail fin swing frequency of bionic tuna based on electromagnetic drive can easily meet the needs of high-frequency swing. When the frequency interval is [1,4], the swimming speed of the bionic tuna increases with increasing amplitude, and the change of the swing phase difference between the phase joint and the joint has no significant effect on the swimming speed. Through the observation of the host computer, it is found that this is due to the use of electromagnetic coils to drive; the torque coupling between joints and joints has a greater impact, so that as the frequency increases, the swing between joints does not follow the set phase poor drive.
As the frequency continues to increase, the swing amplitude of the bionic tuna joints also gradually decreases, so the swimming speed increase of the bionic tuna at 4 Hz is relatively small. If the voltage on both sides of the coil is increased while increasing the frequency, this trend can be reduced. Therefore, at the end of this experiment, aiming to maximize the swimming speed, the external booster module was used to increase the voltage value of the electromagnetic driver to 35 V. When the driving frequency was 5 Hz, the control speed was 0.18 m/s, when the swing phase difference was 0.3π . The head swing data of the bionic fish collected by the upper computer at this time are shown in Fig. 28. From the data collected by the upper computer, it can be seen that the phase difference of the bionic fish joint is 0.27 π and 0.41 π , respectively, under the high-frequency swing, while the swing frequency is stable at 5 Hz, and the relative axis zero-offset fluctuates within ± 4 • during the swing, which has a negligible impact on the straight-line cruise of the bionic tuna; while the bionic fish joint amplitude curve basically moves within a fixed range.
The experiments in this section are mainly for the principle test of the bionic fish prototype. The test results show that the overall weight of the bionic fish meets the design requirements, and the density of the fish body is slightly less than that of the water. The adjustment of the immersion depth of the fish body can be achieved by adding weight blocks; the lower sealing performance is good, and there is no water leakage during swimming. The internal circuit board of tuna head can drive the joint to swing normally underwater and feed back the joint data in real time; the electromagnetic drive can easily realize the high-frequency swing of the joint, and there is almost no noise during the movement. The underwater environment of the bionic fish prototype can realize the swimming in the designed motion posture, increase the swing frequency of the fish body, and increase the swimming speed; the fastest swimming speed is 0.18 m/s.

Conclusion
This paper proposes a new type of three-joint bionic tuna based on electromagnetic drive and completes the structural design and control system design of the bionic fish, compared with the existing driving methods of different types of bionic fish at home and abroad, aiming at the advantages and disadvantages of the steering gear drive and motor drive; in order to realize the high-frequency swing of medium-sized bionic fish, a bionic fish driving joint based on the principle of electromagnetic drive was designed. Based on the two-dimensional wave plate theory, the relationship between the joint swing frequency and the water resistance is obtained. Maxwell electromagnetic simulation software carries out finite element analysis on the driving torque of the joint and obtains the relationship between the torque of the driving joint of the bionic fish and the current and deflection angle, to verify that the bionic tuna joint can overcome the water resistance to complete the motion under high-frequency swing. Finally, the effective swing frequency range of the joint is 1∼ 5Hz, which meets the design index, and makes an experimental prototype. Fourier transform is adopted to realize the closed-loop control of the joint swing of the bionic tuna; the swing frequencies of the head and tail of the bionic tuna are 1 Hz, 2Hz, 3 Hz, and 4 Hz. The test of the swing amplitude under the phase difference between the swing of the π and 0.5π joints has calculated that the head swing factor h t of the bionic tuna satisfies the range of 0.15 to 0.4. Finally, an underwater bionic fish swing experiment was performed to test its swimming speed at different swing frequencies and phase differences. The main influencing factors of the swimming performance of the bionic fish prototype were analyzed. The fast swimming speed verifies the conclusion that the bionic tuna prototype can achieve relatively fast swimming performance based on electromagnetically driven joints with high-frequency swing.