Novel Online Optimized Control for Underwater Pipe-Cleaning Robots

: Due to the particularity of the jacket structure of o ﬀ shore platforms and the complexity of the marine environment, there have been few e ﬀ ective localization and autonomous control methods for underwater robots that are designed for cleaning tasks. To improve this situation, a fusion bat algorithm (BA) online optimized fuzzy control method using vision localization was developed based on the constraints of the underwater operational environment. Vision localization was achieved based on images from a catadioptric panoramic imaging system. The features of the pipe edge and the boundary of the area covered by biofouling were obtained by image processing and feature extraction. The feature point chosen as the “highest” point of the boundary was calculated by projection transformation to generate the reference path. The specialized fuzzy controller was designed to drive the robot to track the reference path, and an improved bat algorithm with dynamic inertia weight and di ﬀ erential evolution method was developed to optimize the scale factors of the fuzzy controller online. The control method was simulated and further implemented on an underwater pipe-cleaning robot (UPCR), and the results indicate its rationality and validity.


Introduction
Offshore platforms play an important role in marine resource exploitation, and jackets made of steel pipes are essential structural supports for oil rigs. As barnacles, algae, and other forms of marine life always adhere to their surface, these pipes need periodical cleaning to prevent load increase and corrosion [1,2]. Until now, most of these cleaning tasks have been accomplished manually, which is of low efficiency and high cost, and presenting potential safety threats to the divers. Therefore, it is essential to replace manual labor by underwater robots.
In recent years, climbing robots have been developed for industrial applications, especially in the area of cleaning underwater structures [3,4]. These robots utilize propulsion force adhesion [5][6][7][8], magnetic force adhesion [9,10], and clamping [11] to achieve stable locomotion and withstand the counterforce brought on by cleaning operations. All of them, however, focused only on locomotion, adaptation, or the cleaning method, which are the basic functions of climbing robots used for cleaning. As these underwater robots may work several to over twenty hours a day and operators can only concentrate effectively for 30-60 min before their driving ability declines [12], automation is urgently required not only to relieve the stress of operators but also to improve the operational efficiency.
Many researches have paid attention to localization, navigation, and motion control of climbing robots to achieve automation [13]. MagneBike, also moving on the pipe, uses a localization strategy based on 3D scan registration and 3D odometry, and transforms the path from 3D space into 2D based on 3D scan registration and 3D odometry, and transforms the path from 3D space into 2D space by projecting movements into local surface planes, allowing for 2D trajectory tracking [14,15]. In addition, multiple methods and devices have been utilized to achieve stable motion and autonomous control of climbing robots, including computer vision [12,16,17] or structural light-based computer vision [18][19][20], 3D perception sources [21], dead reckoning [22], and external guidance [23]. As the methods above were commonly developed considering the constraints of a particular working environment, their performance may decrease if applied to other fields, especially under water. Meanwhile, there have been few effective localization and control methods for underwater cleaning robots due to the complexity of the marine environment.
3D localization is an indispensable step towards the implementation of a semiautonomous or autonomous control. However, according to underwater environment specifications [9], an accurate global localization is either hard to achieve or inadequate for cleaning tasks. Thus, we propose a compromised method composed of rough global localization and accurate local localization, which, respectively, helps operators locate approximately the underwater pipe-cleaning robot (UPCR) and provides reference paths and movement errors for the control method.
The global localization of a UPCR was demonstrated in our previous work [24]. Based on the transfer matrix between the global coordinate and the UPCR coordinate, the orientation error between the axis of the pipe and the UPCR, accelerometer measurements, and the inclination of the pipe were fused to calculate the relative orientation between the pipe and the UPCR. Then, combined with the liquid level transmitter, the global localization of the UPCR was obtained.
This paper focuses on the local localization and autonomous control of the UPCR. As the boundary of the area covered by biofouling is always irregular, the "highest" point on the boundary along the direction of the pipe's axis was chosen as the feature point, and the line on the pipe across the point that was vertical to the axis of the pipe was defined as the reference path, as shown in Figure  1. During local localization, therefore, the pipe edge and the biofouling boundary in the image are first recognized. The orientation error of the UPCR is calculated based on the inclination of the pipe's edge. Then, according to the position of the boundary and projection transformation rules, the coordinates of the real boundary in the base coordinate are obtained. Finally, the feature point and the reference path are determined to calculate the movement errors of the UPCR. These movement errors are inputs for the designed fuzzy controller, which turns the UPCR toward the reference path. A fusion bat algorithm (BA) with dynamic inertia factor and differential evolution method is also used to improve the performance of the fuzzy controller. This paper is organized as follows. Section 2 provides a concise introduction of the UPCR prototype and its operational mode, and the local localization method based on a catadioptric panoramic image. Section 3 describes a novel fuzzy controller optimized by the fusion bat algorithm. Sections 4 and 5 verify the proposed controller by simulation and experiment, respectively. Finally, conclusions are given in Section 6. This paper is organized as follows. Section 2 provides a concise introduction of the UPCR prototype and its operational mode, and the local localization method based on a catadioptric panoramic image. Section 3 describes a novel fuzzy controller optimized by the fusion bat algorithm. Sections 4 and 5 verify the proposed controller by simulation and experiment, respectively. Finally, conclusions are given in Section 6.

