A FUZZY ALGORITHM FOR THE C-SHAPE TURNING OF BIOMIMETIC ROBOTIC FISH.

Baodong Lou 1 , Yujie Ni 2 , * Minghe Mao 3 , Ping Wang 2 and Jiangtao Liu 1 . 1. School of Mechanical and Electrical Engineering, Hohai University, Nanjing 210098, China. 2. School of Energy and Electrical, Hohai University, Nanjing 210098, China. 3. School of Computer and Information, Hohai University, Nanjing 210098, China. ...................................................................................................................... Manuscript Info Abstract ......................... ........................................................................ Manuscript History

The swimming maneuverability of a robotic fish depends on the performance of its sharp turning ability including C-shape and S-shape turning. In this paper, we optimize the control of C-shape turning, by using a fuzzy logic control algorithm in which the angular velocity of each robot joint is tuned. Compared with traditional control algorithms, the proposed algorithm can adjust the fish joint turning angle timely to overcome the inertia problem which causes an excessive turning radius. The experimental results with real robotic fish have shown that the turning gesture of the robot is more fluent and the swimming trajectory is smoother with the proposed method.

…………………………………………………………………………………………………….... Introduction:-
Fish in nature have superb swimming ability in preying, escaping from enemies, mating or other survival needs. They can maintain high efficiency and low loss in long distance swimming, can achieve a high speed in a very short time from static. In recent years, biomimetic robotic fish having the advantages of high efficiency and flexibility becomes a hot spot in underwater robot research [1]. Due to the special working environment, the surrounding scenario of the biomimetic robotic fish is complex and uncertain. It is necessary to introduce artificial intelligence and autonomy to biomimetic robotic fish to deal with variant situations. One of the important swimming features is C-shape turning [2], optimizing its control algorithm improve the underwater mobility of the robot.
At present, the methods of biomimetic robotic fish swimming control are mainly based on a curve fitting method of fish body curve using few tail linkages, or a simple sinusoidal controller method for each joint motor, or a central model generator of the motion control method. Most of the research works are implemented on cruise swimming, but few on the study of sharp turning. The sharp turning [3][4] refers to the fish from quiescent state or cruising state, swinging instantaneously to rapidly change the body direction, to achieve a rapid turning to adjust the direction of head movement. According to the body bending shape when a fish is turning, the turning shape can be modeled as S-shape and C-shape [5]. The S-shape turning refers to the initial shape of the initial fish into the S-shaped, C-shape turning refers to the fish in the initial turn when the fish into a C-shaped. Where S-shape turning is treated as a special kind of C-shape turning, which is formed during the progress of turning while the trunk of fish is difficult to withstanding water resistance [6][7]. Compared two turning, C-shape turning is more common, and has a better performance. Many works have been done on C-shape turning: Harper measures the fast starter motion parameters of the northern barracuda, Domenici and Blake study C-shape turning of angel fish [8] which points out that the size of the fish is independent of the length of the escape process but is linearly related to the turning radius. Kasapi [9] and other studies have pointed out that the C-shape turning can be divided into two categories: single bend and ISSN: 2320-5407 Int. J. Adv. Res. 6(1), 1502-1511 1503 double bend according to the tail shape. Hu [10] in 2003 used artificial pseudo-compression method to study the action of caudal fins in fish C-shaped turning. By analyzing the numerical simulation of caudal fins, it is concluded that the average thrust at the time of C-turning is generated by the vortex in the vicinity of trailing edge produce. There are several ways to control the C-shape turning: the Essex University biomimetic robotic fish research group uses the curve fitting method to obtain the movement equation of C-shape turning for biomimetic robotic fish after investigating real fish C-shaped movement curves. Liu [2] transferred a kinematics equation of C-shape turning into a look-up table, and realized a C-shape turning with a peak speed of 120 degree/s. In order to control the turning performance according to the dynamic analysis of the fish swimming through the C-shape turning, Yu [11] has done a lot of simulation and experiment to obtain the characteristic parameters of the robotic fish turning by increasing joint offset angle. Compared with the equation developed by the Essex University biomimetic robotic fish research group, the kinetic equation calculated by the University of Science and Technology of China focuses on the fluid dynamics analysis could not make better sense for practical application. Since the complex fluid dynamics cannot been applied online using on board computer, and the some swimming parameters can be adjusted by expert experience by setting the rules and conditions, the fuzzy control algorithm [12] is adopted in this paper to adjust the angle of the joint in real time. Although, the fuzzy control algorithm has been used in C-shape turning control before [9], the influence of C-shape turning angular velocity on the joint rotation angle has not been taken into account, which will cause unsmooth C-shape turning and the inertia of the robot will make a high turning resistance and a small turning angle during a high speed moving.
In this paper, based on the traditional C-shape control algorithm, a fuzzy control algorithm using angular velocity feedback is proposed for optimizing the C-shape turning of the biomimetic robotic fish. Compared with the traditional algorithm, the fuzzy logic controller feedback using swimming angular velocity can make the C-shape turning speed changing more smoothly, moreover, the turning posture will be smoother and the influence on the joint turning angle caused by velocity inertia will be reduced significantly in case of the controller timely adjusting the biomimetic robotic fish joint turning angle. Finally, the feasibility and practicability of the algorithm are verified by experiments. Figure 2-1 shows the structure of the biomimetic robotic fish investigated in this experiment. The whole fish consists of the fish head, the rigid front of the fish, the flexible swing of the posterior and the caudal fins (this algorithm for BCF propulsion mode does not consider the role of pectoral fins). The shell of the biomimetic robotic fish is printed by 3D printer using ABS material, while it adopts distributed control system consists of a main central control unit commanding several sub-units inside [14]. The main central control unit operates on a BeagleBone board using the RS485 bus to command and make interactive communication with other sub-units such as the radio frequency (RF) unit, the fish mouth unit, the infrared sensor unit, the center of gravity adaptive unit, the wireless charging unit and the motion unit, as shown in Figure 2-1. Where the motion unit consists of three joints whose rotation angles can be individually changed to achieve different body movement patterns simultaneously. The infrared sensor unit can judge whether there is any obstacle around while the biomimetic robotic fish is cruising. Once the obstacles are detected, the fish will execute a C-shape turning motion. In order to make reliable judgments three infrared sensors respectively locating in both side of the fish head and the fish mouth are adopted for the infrared sensor unit. Figure 2-2 draws the C-shape turning flow chart. When the fish is suspending in water, the information (regardless of the wave interference) on the obstacles around the fish head is collected and then transmitted to the central control unit through the RS485 bus or to the host computer through the RF unit to help the motion unit controlling the fish body to avoid collision. The tail movement module consists of three servos whose rotation angles can be controlled to fit the kinetic body curve of the real fish. The floating or diving movement are achieved by changing the position of a metal slider in the center of gravity adaptive unit while the swing tail continuously provides a forward propulsion. Other experimental application sensors [15] in the fish head can provide real-time acquisition data of the surrounding water and transmit it to the host computer through the RF unit. The whole fish is powered by a lithium battery, and the battery is charged by the wireless charging unit when the fish is navigated to the charging bar in a preset area underwater.

