Abstract

In order to improve the position accuracy and trajectory accuracy of a 6R robotic arm, a robot arm inverse solution algorithm based on the MQACA- (improved quantum ant colony-) RBF network is proposed. This algorithm establishes the prediction model through the neural network and uses the quantum ant colony algorithm to optimize the output weight. In order to solve the problem that the quantum ant colony algorithm has low convergence precision and easy to fall into the local optimal solution in the inverse solution algorithm of the multifreedom robotic arm, improved measures such as 2-opt local optimization and maximum minimum pheromone limit and variation are adopted. By comparing the simulation results of the 6R robotic arm simulation results and the simulation results based on ACA, QACA, and RBF neural networks on the position and motion trajectory of the space point, the advantages in precision are obvious. This proves the feasibility and effectiveness of the scheme.

1. Introduction

In modern manufacturing, the robotic arm is a more important electromechanical integration device. It has a wide range of applications. The proportion of 6R robotic arms in these robotic arms is about 90% [1]. In order to adapt to different trajectory planning tasks, the robotic arm will be adjusted accordingly, which is closely related to the diversification of production. On the basis of dynamics and kinematics theory, the accuracy of the inverse solution [2] is a decisive factor for the accuracy and efficiency of the trajectory planning of the robot arm.

The inverse solution of the 6R robot arm is the basis and premise of the robot arm trajectory planning. Because the inverse solution equations have high dimensional and nonlinear characteristics, the solution is complex, and it is difficult to find accurate solutions. Traditional inverse solution can be roughly divided into algebraic methods [37] and geometric methods [8, 9]; due to poor results, it has been rarely used. In the more popular numerical iterative method at this stage [1013], evolutionary, bionic and simulated annealing, neural networks, and other algorithms are more common intelligent algorithms [1416]. Although these methods have achieved remarkable results, they are still unsatisfactory and limited in terms of convergence effect and accuracy of solutions. Therefore, they need to be further explored and improved.

In the intelligent algorithm, the RBF neural network is a very important algorithm, which can approximate any nonlinear function within a finite set and arbitrary precision. Some scholars have realized the importance of the neural network and used it to solve the inverse solution of the 6R robotic arm to obtain a relatively ideal effect [1719]. In this paper, an algorithm based on the MQACA- (improved quantum ant colony-) RBF network is proposed to optimize the output weight of the improved quantum ant colony, and good results are obtained.

2. 6R Mechanical Arm Kinematics Model

For the ZrARM arm, the number of degrees of freedom is six, and the joints are all rotating joints. The forward kinematics problem is solved and the ZrARM arm improved DH model coordinate system as shown in Figure 1 [20].

From [21], it can be seen that the coordinate conversion matrix of the manipulator end joint coordinate system relative to the base coordinate system is in this matrix represents the position of the end of the manipulator in the base coordinate system. The RPY Euler angle can be described by the following formula [2123]:

From the above formula, it can be seen that since the variables in (1) are all functions of the joint angle θi, the end position can be obtained in the case of θi determination.

3. Establishment of Prediction Model of Inverse Solution Based on MQACA-RBF Network

3.1. Establishment of the Prediction Model of Mechanical Arm Inverse Solution

In order to find the inverse solution of the robot arm, the inverse solution prediction model of the RBF neural network is established. In order to further improve the inverse solution accuracy, the output weight value is optimized by improving the quantum ant colony algorithm, so that the error between the output and the actual output of the network is minimized.

As a kind of the neural network learning algorithm, the structure of the RBF neural network includes the input layer, hidden layer, and output layer. Figure 2 shows the structure diagram of the RBF neural network of the n-dof manipulator [20]. In the figure, it is assumed that the input of the RBF neural network is the end position variable , , and the output variable is the inverse solution of the robot arm, that is, n joint angles , , where is an n-dimensional vector, and the relationship between x and y iswherewhere —type k sample input parameters; —the node center of the ith hidden layer function; —number of nodes; —weight from the implicit layer to output layer; —the actual output of the degree of freedom; and —variance of hidden layer functions.

