HybridMutationFruit FlyOptimizationAlgorithm for Solving the Inverse Kinematics of a Redundant Robot Manipulator

-e inverse kinematics of redundant manipulators is one of the most important and complicated problems in robotics. Simultaneously, it is also the basis for motion control, trajectory planning, and dynamics analysis of redundant manipulators. Taking the minimum pose error of the end-effector as the optimization objective, a fitness function was constructed. -us, the inverse kinematics problem of the redundant manipulator can be transformed into an equivalent optimization problem, and it can be solved using a swarm intelligence optimization algorithm. -erefore, an improved fruit fly optimization algorithm, namely, the hybrid mutation fruit fly optimization algorithm (HMFOA), was presented in this work for solving the inverse kinematics of a redundant robot manipulator. An olfactory search based on multiple mutation strategies and a visual search based on the dynamic real-time updates were adopted in HMFOA.-e former has a good balance between exploration and exploitation, which can effectively solve the premature convergence problem of the fruit fly optimization algorithm (FOA). -e latter makes full use of the successful search experience of each fruit fly and can improve the convergence speed of the algorithm. -e feasibility and effectiveness of HMFOA were verified by using 8 benchmark functions. Finally, the HMFOA was tested on a 7-degree-of-freedom (7-DOF) manipulator. -en the results were compared with other algorithms such as FOA, LGMS-FOA, AE-LGMS-FOA, IFOA, and SFOA.-e pose error of end-effector corresponding to the optimal inverse solution of HMFOA is 10 14 mm, while the pose errors obtained by FOA, LGMS-FOA, AE-LGMS-FOA, IFOA, and SFOA are 102 mm, 10 1 mm, 10 2 mm, 102 mm, and 102 mm, respectively. -e experimental results show that HMFOA can be used to solve the inverse kinematics problem of redundant manipulators effectively.


Introduction
Forward kinematics and inverse kinematics are two basic problems in robot kinematics. e forward kinematics which determines the pose of the end-effector relative to the reference coordinate system according to the joint variables of the robot is relatively easy, and its solution is analytical, deterministic, and unique, while the inverse kinematics, to obtain the joint variables from the pose of the end-effector, is a complex system of nonlinear equations with the strong coupling of variables. As a result, it is a much more difficult problem than the forward kinematics. e inverse kinematics problem plays an important role in robotics, which is the premise and foundation of robot motion control, trajectory planning, and dynamic analysis [1].
Generally, the conventional methods for solving the inverse kinematics problem of robots are closed-form methods and numerical methods [2]. e closed-form methods, which consist of algebraic [3] and geometric [4], have the advantages of fast solution speed, high accuracy, and accessibility in obtaining all possible inverse solutions. However, the closed-form methods highly depend on the configuration of the robot. If a robot does not meet the Pieper criterion [5], the closed-form methods cannot be applied to solve the inverse kinematics problem. erefore, only a very small class of kinematically simple robots is suitable for the closed-form methods to obtain complete analytical solutions. e numerical methods are the main methods to resolve the inverse kinematics of complex articulated manipulators. Unfortunately, the numerical methods may have the singularity of Jacobian matrix and may also cause considerable computational load. In addition, the redundant manipulator has an infinite number of inverse kinematics solutions to reach the same end-effector pose, which makes it more difficult to solve inverse kinematics problems by using the conventional methods.
erefore, more and more researchers have focused on solving the inverse kinematics problem using artificial intelligent optimization algorithms.
So far, various optimization algorithms such as genetic algorithm (GA) [6,7], particle swarm optimization algorithm (PSO) [8][9][10][11][12], differential evolution algorithm (DE) [2,13,14], artificial bee colony algorithm (ABC) [15], and biogeographybased optimization [16] have been proposed to calculate the inverse kinematics solutions of robots; thus the shortcomings of the conventional methods are effectively overcome. In this study, a fitness function was constructed to minimize the pose error of end-effector. en, the inverse kinematics problem was transformed into an optimization problem using the forward kinematics and the fitness function, and a novel hybrid mutation fruit fly optimization algorithm (HMFOA) was developed to solve the problem more effectively. e rest of this paper is organized as follows. Section 2 presents a brief introduction to the forward and inverse kinematics of a 7-DOF redundant robot manipulator. e HMFOA is described in Section 3. Experimental design and comparisons are illustrated in Section 4. Finally, the results of the study are summarized in Section 5.