C-Shape Turning of The Biomimetic Robotic Fish
The C-shape turning of biomimetic robotic fish is divided into three stages: shrink stage, limit holding stage, and release stage. In the first stage, the duration is shorter, the robotic fish swings three steering gear joints to bend from the straight line into a C-shaped body. At the same time, the head turns counterclockwise an angle. In the second stage, the fish will maintain the C-shape for a period. In the third stage, the robotic fish body is slowly straightened from C shape, realizing the fish head being turned. Figure 3-1 is a real fish C-shape turning body curves, the arrow indicates the heading direction of the fish [16]. The equation of the center motion trajectory shown in Figure 3-2 is given as follows:

y t a y t a t t t xt a y t a y t a t t t
Where k , m are parameters to decide the feature of the sharp turn.   Res. 6(1), 1502-1511 1506 below [18] . The three stages mentioned above: period 0 to T 0 is the shrink stage, period T 0 to T 1 is the limit holding stage, and period T 1 to T 2 is the release stage.
Where j is the number of joints, j a is the amplitude of the steering.
The equation above describing the C-shape turning calculate the ideally angle of each joint. However, there is a initial velocity before operating the C-shape turning, which will affect the joints rotation. Thus, the realistic joints turning angles are expected. Therefore, the joint angle velocity is introduced to adjust the turning angle controlling as a feedback.

The Improved Fuzzy Control Algorithm
The C-shape turning of biomimetic robotic fish is a complex process, it is difficult to establish accurate mathematical model for real-time guidance on the velocity and angle for its C-shape turning. Based on the rules of C-shape turning. A fuzzy control algorithm [19], which does not require a precise model of C-shape turning, is introduced.