Quantum Ant Colony Optimization Algorithm (QACA) is an operation that enables all ants to implement quantum bit coding method and updates by quantum revolving door. Therefore, its population number is relatively small, the algorithm performance is relatively high, and the convergence rate is fast. In addition, the optimization ability of the quantum ant colony is significantly enhanced, and the number of iterations is significantly reduced. Therefore, its vitality and scientific research values are very strong [24, 25]. Although its advantages are very prominent, there are still some problems in optimization efficiency, robustness, and convergence speed, which are closely related to large coding space and complex calculation.

In this paper, QACA and RBF neural networks are combined to complement each other’s advantages and make full use of the efficient optimization capability of the quantum ant colony, and improvement measures are proposed to form the inverse solution algorithm of the mechanical arm based on the MQACA-RBF network. MQACA is used to optimize the output weight of the RBF neural network. Improvements to QACA include: (1) using the 2-opt local optimization algorithm to increase the diversity of path selection of the ant colony in the grid; (2) using maximum and minimum pheromone constraints to increase the feasibility of searching for better solutions and ensure the inspiration of experience for the ant colony; (3) on the basis of the optimal path of each group of ant colony, the mutation operation of the genetic algorithm is used to improve the quantum ant colony algorithm to avoid local optimum and ensure the accuracy and convergence of the algorithm.

3.2. MQACA Algorithm

The training sample of the inverse solution algorithm of the robotic arm can be obtained by positive kinematics formulas, as long as any joint angles are known, through formulas (1)–(4). You can get the corresponding position variables , and . Then, using the idea of MQACA theory [2628], the output weight of each working area is sought, and the sample selection is based on this.

3.2.1. Coding Scheme

In order to improve the randomness of population initialization coding, the following coding scheme is used to obtain a set of digital codes for each grid point [29]. Let ants arrive at the end point from the starting point to get the solution of the output weight value . The established decoding formula iswhere , .

Combine the output weight obtained by decoding to obtain a set of solutions for . In this group solution, n represents the spatial dimension (6R robotic arm n = 6), when the size of the ant colony does not change, and if the space occupied by the ant increases, the search space can be doubled and the convergence speed can be greatly increased [30].

3.2.2. Status Transfer Rule

In the grid established at each output weight of the RBF network, qubits can represent the quantum pheromones of the nodes in the quantum ant colony algorithm, and their conversion can be completed by the quantum rotation gate. The adjustment form of the quantum rotation gate can be defined as [31]

In the formula, , is the probability amplitude of the ith qubit of the t iteration, and is the rotate angle of the ith qubit.

The probability of ant k moving from node i to j [29] is defined aswhere ; ; is the amount of pheromone that exists between the cell point and the cell point of the ant k; The information heuristic factor is represented by , which reflects the importance of the trajectory relative to the path. The more paths the ant goes, the greater the value of in general is. The network node is represented by . The quantum information intensity can be expressed as . The following is its expression:

In this expression, represents the probability that the quantum state of the j qubit collapses to [32].

3.2.3. Determine the Fitness Function

It corresponds to a given training sample set , , where the training sample number is represented by . In order to determine the fitness function, it is necessary to calculate the mean square root error of the actual output and expected output of the neural network first and to determine the adaptability function, i.e.,where —total number of training samples; —target output and network operation results for unit i of sample k.

3.2.4. Local Search 2-Opt Algorithm

The 2-opt local optimization algorithm is used to increase the diversity of ant colony and accelerate the convergence rate of the quantum ant colony algorithm.

The 2-opt algorithm is an abbreviation of 2-optimization. In simple terms, it is the optimization of two elements, also known as 2-exchange [33].

The main purpose of the 2-opt algorithm is to randomly select an interval segment for optimization. This optimization is only about the optimization of the current situation, not the optimization of the global. The steps of the algorithm are shown in Figure 3

The approach obtained by this algorithm is locally optimal, that is, it is based on the number of iterations. Different results may occur. Therefore, it is not an absolutely accurate result. It is only a relatively correct result after optimization.

3.2.5. Global Update of Pheromones Based on Maximum and Minimum Pheromones