Kinematic Analysis of a 7-DOF Robot Manipulator
In this study, the 7-DOF YuMi 14000 ABB industrial robot [17] was used as an example to discuss the inverse kinematics problem. e schematic of the 7-DOF robot is shown in Figure 1, and its links and joints are given in Figure 2. e structure diagram of the left arm of the robot is presented in Figure 3. e Denavit-Hartenberg (DH) parameters as well as lower and upper joint limits for the left arm of the robot are listed in Table 1. In the work, the left arm of the robot was only used as the object to be investigated. In Table 1, the parameters θ i , α i , d i , a i , l i , and u i (i �1, 2, 3, . . ., 7) represent the joint angle, link twist angle, link offset, link length, lower joint limit, and upper joint limit, respectively. e homogeneous transformation matrix i−1 i T of link iis formed by DH parameters in where sθ i and cθ i denote sin(θ i ) and cos(θ i ), respectively, while sα i and cα i denote sin(α i ) and cos(α i ), respectively. us, the forward kinematic can be calculated as where 0 7 T is the pose matrix of the end-effector relative to the base coordinate system. n x , n y , n z , o x , o y , o z , a x , a y , and a z represent the rotational elements of the pose matrix, while p x , p y , and p z are the elements of position vector.
According to equations (1) and (2), the pose equations are as follows.
It can be seen that the pose equations of the redundant manipulator are the functions of joint variables. Given the joint variables, the pose of the end-effector relative to the reference coordinate system can be calculated through the pose equations, and the result is unique; that is, the forward kinematics is a one-to-one relationship. However, given the pose of the end-effector, the corresponding joint variables will not be unique; that is, the inverse kinematics is a one-tomany relationship, and there are infinite inverse kinematics solutions for the 7-DOF robot manipulator.

Improved FOA
Inspired by the foraging behaviour of fruit flies, Pan [18] proposed a novel meta-heuristic algorithm, namely, the fruit fly optimization algorithm (FOA). Compared with other swarm intelligence-based algorithms, FOA has the merits of simple algorithm framework, few adjustable parameters, easy understanding, and implementation. erefore, FOA has been used to resolve many science and engineering problems [19][20][21][22]. However, FOA also has lots of shortcomings. Particularly, because the smell concentration judgment value cannot be taken a negative value, FOA cannot deal with the optimization problems with negative decision variables. In addition, the optimization performance of FOA is highly dependent on the optimal solution of the current generation. As a result, the ability to maintain population diversity is not strong, making the algorithm easy to fall into local extremum.
To improve the convergence performance of FOA, a novel hybrid mutation mechanism for osphresis searching and a real-time dynamic update mechanism for vision searching are introduced, and a new improved FOA called HMFOA is proposed in this section.