Prototype Description
A UPCR is a wheeled climbing robot designed to clean biofouling covered on the jacket of offshore platforms. Equipped with magnetic wheels and a self-adaption mechanism, a UPCR can move steadily on the pipe, while stripping the biofouling with a cavitation water jet [9,25]. In order to observe the UPCR's surrounding environment during operation, a catadioptric panoramic imaging system composed of a camera and a mirror was designed to acquire images for local localization, as shown in Figure 2. The camera was upward integrated in the body of the UPCR and obtained the panoramic image of the robot from the mirror. An Aviterich D5I22 webcam module (Shenzhen ARTON Tech. Cor., Ltd., Guangdong, China) with 1920 × 1080 pixel resolution and frame rate of 20 fps was chosen due to its compact size (38 × 38 × 45 mm 3 ), light weight (0.08 kg), and low price (75 dollars). Based on this panoramic image, feature extraction and projection transformation were successively operated. Then, the reference path was generated and errors between the UPCR and reference path were calculated.

Prototype Description
A UPCR is a wheeled climbing robot designed to clean biofouling covered on the jacket of offshore platforms. Equipped with magnetic wheels and a self-adaption mechanism, a UPCR can move steadily on the pipe, while stripping the biofouling with a cavitation water jet [9,25]. In order to observe the UPCR's surrounding environment during operation, a catadioptric panoramic imaging system composed of a camera and a mirror was designed to acquire images for local localization, as shown in Figure 2. The camera was upward integrated in the body of the UPCR and obtained the panoramic image of the robot from the mirror. An Aviterich D5I22 webcam module (Shenzhen ARTON Tech. Cor., Ltd, Guangdong, China) with 1920 × 1080 pixel resolution and frame rate of 20 fps was chosen due to its compact size (38 × 38 × 45 mm 3 ), light weight (0.08 kg), and low price (75 dollars). Based on this panoramic image, feature extraction and projection transformation were successively operated. Then, the reference path was generated and errors between the UPCR and reference path were calculated.

Figure 2.
Overview of the underwater pipe-cleaning robot (UPCR). Left is the UPCR prototype. Right is the front view, which shows the structure of the catadioptric panoramic imaging system and its position relative to the biofouling during cleaning operations.
It is worth noting that the UPCR moves circumferentially and downward gradually to ensure that all the biofouling in its path is cleaned up; therefore, the highest point of the biofouling is chosen as the reference, as described in Section 1. Meanwhile, in order to avoid cable tangling around the pipe, the robot moves backward and forward circumferentially. Since the diameter of each pipe is uniform, the motion of the UPCR on the pipe can be equivalent to the motion on a rectangular plane. The operational trajectory of UPCR is shown in Figure 3.  Overview of the underwater pipe-cleaning robot (UPCR). Left is the UPCR prototype. Right is the front view, which shows the structure of the catadioptric panoramic imaging system and its position relative to the biofouling during cleaning operations.
It is worth noting that the UPCR moves circumferentially and downward gradually to ensure that all the biofouling in its path is cleaned up; therefore, the highest point of the biofouling is chosen as the reference, as described in Section 1. Meanwhile, in order to avoid cable tangling around the pipe, the robot moves backward and forward circumferentially. Since the diameter of each pipe is uniform, the motion of the UPCR on the pipe can be equivalent to the motion on a rectangular plane. The operational trajectory of UPCR is shown in Figure 3.

Prototype Description
A UPCR is a wheeled climbing robot designed to clean biofouling covered on the jacket of offshore platforms. Equipped with magnetic wheels and a self-adaption mechanism, a UPCR can move steadily on the pipe, while stripping the biofouling with a cavitation water jet [9,25]. In order to observe the UPCR's surrounding environment during operation, a catadioptric panoramic imaging system composed of a camera and a mirror was designed to acquire images for local localization, as shown in Figure 2. The camera was upward integrated in the body of the UPCR and obtained the panoramic image of the robot from the mirror. An Aviterich D5I22 webcam module (Shenzhen ARTON Tech. Cor., Ltd, Guangdong, China) with 1920 × 1080 pixel resolution and frame rate of 20 fps was chosen due to its compact size (38 × 38 × 45 mm 3 ), light weight (0.08 kg), and low price (75 dollars). Based on this panoramic image, feature extraction and projection transformation were successively operated. Then, the reference path was generated and errors between the UPCR and reference path were calculated.