Input and Output with Fuzzy Language Description
In this paper, the fuzzy control algorithm is used to adjust the joint turning angle when the fish is C-shape turning. The following is the design of fuzzy controller for the third joint of biomimetic robotic fish. The control algorithm adopted in the first and second joints is the same, and only the angular velocity fuzzy domains are different. The difference between the angle of rotation of the third joint of the robotic fish and the desired rotation angle is error e with the error changing e  , as the two inputs of the fuzzy controller, the angular velocity control of the third joint of the robotic fish is u as the output of the fuzzy controller, the output of the instrument can be adjusted in real time according to the articulated angular velocity of the robotic fish.  (k e  represent rotation angle error and the rotation angle error changing rate of the third joint at the kth discrete moment, respectively. They are given as:

Membership Function of Input and Output
The input and output adopt segmented membership functions. The membership function of the third joint rotation angle error e defined as the error between the expected angle and the realistically achieved angle is shown in Fig. 4-3 (a). While the membership function of e  and u are shown in Fig. 4-3 (b) and (c), respectively.

-3 Input and output membership functions 4.3 Fuzzy Control Rules
The core of the fuzzy controller is the fuzzy rules. Based on the long -term experience, fuzzy rules can be formulated. According to the fuzzy subset of all fuzzy variables, 15 fuzzy control rules can be grouped. The fuzzy rules are described by "IF -THEN" statements. A general form is as follows: IF (e is ...and ec is ...) THEN (u is ...)

Simulation Results
The C-shape turning of the biomimetic robotic fish is simulated by the traditional fuzzy algorithm and the proposed algorithm with angular velocity feedback. When the values of biomimetic robotic fish swimming angular velocity are 0.5 rad / s, 1 rad / s and 1.5 rad / s, the maximum amplitudes of the third joint swinging are 60, 65, 69cm. Time of three stages for C-shape turning T0、T1、T2 are different because of the different angular velocity. According to the equation (3) the ideal values of rotation angle of the third joint under different angular velocity can be calculated.    Res. 6(1), 1502-1511 1509 The simulated C-shape turning trajectories using traditional and the proposed improved fuzzy algorithms are generated for the three joints tail of the biomimetic robotic fish in Figure 5-3 (a) and (b), respectively, as: (a)The traditional fuzzy algorithm (b)The improved fuzzy algorithm It can be clearly seen in Figure 5-3 (b) that there is no joints disconnection phenomenon during C-shape turning. From the above simulation, it can be seen that the influence of the inertia on the turning angle is reduced when the angular velocity feedback is used, which makes the angular velocity changing more placidly and causes the C-shape turning more smoothly.
6. C-Shape Turning Experiment 6.1 Introduction to the experimental system The experimental system consists of two parts: the experimental environment and the three joint biomimetic robotic fish. The experimental environment consists of a 2.4m * 2.4m * 1m transparent glass pool, a computer and a highdefinition camera.

The experimental implementation
Due to the limitations of materials and manufacturing techniques, the biomimetic robotic fish cannot render unlimited flexibility, and only can be made of rigid joints to fit fish swimming curve [15], therefore, the C-shape turning of biomimetic robotic fish is an approximated fitting result of real fish turning. The fish can cruise autonomously in the pool after receiving a starting command. When the robotic fish swim toward the pool corner, the infrared can detect the right (left) obstacles (wall) ahead of the robotic fish, and the traditional fuzzy algorithm and the proposed fuzzy algorithm are implemented to execute a left (right) C-shape turning. C-shape turning process is captured as follows: (a) The C-shape turning experiment using the traditional fuzzy algorithm  , especially the third picture, shows that the disconnection of C-shape turning curve operating the traditional fuzzy algorithm is serious, while Figure 6-1 (b) shows a much more fluent bending posture. Table 2 gives the angle rules of the robotic fish after C-shape turning at different values of angular velocity. Where W is the angular velocity before the C-shape turning, A1 is the angle of the fish head turned when the traditional fuzzy algorithm is used, and A2 is the angle of the fish head turned when the improved fuzzy algorithm is used. Table 3 shows the angle values of the three joints rotation in C-shape turning at different values of angular velocity. Where θ1, θ2, θ3 represent the rotation angle values of the first joint, the second joint and the third joint, θ2-θ1 gives the difference between the rotation angle of the second joint and the first joint, θ3-θ2 gives the difference between the rotation angle of the third joint and the second joint.
From table 2 one can see that if the controller has no feedback, when the fish swimming angular velocity in a Cshape turning is 1.5 rad/s, due to the excessive speed and inertia the resistance to the robotic fish C-shape turning will be greater, which causes the head rotation angle to be smaller. While if the controller has angular speed feedback, it will adjust the angular speed of the C-shape turning, and reduce the influence of inertia. From the experimental results it is obvious shown that the rotation angle of the fish head increases after adding feedback. Table 3 shows that both the different values of rotation angle between the first joint and the second joint and between the second joint and the third joint in case of using the angle velocity feedback are smaller than that without feedback when the values of robotic fish swimming speed are 0.5 rad/s, 1.0 rad/s, and 1.5 rad/s. In table 3 the letter A1 stands for the angle value before using the improved algorithm, the letter A2 stands for the angle value based on the improved algorithm. High value of joint angle difference causes "disconnect" phenomenon on biomimetic robotic fish joints. The proposed algorithm using angular velocity feedback can adjust the joints turning angle values to better reduce this difference value and make the C-shape turning more smoothly.

Conclusion:-
This paper has studied the implementation of the biomimetic robotic fish C-shape turning movement. Using the angular velocity of the robotic fish as a controller feedback, an optimization algorithm based on fuzzy control theory has been proposed. Numerical simulation and experiments have been carried out to verify the performance of this novel algorithm. Conclusions could have been drawn as: The proposed fuzzy control algorithm with feedback improves 2%~5% angle of the fish head and reduces the influence of inertia caused by excessive speed of the robotic fish in the C-shape turning. By adding angular velocity feedback to the fuzzy controller, the joint angle can be adjusted in real time, and thus the variation of the joint angle can be reduced 25% ~ 30%, which helps the robotic fish turning curves being more fluent and smooth.