A Hybrid Mutation Mechanism for Osphresis Search.
In the original FOA, the smell concentration judgment value S i corresponds to the decision vector of the optimization problem, and its value is the reciprocal of distance. As a result, the smell concentration judgment value cannot be assigned a negative value and cannot be uniformly distributed in the search space. In HMFOA, the position of the ith fly in D-dimensional search space is presented as X i � (x i1 , x i2 , ..., x i D ), and the smell concentration judgment value of the ith fly can be directly obtained according to S i � X i . In this way, the above shortcomings can be overcome.
Inspired by the mutation idea of the differential evolution algorithm, the osphresis searching of HMFOA is executed according to equations (15)- (18).
where Pb g denotes the best previous position of all fruit flies in the swarm, Pb r1 denotes the best previous position of the r1 th fruit fly, Pb r2 denotes the best previous position of the r2 th fruit fly, r1 and r2 are random and mutually different integers generated in the range [1, m] (m presents the population size), and they also are different from the fly's index i and g; that is, r1 ≠ r2 ≠ i ≠ g. U and L are the upper and lower boundary vectors of the search space, respectively. rand 1 , rand 2 , rand 3 , rand 4 , and rand 6 are random variables uniformly distributed on the interval [0, 1]. ω is a perturbation scaling factor that controls the search radius. t is the current iteration of the algorithm and t max is the maximum iteration number of the algorithm. According to equation (15), equation (17) is selected as the searching operator with a larger probability in the early stage of algorithm evolution, which ensures that the algorithm has the strong global search ability. As the number of iterations of the algorithm increases gradually, the probability that equation (16) is selected as the searching operator also increases gradually. erefore, in the later stage of algorithm evolution, the local perturbation search near the global optimal position is enhanced. us, the convergence accuracy of the algorithm is steadily improved.
According to equations (16) and (17), it can be seen that the essence of olfactory searching is to randomly select one of the four mutation strategies according to probability as the current olfactory searching operator of the ith fly. us, a hybrid coevolution mechanism can be formed by randomly alternating different mutation strategies, and the diversity of the swarm is well maintained. e difference vector ω × (Pb r1 − Pb r2 ) is used to randomly disturb the reference vector, and it is also helpful to improve the diversity of algorithm search. According to equation (18), a nonlinear decreasing perturbation scaling factor ω is introduced to balance the global exploration and local exploitation of the HMFOA. In the early stage of iteration, the value of factor ω is relatively large, which ensures that the algorithm can carry out optimal search within a larger search radius and thus has a strong global search capability. As the value of factor ω decreases, the search radius of fruit fly individual also decreases. Hence, the local search capability of the algorithm is enhanced in the later stage of algorithm evolution, and the candidate solution with better quality can be found in local neighbourhood.

A Real-Time Dynamic Update Mechanism for Vision
Search. In the original FOA, when all fruit flies have completed their olfactory search, they fly toward the current optimal location using their visual senses. is search method, which only learns from the best individual, has the following disadvantages. Firstly, if the position corresponding to the best fruit fly individual is a local extreme value, it will easily lead to premature convergence of the algorithm. Secondly, Table 1: DH parameters for the left arm (i is the axis).  Mathematical Problems in Engineering because the contribution of nonoptimal fruit flies to population search is ignored, this search method places too much emphasis on competition among fruit flies and weakens cooperation among individuals. In order to accelerate the convergence speed of the algorithm, a dynamic real-time update mechanism is employed in the visual search. In HMFOA, the vision searching refers to the dynamic real-time update of the search center position vector in equations (16) and (17). at is, when the position of the fly is updated, the new position of the fly is evaluated immediately, and then the disturbance center position vectors Pb g , Pb g × rand 3 , and Pb i are further updated in real-time using equations (19) and (20) (in this paper, the optimization problem refers to the minimum optimization problem).
where fitness(·) is the fitness function.
In short, HMFOA can make full use of the successful search experience of each fly individual by using a real-time updated vision searching mechanism, which can effectively improve the search efficiency of the swarm.

Cross-Border Processing.
During the evolution of HMFOA, it may occur that the position of the fly is beyond the search space. In order to enhance the diversity of the swarm, the cross-border position component is processed as follows.
where rand 6 is a random variable uniformly distributed on the interval [0, 1] and l j and u j are the lower and upper bounds for x ij , respectively.