Figure 2.
Overview of the underwater pipe-cleaning robot (UPCR). Left is the UPCR prototype. Right is the front view, which shows the structure of the catadioptric panoramic imaging system and its position relative to the biofouling during cleaning operations.
It is worth noting that the UPCR moves circumferentially and downward gradually to ensure that all the biofouling in its path is cleaned up; therefore, the highest point of the biofouling is chosen as the reference, as described in Section 1. Meanwhile, in order to avoid cable tangling around the pipe, the robot moves backward and forward circumferentially. Since the diameter of each pipe is uniform, the motion of the UPCR on the pipe can be equivalent to the motion on a rectangular plane. The operational trajectory of UPCR is shown in Figure 3.

Feature Extraction
The process of the method used to obtain the features of the pipe edge and the biofouling boundary in the field is shown in Figure 4. Equipped with a wide-angle lens, the camera produces images with barrel distortion, which is first corrected based on the internal and external parameters of the camera. Median filter, a nonlinear filtering method, is simultaneously applied as it can overcome the blurriness generated by the linear filtering method while maintaining and enhancing the edge details [26]. Then, two regions of interest, namely the edge of the pipe and the boundary of the biofouling, are chosen to reduce unnecessary calculation.

Feature Extraction
The process of the method used to obtain the features of the pipe edge and the biofouling boundary in the field is shown in Figure 4. Equipped with a wide-angle lens, the camera produces images with barrel distortion, which is first corrected based on the internal and external parameters of the camera. Median filter, a nonlinear filtering method, is simultaneously applied as it can overcome the blurriness generated by the linear filtering method while maintaining and enhancing the edge details [26]. Then, two regions of interest, namely the edge of the pipe and the boundary of the biofouling, are chosen to reduce unnecessary calculation. With respect to Region A, threshold segmentation (TS) and an edge recognition method with canny operator were applied to extract the pipe edge [27]. Considering that the edge may not be a straight line as the pipe is not smooth, a probabilistic Hough transform (PHT) was performed to generate lines from the pipe edge, which can be formulated as follows: Thus, the feature line of the pipe edge can be computed using Equation (2).
1, 2,..., As for Region B, it was first overlaid by a preprocessed image to eliminate the disturbance of the robot body. Since the relative position of the robot body and the panoramic image system is constant, the preprocessed image is suitable for any situation. Second, the color-to-grey method (CtoG) and threshold segmentation (TS) were used to obtain a binary image. Third, a closed operation, combining dilation and erosion, was then applied to fill the holes that were originally occupied with the biofouling and connect with each other. Fourth, area threshold segmentation was performed to remove the small blobs that were recognized as noise. Finally, an edge recognition method with canny operator was used to extract the boundary of the area covered by biofouling.

Projection Transformation Rules
The purpose of projection transformation is to obtain the real position of the biofouling boundary based on the image features. Considering that the UPCR is in a random orientation, twopixel coordinate systems named xoy and x'oy' were defined in the captured image, as shown in Figure 5a. Their origin coincided with the optical center of the camera. Axis oy and axis ox' are parallel to the moving direction of the UPCR and the axis of the pipe, respectively. α is the rotation angle from xoy to x'oy', and can be calculated based on Equation (3)   With respect to Region A, threshold segmentation (TS) and an edge recognition method with canny operator were applied to extract the pipe edge [27]. Considering that the edge may not be a straight line as the pipe is not smooth, a probabilistic Hough transform (PHT) was performed to generate lines from the pipe edge, which can be formulated as follows: Thus, the feature line of the pipe edge can be computed using Equation (2).
As for Region B, it was first overlaid by a preprocessed image to eliminate the disturbance of the robot body. Since the relative position of the robot body and the panoramic image system is constant, the preprocessed image is suitable for any situation. Second, the color-to-grey method (CtoG) and threshold segmentation (TS) were used to obtain a binary image. Third, a closed operation, combining dilation and erosion, was then applied to fill the holes that were originally occupied with the biofouling and connect with each other. Fourth, area threshold segmentation was performed to remove the small blobs that were recognized as noise. Finally, an edge recognition method with canny operator was used to extract the boundary of the area covered by biofouling.