In the process of convergence, the ant colony algorithm may show that the pheromones on one path are much larger than the rest of the paths, resulting in convergence to the local optimal solution. The maximum and minimum pheromone ant colony algorithm limits the amount of information on each path to, which can effectively avoid local stagnation in the search process [34].

Scientific setting and is crucial to the maximum and minimum pheromone ant colony algorithm. In the search process, the maximum pheromone growing on each iteration path is , where can represent the current global optimal moderate function, in other words, the mean square root error of the real output and the desired output. When the optimal solution changes in the iterative process, and will change at the same time. The inverse proportional relationship between and functions and , in contrast, is a positive proportional relationship with “elite ants”. It can be seen that dynamic adjustments can be made to and using the following method. The adjustment strategy is divided into the following steps:(a)Before the initial moment pheromones are not updated, the adjustment strategy is as follows:(b)After the pheromones are updated, the adjustment strategy is as follows:

In the formula, represents the number of “elite ants.”

3.2.6. Variation Operation

On the basis of the maximum minimum pheromone limit and the optimal path of each ant colony, the genetic algorithm (mutation operation) is used to reduce the local optimal solution problem in the search process of the quantum ant colony algorithm.

The ant colony algorithm is improved by using genetic algorithm variation [35]. In the process of variation, a certain node of the ant path is randomly selected to mutate, and is gradually reduced as the number of iterations increases to ensure the convergence of the ant colony algorithm. Let the number of path nodes of the ant be n, then there is

In this formula, the current number of iterations is represented by t, and the maximum number of iterations is represented by tmax. The variation method is to randomly take a 0–9 integer from the selected series of nodes. If the result of the mutation is better than the original, the mutated ant path is replaced by the current path.

3.3. MQACA-RBF Network Algorithm Steps

In summary, induction of the MQACA-RBF network algorithm to determine and the corresponding steps are as follows:Step 1: QACA algorithm population initialization.Step 2: the initial value of the number of evolutions is .Step 3: by coding, the RBF neural network is modeled according to , and the joint angle prediction accuracy of each group of parameters is obtained.Step 4: update the rotation angle of the quantum rotation door, update the quantum pheromones at different nodes, achieve quantum initialization, and adjust the pheromone content on different paths.Step 5: probability transition formula (9) needs to be chosen to proceed to the next lattice point. When ant comes to the termination point, it can calculate the value and then return to step (4) by decoding the formula.Step 6: if , then enter step 7.Step 7: the optimal adaptation function and optimal solution in the current ant population are selected, and the global pheromones are updated according to the maximum and minimum pheromones.Step 8: local search 2-opt optimization, mutation, and other measures were carried out for .Step 9: assuming that the optimal adaptive function value and the maximum number of iterations of the ant population have not changed too much, the optimal model parameters can be obtained, and then enter step (11).Step 10: the number of iterations is added by 1, that is, and then return to step (4).Step 11: were calculated as the optimal parameter (the optimal parameter of each joint angle prediction model).Step 12: The MQACA-RBF neural network is modeled on and predicts the test set. For this reason, the joint angle prediction value can be obtained through the output model.

According to the steps above, the flow chart of the MQACA-RBF inverse solution algorithm is obtained as shown in Figure 4.

3.4. Normalization of Sample Parameters

In the process of calculating the data through the model, due to the influence of many factors, the problem of data overflow may be caused. Therefore, it is necessary to standardize the sample parameters to ensure the computational efficiency of the prediction model. The sample parameters are normalized to range from 0 to 1. The normalization formula iswhere z—parameters before normalization; zmin—minimum parameter; zmax—maximum parameter; and z′—normalized parameters.

4. Simulation Experiment and Error Analysis of 6R Manipulator

4.1. Establishment of a Prediction Model for the Inverse Solution of 6R Robotic Arm

In order to follow the algorithm steps in Section 3.3 for simulation experiments, according to the MQACA algorithm to optimize the output weight of Figure 2, the ant gets each output weight in the process of passing through each nd grid [29]. In the work space of the 6R robotic arm, 8000 points are randomly generated, and 1000 points are selected as training samples. After normalization, the input parameters of the RBF network are formed, i.e., . In order to obtain the output parameters of the RBF network, the joint angle (17) needs to be normalized, i.e., . Based on this, a prediction model of the 6-input 6-output inverse solution algorithm based on the MQACA-RBF network is established, training in predictive models based on a sample of 1000 points.