Implementation of HMFOA.
e implementation process of HMFOA is shown in Figure 4. e detailed steps of implementing the HMFOA are described as follows: Step 1: initialize relate parameters, including population size and the maximum number of iterations. en, randomly initialize the locations of all fruit flies in the search space. e best position of the fly individual is the current position. e global optimal position is selected as the current optimal position of the swarm. Assign i � 1, t � 1.
Step 2: the olfactory search of the ith fly is performed according to equations (15)- (18). e cross-border position components are processed according to equation (21) and calculate the fitness of the ith fly.
Step 3: according to equation (19), the best previous position of the swarm is updated in real time, and its objective fitness is recorded.
Step 4: according to equation (20), the best previous position of the ith fly is updated in real time, and its objective fitness is recorded.
Step 5: if all flies of the current generation complete the evolution operation, that is, i � m, the next step is executed. Otherwise, set i � i + 1 and return to step 2.
Step 6: if the iterative number reaches the maximum, that is, t � t max , the algorithm ends and the optimization results are output. Otherwise, set t � t + 1, i � 1 and return to step 2.

Simulation Results and Discussion
In this section, 8 typical benchmark functions are used to verify the performance of the HMFOA, and then the algorithm is used to solve the inverse kinematics problem of the 7-DOF YuMi 14000 ABB industrial robot. e optimization results of HMFOA are compared with those of FOA, IFOA [23], LGMS-FOA [24], AE-LGMS-FOA [25], and SFOA [26].  LGMS-FOA, we set ω 0 � 1, α � 0.95, n � 0.005. e parameters of AE-LGMS-FOA are p � 0.005, ω 0 � 1, n � 10, and 80% of the best population is used to generate X Av . For FOA, the random initialization fruit fly swarm location zone is [0, 10], and the random direction and distance of iterative fruit fly food searching are [−1, 1]. In IFOA, 50% of the individuals in a swarm fly toward the local optimal solution, and the others fly randomly; the perturbation amplification factor ω is 0.3. e DH parameters as well as lower and upper joint limits for the left arm of the robot are listed in Table 1, as mentioned above.
All algorithms are coded in MATLAB R2013a. e computation is conducted on a personal computer (PC) with Intel (R) Core (TM) i7-7700, 3.6 GHz CPU, 16 GB RAM, and Windows 10 Operational System. Table 2 are used to test the performance of HMFOA. Among them, f 1 , f 2 , f 3 , and f 4 are unimodal functions, which are employed to test the convergence speed and accuracy of the algorithm. e latter four functions are multimodal functions, which are made use of testing the global searching ability of the algorithm.

Function Simulation. Eight benchmark functions in
To evaluate the reliability of the results, each function was tested for 50 runs; the fitness results of the best value (Best), the mean value (Mean), the worst value (Worst), and the standard deviation (Std) are reported in Table 3 for all functions with dimensions equal to 30. e average convergence curve of each algorithm is shown in Figure 5.
As can be seen from Table 3, for all benchmark functions, the HMFOA is far superior to other algorithms involved in comparison in terms of the best value, mean value, worst value, and standard deviation. Among the 8 benchmark functions, HMFOA can converge to the theoretical optimal values of 7 functions (except f 7 ). For function f 7 , HMFOA also achieves satisfactory convergence quality. It can be seen from Figure 5, compared with the other five algorithms, the evolution curve of HMFOA drops faster and reaches a lower level (to facilitate evaluation and observation, the fitness of the objective function in the graph is a logarithm with the base of 10), indicating that HMFOA has the advantages of fast convergence speed and high convergence accuracy. e results in Figure 5 also show that FOA, IFOA, LGMS-FOA, AE-LGMS-FOA, and SFOA are easy to fall into local optimum.