Projection Transformation Rules
The purpose of projection transformation is to obtain the real position of the biofouling boundary based on the image features. Considering that the UPCR is in a random orientation, two-pixel coordinate systems named xoy and x'oy' were defined in the captured image, as shown in Figure 5a. Their origin coincided with the optical center of the camera. Axis oy and axis ox' are parallel to the Appl. Sci. 2020, 10, 4279 5 of 16 moving direction of the UPCR and the axis of the pipe, respectively. α is the rotation angle from xoy to x'oy', and can be calculated based on Equation (3) as follows: According to the feature of Region B, points at the boundary of the area covered by biofouling can be described as Pi(xi,yi) in xoy. Their coordinates change to P'i(xi',yi') in x'oy', which can be calculated by Equation (4): The camera imaging model is presented in Figure 5b. Ocxbybzb is the base coordinate system and xpopyp is the image coordinate system on the image plane. Oc is the equivalent optical center, which is symmetric with the optical center of the camera about the mirror. Ocxb, opxp, and ox' (in Figure 5a) have the same direction, as well as Ocyb, opyp, and oy'. Then, Ppi(xpi,ypi) in xpopyp corresponding to P'i(xi',yi') is given as follows: where K is the scaling factor of coordinate transformation between x'oy' and xpopyp. It is constant and can be measured in advance by the following method.
One of the points at the pipe edge is first chosen as Q(0,yQ') in x'oy' (Figure 5a), and Qb is the corresponding point of Q on the pipe (Figure 5b). Thus, OcQb and the pipe are tangent. Then, the According to the feature of Region B, points at the boundary of the area covered by biofouling can be described as P i (x i ,y i ) in xoy. Their coordinates change to P' i (x i ',y i ') in x'oy', which can be calculated by Equation (4): The camera imaging model is presented in Figure 5b. O c x b y b z b is the base coordinate system and x p o p y p is the image coordinate system on the image plane. O c is the equivalent optical center, which is symmetric with the optical center of the camera about the mirror. O c x b , o p x p , and ox' (in Figure 5a) have the same direction, as well as O c y b , o p y p , and oy'. Then, P pi (x pi ,y pi ) in x p o p y p corresponding to P' i (x i ',y i ') is given as follows: x pi = K·x i y pi = K·y i where K is the scaling factor of coordinate transformation between x'oy' and x p o p y p . It is constant and can be measured in advance by the following method.
One of the points at the pipe edge is first chosen as Q(0,y Q ') in x'oy' (Figure 5a), and Q b is the corresponding point of Q on the pipe (Figure 5b). Thus, O c Q b and the pipe are tangent. Then, the corresponding point of Q in x p o p y p defined Q p (0,y Qp ) can be calculated as follows: where f is the focal length and d is the distance between O c and the pipe along axis O c y b , which is given as follows: where dis is the distance between the camera and the center of the UPCR, as shown in Figure 5a. t is a temp parameter that can be calculated based on geometric similarity as follows: where R is the radius of the pipe and L is the distance between O c and the pipe along axis O c z b . Thus, K is given as Equation (9): As equations of the line O c P bi and the surface of the pipe can be defined as Equations (10) and (11), respectively, the coordinates of points at the boundary of the area covered by biofouling on the pipe named P bi (x bi ,y bi ,z bi ) can be calculated based on Equations (4), (5), (10), and (11):

Deviation Calculation
The point that has the smallest x bi is chosen as the feature point according to Figure 1. Then, the reference path can be defined as follows and as shown in Figure 5a: where x bmin is equal to the minimum value of x bi . Considering that the purpose of the robot is to clean the pipe, it is better to have the cleaning equipment follow the reference path. As the coordinate of the cleaning equipment is C(x cr , y cr ) in the robot coordinate system x r oy r with oy r towards the front of the UPCR and ox r towards the right of the UPCR, the orientation error e ori and the position error e pos of the UPCR can be given as Equation (13):

Fusion Bat Algorithm-Optimized Fuzzy Controller
The UPCR has three actuators situated in the front wheel, the back wheel, and the turning mechanism. Based on the kinematic model of the robot [25], the number of active degrees of freedom (DOFs) is two as movement of the back wheel is constrained by the front wheel and the turning mechanism. Meanwhile, because the velocity of the front wheel is always slow and does not affect the trajectory to follow the reference path, it is preset and the angle of the turning mechanism is determined as the control output.
The application of the UPCR has two major characteristics-on the one hand, the boundary of sea creatures is not a smooth curve and is often in a stepped shape, which makes the reference line discrete and unpredictable; on the other hand, the surface of the steel structure is rugged due to the presence of residual sea creatures and welding seams, causing the UPCR to bump over them, which in turn leads to dramatic shaking in the panoramic image. Thus, the fuzzy controller was chosen as it is less complex in its implementation and inherently robust to noise and parameter uncertainties [28,29], and a fusion bat algorithm was applied to optimize the performance of the fuzzy controller. The diagram of the control flow is shown in Figure 6.
the trajectory to follow the reference path, it is preset and the angle of the turning mechanism is determined as the control output.
The application of the UPCR has two major characteristics-on the one hand, the boundary of sea creatures is not a smooth curve and is often in a stepped shape, which makes the reference line discrete and unpredictable; on the other hand, the surface of the steel structure is rugged due to the presence of residual sea creatures and welding seams, causing the UPCR to bump over them, which in turn leads to dramatic shaking in the panoramic image. Thus, the fuzzy controller was chosen as it is less complex in its implementation and inherently robust to noise and parameter uncertainties [28,29], and a fusion bat algorithm was applied to optimize the performance of the fuzzy controller. The diagram of the control flow is shown in Figure 6.

Fuzzy Controller Design
The inputs of the fuzzy controller were chosen as epos and eori, while the output was chosen as the turning angle αt. Their domains of discourse were all [-6, 6], and the fuzzy sets selected for them were Triangular membership functions were adopted as they are the piecewise linear functions proven to be efficient due to their computational simplicity [30]. The fuzzy rules for path tracking were generated by the experiences of manual control, as shown in Table 1. The max-min inference method and the Mamdani method were used in the process of fuzzy inference, and a centroid

Fuzzy Controller Design
The inputs of the fuzzy controller were chosen as e pos and e ori , while the output was chosen as the turning angle α t . Their domains of discourse were all [-6, 6], and the fuzzy sets selected for them were the trajectory to follow the reference path, it is preset and the angle of the turning mechanism is determined as the control output. The application of the UPCR has two major characteristics-on the one hand, the boundary of sea creatures is not a smooth curve and is often in a stepped shape, which makes the reference line discrete and unpredictable; on the other hand, the surface of the steel structure is rugged due to the presence of residual sea creatures and welding seams, causing the UPCR to bump over them, which in turn leads to dramatic shaking in the panoramic image. Thus, the fuzzy controller was chosen as it is less complex in its implementation and inherently robust to noise and parameter uncertainties [28,29], and a fusion bat algorithm was applied to optimize the performance of the fuzzy controller. The diagram of the control flow is shown in Figure 6.

Fuzzy Controller Design
The inputs of the fuzzy controller were chosen as epos and eori, while the output was chosen as the turning angle αt. Their domains of discourse were all [-6, 6], and the fuzzy sets selected for them were Triangular membership functions were adopted as they are the piecewise linear functions proven to be efficient due to their computational simplicity [30]. The fuzzy rules for path tracking were generated by the experiences of manual control, as shown in Table 1. The max-min inference method and the Mamdani method were used in the process of fuzzy inference, and a centroid Triangular membership functions were adopted as they are the piecewise linear functions proven to be efficient due to their computational simplicity [30]. The fuzzy rules for path tracking were generated by the experiences of manual control, as shown in Table 1. The max-min inference method and the Mamdani method were used in the process of fuzzy inference, and a centroid defuzzifier was applied to obtain the actual turning angle, which was constrained in the range of [−25 • , 25 • ].

Bat Algorithm Optimization
In order to ensure the fuzzy controller's good performance, scale factors of the inputs and the output must be properly determined. However, fixed scale factors are not suitable for different deviations, and therefore an online optimization method is required. Many algorithms can be used to optimize parameters, such as the simplex method, a genetic algorithm (GA), the simulated annealing method (SAM), particle swarm optimization (PSO), a bat algorithm (BA), etc. Considering that online optimization requires the high efficiency of the optimization algorithm, BA was selected to optimize the scale factors.
A BA is a nature-inspired algorithm developed by Yang in 2012, which was formulated based on the behavior of bats finding their prey [31]. In this algorithm, each "bat" represents one solution of the optimization problem, which is a set of the three scale factors (i.e., K pos , K ori , and K t ) in this paper. A certain number of bats are applied to constitute a swarm moving around the search space and searching for the best solution. In order to evaluate the quality of solutions, a fitness function is required. In this paper, integral time absolute error (ITAE) was used, and the fitness function based on e pos and e ori is formulated as follows: where ω 1 and ω 2 are weight coefficients. As biofouling can be stripped from the pipe only when the cleaning equipment arrives, it is better to eliminate the position error as a priority. Therefore, ω 1 and ω 2 are set as 0.7 and 0.3, respectively. A BA provides a quick convergence by switching between exploration and exploitation, but it may lead to stagnation or premature convergence if it switches to exploitation too early [32]. Even though BA parameters have been properly optimized according to published research [33], stagnation and premature convergence still occur in our application.
As the velocity update rule in the BA mainly influences its convergence speed, the dynamic inertia weight is used to solve the stagnation problem. The velocity update rule is changed as follows: where v, x, f, and ω denote velocity, location, velocity adjusting frequency, and the newly introduced dynamic inertia weight, respectively, while i, t, and t-1 denote bat i, time step t, and its previous time step, respectively. x* denotes the optimal location in the current iteration. Considering that most bats can find better locations during exploration, the dynamic inertia weight need not decrease a lot. When most bats cannot find better locations, exploitation starts and a small dynamic inertia weight can lead to fast convergence. Thus, a success rate of finding better locations is defined to automatically adjust the dynamic inertia weight, which is formulated in Equations (16)- (18): where ω max and ω min are the maximum and the minimum of ω, respectively, and P s t is the success rate at time step t. S i t represents whether bat i finds a better location at time step t, and it is equal to 1 if a better location is found.
As the BA's premature convergence is mainly caused by lack of variation, differential evolution (DE) is applied in the BA. Comparing different schemes of DE [34], DE/rand/1 was selected for its ability to increase the diversity of bats and the simplicity. It is formulated in Equation (19) and added in the step of location update during exploration: where x j and x k are two other bats selected randomly, and F is chosen in [0,2]. DE/best/1 was also used in the BA and added in the step of location update during exploitation as it can further increase the speed of convergence. The differential rule is defined as follows: The crossover is applied between updated locations of the conventional BA and DE based on the equations below:

Simulations and Results
In order to validate the effectiveness of the aforementioned methods, this paper designed two kinds of simulations, which explored the path tracking performance of the robot using the new method and the optimal location finding performance of the fusion BA.
In the first simulation, the proposed fuzzy controller with online optimization of the scale factors using the fusion BA was applied to track a reference path with abrupt displacement, which imitates the condition where an embossment of the biofouling boundary appears or disappears in the view of the UPCR. As a contrast, the fuzzy controller without optimization was also simulated, and Kpos, Kori, and Kt were set as 1000, 0.35, and 7, respectively. Figures 9 and 10 show the tracking performance of these two fuzzy controllers when the velocity of the front wheel of the UPCR is 3.6 m/min.

Simulations and Results
In order to validate the effectiveness of the aforementioned methods, this paper designed two kinds of simulations, which explored the path tracking performance of the robot using the new method and the optimal location finding performance of the fusion BA.
In the first simulation, the proposed fuzzy controller with online optimization of the scale factors using the fusion BA was applied to track a reference path with abrupt displacement, which imitates the condition where an embossment of the biofouling boundary appears or disappears in the view of the UPCR. As a contrast, the fuzzy controller without optimization was also simulated, and K pos , K ori , and K t were set as 1000, 0.35, and 7, respectively. Figures 9 and 10 show the tracking performance of these two fuzzy controllers when the velocity of the front wheel of the UPCR is 3.6 m/min. Appl. Sci. 2020, 10, x FOR PEER REVIEW 11 of 16  As shown in Figure 9, both fuzzy controllers can successfully drive the UPCR to track the reference path. When initial conditions for both controllers were the same in stages ① and②, the UPCR with the optimized fuzzy controller moved close to the reference path more quickly. As the reference path was short in stage ③, the UPCR with the conventional fuzzy controller did not have enough time to finish adjusting. In stage ④, although the initial deviation for the optimized fuzzy controller was bigger than that for the conventional fuzzy controller, both fuzzy controllers spent almost the same time to eliminate errors. Figure 10a,b shows the position error and the orientation error with respect to time and mileage along the x-axis, which represent the speed of the nozzle approaching the reference line and the UPCR straightening its body along the reference line, respectively. From the result, it takes more than 10 s for the UPCR to eliminate large position and orientation errors. This phenomenon is reasonable because the robot has to move slowly to ensure that the sea creatures are fully cleaned and the drive motor provides enough torque to overcome the resistance caused by magnetic adsorption. It should also be noted that the maximum orientation error was bigger when the UPCR used the optimized fuzzy controller, which is because the weight coefficient ω1 was set to be bigger than ω2 to decrease the position error as a priority, and a faster change of position in the left-right direction of the UPCR required a bigger orientation error. Despite all this, the correction of the orientation error was still faster using the optimized fuzzy controller, as shown in Figure 10b. In general, the proposed fuzzy  As shown in Figure 9, both fuzzy controllers can successfully drive the UPCR to track the reference path. When initial conditions for both controllers were the same in stages 1 and 2 , the UPCR with the optimized fuzzy controller moved close to the reference path more quickly. As the reference path was short in stage 3 , the UPCR with the conventional fuzzy controller did not have enough time to finish adjusting. In stage 4 , although the initial deviation for the optimized fuzzy controller was bigger than that for the conventional fuzzy controller, both fuzzy controllers spent almost the same time to eliminate errors. Figure 10a,b shows the position error and the orientation error with respect to time and mileage along the x-axis, which represent the speed of the nozzle approaching the reference line and the UPCR straightening its body along the reference line, respectively. From the result, it takes more than 10 s for the UPCR to eliminate large position and orientation errors. This phenomenon is reasonable because the robot has to move slowly to ensure that the sea creatures are fully cleaned and the drive motor provides enough torque to overcome the resistance caused by magnetic adsorption. It should also be noted that the maximum orientation error was bigger when the UPCR used the optimized fuzzy controller, which is because the weight coefficient ω 1 was set to be bigger than ω 2 to decrease the position error as a priority, and a faster change of position in the left-right direction of the UPCR required a bigger orientation error. Despite all this, the correction of the orientation error was still faster using the optimized fuzzy controller, as shown in Figure 10b. In general, the proposed fuzzy controller is suitable for the tracking path task and optimizing its scale factors online can dramatically improve the performance.
In order to explore the sensitivity of the proposed controller to the moving speed of the UPCR, we simulated its tracking performance at different speeds. Each simulation was performed under the same setting (e.g., reference trajectory and dynamic parameters). Figure 11 shows the root mean square error (RMSE) of the UPCR's performance error at seven different moving speeds. From the result, the RMSE of the position error increases with UPCR's speed, whereas the RMSE of the orientation error has no obvious relationship with the robot's speed. This result indicates that, within a certain velocity range, the tracking performance of the UPCR is inversely related to its moving speed. However, the RMSE of the tracking performance did not change significantly within such a large velocity range. Considering that the velocity of the robot in most applications is between 1.8 and 3.6 m/s, it can be concluded that the fusion bat algorithm-optimized fuzzy controller is suitable for the UPCR.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 12 of 16 controller is suitable for the tracking path task and optimizing its scale factors online can dramatically improve the performance. In order to explore the sensitivity of the proposed controller to the moving speed of the UPCR, we simulated its tracking performance at different speeds. Each simulation was performed under the same setting (e.g., reference trajectory and dynamic parameters). Figure 11 shows the root mean square error (RMSE) of the UPCR's performance error at seven different moving speeds. From the result, the RMSE of the position error increases with UPCR's speed, whereas the RMSE of the orientation error has no obvious relationship with the robot's speed. This result indicates that, within a certain velocity range, the tracking performance of the UPCR is inversely related to its moving speed. However, the RMSE of the tracking performance did not change significantly within such a large velocity range. Considering that the velocity of the robot in most applications is between 1.8 and 3.6 m/s, it can be concluded that the fusion bat algorithm-optimized fuzzy controller is suitable for the UPCR. To verify the superiority of the fusion BA, a second simulation was conducted to compare the performance of the fusion BA (FBA), the BA with only the dynamic inertia weight (DIWBA), the conventional BA, and the PSO. The initial conditions for each method were the same, and the simulation was repeated 100 times. According to the results shown in Figure 12, the proposed fusion BA converges to the optimal solution with a faster convergence speed and a better fitness value, which guarantees better real-time performance of the control system. To verify the superiority of the fusion BA, a second simulation was conducted to compare the performance of the fusion BA (FBA), the BA with only the dynamic inertia weight (DIWBA), the conventional BA, and the PSO. The initial conditions for each method were the same, and the simulation was repeated 100 times. According to the results shown in Figure 12, the proposed fusion BA converges to the optimal solution with a faster convergence speed and a better fitness value, which guarantees better real-time performance of the control system.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 12 of 16 controller is suitable for the tracking path task and optimizing its scale factors online can dramatically improve the performance. In order to explore the sensitivity of the proposed controller to the moving speed of the UPCR, we simulated its tracking performance at different speeds. Each simulation was performed under the same setting (e.g., reference trajectory and dynamic parameters). Figure 11 shows the root mean square error (RMSE) of the UPCR's performance error at seven different moving speeds. From the result, the RMSE of the position error increases with UPCR's speed, whereas the RMSE of the orientation error has no obvious relationship with the robot's speed. This result indicates that, within a certain velocity range, the tracking performance of the UPCR is inversely related to its moving speed. However, the RMSE of the tracking performance did not change significantly within such a large velocity range. Considering that the velocity of the robot in most applications is between 1.8 and 3.6 m/s, it can be concluded that the fusion bat algorithm-optimized fuzzy controller is suitable for the UPCR. To verify the superiority of the fusion BA, a second simulation was conducted to compare the performance of the fusion BA (FBA), the BA with only the dynamic inertia weight (DIWBA), the conventional BA, and the PSO. The initial conditions for each method were the same, and the simulation was repeated 100 times. According to the results shown in Figure 12, the proposed fusion BA converges to the optimal solution with a faster convergence speed and a better fitness value, which guarantees better real-time performance of the control system.

Experiment and Results
The vision-based optimized fuzzy control method was applied to drive the UPCR following the boundary of an area covered by biofouling, which were simulated by shells and paint on a pipe in the laboratory. The localization algorithm and the control algorithm were run in the computer and their processing times were about 41 ms and 60 ms, respectively. In order to decrease the influence of the time delay of communication, the control time step was chosen as 0.3 s and the velocity of the front wheel was set as 1.8 m/min. Figure 13 shows the UPCR's movement during the experiment. The upper parts of the subgraphs are the images captured by the catadioptric panoramic imaging system and the lower parts indicate the localization results that point to the biofouling boundary on the pipe, presented on the plane by surface flattening. The tracking errors and the UPCR's turning angle during the experiment are shown in Figure 14. It can be seen that the UPCR moved forward as the boundary was almost flat (Figure 13a,b), and the position error and the orientation error were no more than 0.01 m and 2 • , respectively. When the UPCR detected the embossment of the boundary at moment A, the reference path changed and a big position error occurred (Figure 13c). Then, the UPCR automatically tracked the new reference path to avoid crashing, as we expected (Figure 13d-f). Due to the selection strategy of the feature point, the reference path can be generated correctly under most circumstances, even though part of the biofouling was not recognized. According to Figure 14, the changing trend of the tracking error was similar to the simulation results in Section 4 where the position error was preferentially corrected. The setting time was a little longer than that in the simulations as there were some measurement mistakes in the position error. The experimental results indicate the rationality and validity of the control method presented above.

Experiment and Results
The vision-based optimized fuzzy control method was applied to drive the UPCR following the boundary of an area covered by biofouling, which were simulated by shells and paint on a pipe in the laboratory. The localization algorithm and the control algorithm were run in the computer and their processing times were about 41 ms and 60 ms, respectively. In order to decrease the influence of the time delay of communication, the control time step was chosen as 0.3 s and the velocity of the front wheel was set as 1.8 m/min. Figure 13 shows the UPCR's movement during the experiment. The upper parts of the subgraphs are the images captured by the catadioptric panoramic imaging system and the lower parts indicate the localization results that point to the biofouling boundary on the pipe, presented on the plane by surface flattening. The tracking errors and the UPCR's turning angle during the experiment are shown in Figure 14. It can be seen that the UPCR moved forward as the boundary was almost flat (Figure 13a,b), and the position error and the orientation error were no more than 0.01 m and 2°, respectively. When the UPCR detected the embossment of the boundary at moment A, the reference path changed and a big position error occurred (Figure 13c). Then, the UPCR automatically tracked the new reference path to avoid crashing, as we expected (Figure 13d-f). Due to the selection strategy of the feature point, the reference path can be generated correctly under most circumstances, even though part of the biofouling was not recognized. According to Figure 14, the changing trend of the tracking error was similar to the simulation results in Section 4 where the position error was preferentially corrected. The setting time was a little longer than that in the simulations as there were some measurement mistakes in the position error. The experimental results indicate the rationality and validity of the control method presented above.

Conclusions
This paper describes a new BA online optimized fuzzy control method for a UPCR based on vision localization. Constraints of the working environment were analyzed, and a localization system composed of global localization and local localization and a fuzzy controller with fusion BA were proposed. The local localization was achieved based on images from a catadioptric panoramic imaging system. The features of the pipe edge and the boundary of the area covered by biofouling were obtained by image processing and feature extraction, and then the reference path was generated based on the coordinates of the feature point that was calculated by projection transformation. The fuzzy controller was designed to make the UPCR track the reference path, and an improved BA with dynamic inertia weight and differential evolution method was developed to optimize the scale factors of the fuzzy controller online. Simulations and experiments were performed to demonstrate the validity of the proposed method.
As the operational condition of the UPCR (i.e., the irregular offshore structure covered by biofouling) is more complex and varied, future works will focus on improving the robustness and accuracy of vision localization in order to conduct field applications in the sea.
Author Contributions: Y.C., conception of the study, analysis and manuscript preparation; S.L., performed the experiment; J.F., contributed significantly to the data analyses and wrote the manuscript; C.Y. helped perform the analysis with constructive discussions and provided funding.

Conclusions
This paper describes a new BA online optimized fuzzy control method for a UPCR based on vision localization. Constraints of the working environment were analyzed, and a localization system composed of global localization and local localization and a fuzzy controller with fusion BA were proposed. The local localization was achieved based on images from a catadioptric panoramic imaging system. The features of the pipe edge and the boundary of the area covered by biofouling were obtained by image processing and feature extraction, and then the reference path was generated based on the coordinates of the feature point that was calculated by projection transformation. The fuzzy controller was designed to make the UPCR track the reference path, and an improved BA with dynamic inertia weight and differential evolution method was developed to optimize the scale factors of the fuzzy controller online. Simulations and experiments were performed to demonstrate the validity of the proposed method.
As the operational condition of the UPCR (i.e., the irregular offshore structure covered by biofouling) is more complex and varied, future works will focus on improving the robustness and accuracy of vision localization in order to conduct field applications in the sea.
Author Contributions: Y.C., conception of the study, analysis and manuscript preparation; S.L., performed the experiment; J.F., contributed significantly to the data analyses and wrote the manuscript; C.Y. helped perform the analysis with constructive discussions and provided funding.

Conclusions
This paper describes a new BA online optimized fuzzy control method for a UPCR based on vision localization. Constraints of the working environment were analyzed, and a localization system composed of global localization and local localization and a fuzzy controller with fusion BA were proposed. The local localization was achieved based on images from a catadioptric panoramic imaging system. The features of the pipe edge and the boundary of the area covered by biofouling were obtained by image processing and feature extraction, and then the reference path was generated based on the coordinates of the feature point that was calculated by projection transformation. The fuzzy controller was designed to make the UPCR track the reference path, and an improved BA with dynamic inertia weight and differential evolution method was developed to optimize the scale factors of the fuzzy controller online. Simulations and experiments were performed to demonstrate the validity of the proposed method.
As the operational condition of the UPCR (i.e., the irregular offshore structure covered by biofouling) is more complex and varied, future works will focus on improving the robustness and accuracy of vision localization in order to conduct field applications in the sea.
Author Contributions: Y.C., conception of the study, analysis and manuscript preparation; S.L., performed the experiment; J.F., contributed significantly to the data analyses and wrote the manuscript; C.Y. helped perform the analysis with constructive discussions and provided funding. All authors have read and agreed to the published version of the manuscript.