After determining the position parameters, the number of joint angles between 0 and 1 can be obtained by using the prediction model, and then the reverse normalization is performed, i.e.,where —the output joint angle predicted after normalization.

4.2. Analysis of Spatial Random Point Errors

The space point simulation experiment of the ZrARM 6R manipulator is carried out. The DH parameters of the ZrARM arm are shown in Table 1 according to the structural parameters and the external dimensions of the arm.

In the MATLAB software environment, using the modeling in Section 3.1 and the 1000 points in the ZrARM model space as samples, the MQACA-RBF network method is used to simulate, and 100 points are randomly selected. Compared with the inverse solution algorithm simulation results of ACA, QACA, and RBF neural networks in the same operating environment, the position error of the four algorithms is shown in Figure 5 according to the distance between the actual coordinate point position and the target coordinate point position.

It is clearly seen from Figure 5 that the location accuracy of the inverse solution of the MQACA-RBF network is the highest in the four algorithms, and the error is stable and the change is smooth. In order to improve the real-time and convergence speed of the system, the method of online training is used in practice.

4.3. Error Analysis of Motion Trajectory
4.3.1. Selection of Locus Points

Figure 6 shows the end of the ZrARM robotic arm, a known elliptical trajectory that is simulated in the established model space.

In order to analyze the trajectory error, on this known trajectory curve, according to the trajectory length, 30 feature points are evenly selected as a description of the trajectory. The position of the end of the robot arm corresponding to the selected 30 points is calculated by equations (1)–(4) to obtain 30 sets of known , and position parameter values and the corresponding 30 sets of known inverse values are obtained, which are used as reference point for trajectory error analysis.

4.3.2. Error Analysis of Inverse Solution of Motion Trajectory

The 30 selected feature points on the trajectory in Section 4.3.1 are used as inputs. After the inverse solution algorithm based on the MQACA-RBF network is calculated and normalized, 30 sets of predicted output values are obtained. In order to evaluate the prediction effect of the model objectively, absolute error index is used to evaluate it. As shown in Figures 7 and 8, the inverse solution prediction values of 30 sets of joint angles to corresponding to the selected 30 points are compared with the absolute error of the real values in the same posture. Among them, the minimum absolute error differences of joint angles were 2.1679e − 05 rad, 8.5494e − 05 rad, 3.4619e − 05 rad, 3.1973e − 05 rad, 9.5498e − 05 rad, and 5.8276e − 05 rad, and the maximum absolute error differences were 0.10825 rad, 0.3027 rad, 0.10811 rad, 0.12094 rad, 0.18941 rad, and 0.25166 rad, respectively. According to formula (12), the mean square root errors of joint angle are 0.12147 rad, 0.37941 rad, 0.11798 rad, 0.19206 rad, 0.28645 rad, and 0.38298 rad, respectively.

Therefore, it can be seen that, in the prediction model of the 6R robotic arm inverse solution based on MQACA-RBF, the accuracy error of angular prediction is small, and the prediction accuracy is high.

In order to compare with other inverse solutions, randomly select points A (spatial coordinates: 10.6601, −2.0700, and 12.4255) and B (spatial coordinates: 11.5458, −1.7339, and 11.1018) among the above 30 points, The inverse solutions of point A and point B are obtained by using four algorithms: MQACA-RBF network, ACA, QACA, and RBF network. Tables 2 and 3 show the inverse results of the four algorithms under the same posture conditions. From the specific data comparison, it can be seen that the RBF network algorithm has better results in the inverse solutions of ACA, QACA, and RBF networks. However, the prediction accuracy of the MQACA-RBF network proposed in this paper is the highest, and it is closer to the real value.

4.3.3. Coordinate Point Error Analysis