Inverse Kinematics Solution of Redundant Manipulator.
In the inverse kinematics calculation of the manipulator, the position vector of the ith fly contains the set of the joint variables of the 7-DOF redundant manipulator, that is, , θ i2 , ..., θ i7 ], where θ i1 , θ i2 , ..., θ i7 denote 7 joint angles, respectively. For a desired pose matrix of the corresponding inverse kinematics. erefore, the optimization objective of the algorithm should be to make the matrix 0 7 T infinitely close to the matrix 0 7 T * by changing the position of the fruit fly. e orientation error and position error of the end-effector are calculated by equations (22) and (23), respectively.
us, the fitness function of the inverse kinematics problem can be defined as follows.
where min(·)is the minimum function and λ is the weight factor. In order to solve the inverse kinematics more effectively, we expand the population size of all the algorithms and set it to 100, and the rest of the parameters are the same as mentioned above. e weight factor λ is set as 10 − 2 . In this research, the desired pose matrix of the end-effector is set as follows.
In order to investigate the reliability of the results, each algorithm runs independently and continuously for 50 times, respectively. e fitness results of the Best, the Worst, the Mean, the Std, and the successful ratio (SR) are reported in Table 4. e average convergence curve of each algorithm is shown in Figure 6. One of the best inverse kinematics Mathematical Problems in Engineering solutions obtained by each algorithm is presented in Table 5. According to the inverse kinematics solutions in Table 5, the poses of the end-effector are obtained as shown in Figure 7. e pose errors of different algorithms are listed in Table 6. e SR, i.e., the percentage of trials where algorithms converge with a specified accuracy (in this study it is assigned a value of 10 − 9 ), is defined by

Mathematical Problems in Engineering
where n is the total number of trials and n ′ is the number of successful trials.
According to Table 4, the best value, worst value, mean value, standard deviation, and successful ratio of HMFOA are superior to those of other algorithms involved in comparison. e successful ratio of HMFOA is up to 94%, while the successful ratios of FOA, LGMS-FOA, AE-LGMS-FOA, IFOA, and SFOA are all zero. e best values of LGMS-     FOA and AE-LGMS-FOA are 13 and 12 orders of magnitude worse than HMFOA, respectively, while the optimization results of FOA, IFOA, and SFOA are even worse. It can be seen from Figure 6 that the HMFOA has faster convergence speed and higher convergence accuracy than the other five algorithms (to facilitate evaluation and observation, the fitness of the objective function in the graph is a logarithm with the base of 10). From Figure 7, we can directly observe the actual pose of each inverse kinematics solution.
As can be seen from Table 6, the position errors corresponding to the optimal inverse solutions of FOA, IFOA, and SFOA are 10 2 mm, 10 2 mm, and 10 2 mm, respectively. Due to the relatively large position errors, the inverse kinematic solutions obtained by FOA, IFOA, and SFOA are unacceptable.
e inverse kinematics solutions corresponding to LGMS-FOA and AE-LGMS-FOA have achieved very high orientation accuracy, and the corresponding maximum errors of the position components are orders of magnitude 10 − 1 mm and 10 − 2 mm, respectively. e orientation and position accuracy corresponding to the optimal inverse kinematics solution of HMFOA are rather higher than other methods mentioned above, which indicates that the HMFOA can be used to effectively solve the inverse kinematics problem of redundant manipulator.
In a word, the calculation results of HMFOA are better than those of FOA, LGMS-FOA, AE-LGMS-FOA, IFOA, and SFOA in the inverse kinematics solution of the 7-DOF manipulator.

Conclusions
In this study, the inverse kinematics problem of the manipulator is transformed into a minimum optimization problem, and an improved fruit fly optimization algorithm, namely, the hybrid mutation fruit fly optimization algorithm, is proposed for resolving this problem. e olfactory search mechanism based on hybrid coevolution of multiple mutation strategies is employed in the algorithm, which can effectively balance the global and local search of the algorithm. Simultaneously, the premature convergence problem of the algorithm can also be effectively solved. rough the dynamic real-time update of visual search, the successful search experience of each fruit fly individual is fully utilized.
us, the search efficiency of the swarm can be effectively improved.
e simulation results of 8 typical benchmark functions indicate the feasibility and effectiveness of the proposed algorithm. e inverse kinematics of a 7-DOF redundant manipulator is taken as an example for

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.