In order to analyze the error of the trajectory from the angle of the coordinate point position, for the 30 feature points selected in Figure 4, the joint angle data of the inverse solution of each of the four algorithms ACA, QACA, RBF neural network, and MQACA-RBF network are used. After entering the positive solution equation, the actual values corresponding to the x-axis, y-axis, and z-axis coordinate values can be obtained. The coordinate error of the coordinate point position iswhere m— number of feature point; — represents x, y, or z coordinates; —absolute error between the actual value x (y or z) of point m coordinates and the true value x (y or z) of the coordinates; —the actual value of point x (y or z) coordinates; and —the true value of point x (y or z) coordinates.

Figure 9 shows the error comparison of the x, y, and z coordinates of the above four algorithms for the 30 feature points. It can be seen that the MQACA-RBF network algorithm has the smallest error.

From the spatial position point of view, the location error comparison of the four algorithms ACA, QACA, RBF network, and MQACA-RBF network can be obtained by calculating the position error formula of equation (19), as shown in Figure 8. Table 4 shows the data comparison of the spatial positions, maximum, minimum, and average of the four algorithms:where —location error of point m on trajectory.

As can be seen from Figures 9 and 10 and Table 4, the trajectory coordinate error and position error based on the inverse solution algorithm of the MQACA-RBF network are minimal; The average error of x, y, and z coordinates of the actual point position is 0.05269 mm, 0.04109 mm, and 0.04306 mm, respectively. The average error of the actual point position is 0.09144 mm, which is superior to the ACA, QACA, and RBF network algorithms. It can be seen that the coordinate points corresponding to the position error are combined with x, y, and z coordinate points, which best reflect the position error of the end of the manipulator. Based on the inverse solution algorithm of MQACA-RBF network, the fitting error between the end of the robot arm and the set trajectory is minimal, and it is very stable and robust, which proves that the scheme is feasible.

5. Conclusion

In this paper, a manipulator inverse solution algorithm based on the MQACA-RBF network is proposed. This method effectively synthesizes the characteristics of the RBF neural network and MQACA algorithm and gives play to their respective strengths. From the results of spatial random selection, trajectory simulation experiments, and position error simulation, it can be seen that the inverse solution algorithm using the MQACA-RBF network is compared with the inverse solution algorithm based on ACA, QACA, and RBF networks, and the position error increased by 3.89%, 6.19%, and 0.76%, respectively. It can be seen that the robot arm inverse solution prediction model based on the MQACA-RBF network has higher accuracy and universality, and it has the reference value for other inverse solution methods and further robot arm spatial path planning.

Data Availability

The data used to support the findings of this study are included within the article. The source program used to support the findings of this study is included within the supplementary information file.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The research was funded by the Basic Research Project of the Liaoning University of Science and Technology of China.

Supplementary Materials

Running a file named “main3.m,” you can get the motion track error analysis in Section 4.3 of the paper required by the simulation map and data. The folder named “matlab program for continuous function optimization problem based on basic quantum ant colony algorithm” contains the quantum ant colony algorithm for the inverse solution of the manipulator. The file, called “Q_QACA.mat,” is the program running in the “matlab program for continuous function optimization problem based on the basic quantum ant colony algorithm” folder generated by the quantum ant colony algorithm to solve the manipulator inverse solution of the file. The folder named “basic ant colony algorithm continuous function optimization problem matlab program” contains the ant colony algorithm to solve the inverse solution of the robot arm program. The folder named “Q_ACA.mat” is the program in the process of “basic ant colony algorithm continuous function optimization problem matlab program” folder which generated the ant colony algorithm to solve the inverse solution of the robot arm file. The folder named “MQACA_rbf.mat” uses the RBF toolbox to model, uses quantum ant colony algorithm to optimize the output weight of RBF neural network, and calls the “matlab program for continuous function optimization problem based on basic quantum ant colony algorithm.” The folder named “opt2.m” is for 2-opt local optimization. The folder named “update_all_tao.m” is for Max Min pheromone limit, and the document, called “ObjV.m,” uses genetic variation and other improvements to improve the system’s motion accuracy by further improving its heuristics, increasing the diversity of population and path selection. (Supplementary Materials)