Weld joint detection optimal path planning method, system and equipment based on improved sparrow search algorithm and storage medium

By improving the sparrow search algorithm and artificial potential field method, combined with adaptive parameters and re-search mechanism, the problems of low efficiency and insufficient accuracy of traditional weld inspection path planning are solved, and efficient calculation and accurate planning of the optimal path for weld inspection are achieved. .

CN118569464APending Publication Date: 2024-08-30XI AN JIAOTONG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410611518.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-16
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Traditional weld inspection methods are inefficient, costly and rely on labor, which results in long time and low accuracy in weld inspection path planning, making it difficult to calculate the optimal path.

Method used

The improved sparrow search algorithm is used, combined with the artificial potential field method and adaptive parameters, and through the iterative search mechanism and re-search mechanism, the optimal path sequence for weld seam detection is calculated, reducing the difficulty of path planning and improving efficiency and accuracy.

Benefits of technology

It significantly reduces the calculation time of the optimal path for weld inspection, improves the accuracy and efficiency of path planning, can find the global optimal solution faster, and avoids local optimal traps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569464A
    Figure CN118569464A
Patent Text Reader

Abstract

The invention discloses a weld joint detection optimal path planning method, system and device based on an improved sparrow search algorithm and a storage medium. The method comprises the steps that S1, three-dimensional position information of a workpiece weld joint and an obstacle is obtained; s2, traversing by using an artificial potential field method to obtain reachable paths and path distances among the welding seams; s3, discretizing a sparrow search algorithm, and using adaptive parameters and a re-search mechanism in a population iteration process to obtain an optimal sequence with a shortest reachable path for traversing a welding seam; and S4, by combining the three-dimensional position information of the weld joints, the reachable paths between the weld joints and the optimal sequence of traversing the weld joints, obtaining a complete optimal path for weld joint detection. The optimal path calculation difficulty in the welding seam detection process is reduced, and the optimal path planning efficiency and precision are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of weld detection, and relates to a weld detection optimal path planning method, system, equipment and storage medium based on an improved sparrow search algorithm. Background Art

[0002] Welded structures are widely used in industrial fields such as aerospace, aviation, nuclear industry, shipbuilding and machinery manufacturing. However, due to the influence of different welding processes and welding environments, defects such as pores, inclusions, cracks and holes will inevitably appear inside the weld, seriously affecting the structural strength and its safety performance.

[0003] Traditional weld inspection is carried out by manual film radiography, which is not only inefficient and costly, but also has the disadvantages of strong subjective dependence and poor stability. Therefore, the weld inspection of various welding workpieces has gradually adopted the robot arm digital radiography method, but the path planning of the robot arm still mainly relies on manual teaching during the inspection process, and there are problems that need to be solved, such as difficulty in calculating the optimal path, long path planning time, low accuracy, and high requirements for teaching workers. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a method, system, device and storage medium for optimal path planning of weld detection based on an improved sparrow search algorithm, which reduces the difficulty of optimal path calculation during weld detection and improves the efficiency and accuracy of optimal path planning.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] An optimal path planning method for weld inspection based on an improved sparrow search algorithm includes the following processes:

[0007] S1: Obtain the three-dimensional position information of the workpiece weld and obstacles;

[0008] S2: Use the artificial potential field method to traverse and obtain the accessible paths and path distances between each weld;

[0009] S3: Discretize the sparrow search algorithm and use adaptive parameters and re-search mechanism in the population iteration process to obtain the optimal sequence with the shortest reachable path through the weld;

[0010] S4: Combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld inspection.

[0011] Preferably, in S2, for a workpiece with n welds, there are several sequences X=[x 1 ,x 2,…,x n ], the weld traversal sequence X describes the order of traversing n welds, where x i (i=1,2,…,n) represents the number of the weld traversed by the i-th time point, x i =[x ij ,x ik ](j∈[1,2],k=3-j),x ij ,x ik Indicates weld x i The traversal direction.

[0012] Preferably, the specific process of S3 is:

[0013] S31: Set the parameters of the sparrow search algorithm, including the size of the sparrow population pop, the maximum number of iterations iter_max, the current number of iterations iter_current, the warning value ST, the proportion of discoverers PD, the proportion of anti-predators SD, the number of re-searches iter_again, and the maximum number of re-searches iter_again_max;

[0014] S32: Initialize the sparrow population, and randomly generate a traversal weld sequence X for each sparrow i. i , get the pop bar traversal weld sequence;

[0015] S33: combining the reachable path distance between welds and the traversed weld sequence, obtaining the traversed weld path distances of all sparrows one by one, and arranging the traversed weld sequence in ascending order according to the traversed weld distances;

[0016] S34: iteratively searching for an optimal solution for the sparrow population according to the parameters set in S31;

[0017] S35: outputting the first-ranked weld traversal sequence as the optimal weld traversal sequence, and outputting the first weld traversal path distance as the optimal weld traversal distance.

[0018] Further, the specific process of S34 is:

[0019] S341: The sparrow whose path distance ranks before pop*PD is regarded as the discoverer, representing a better traversal weld sequence, and the remaining sparrows are regarded as followers;

[0020] S342: Update the finder sparrows one by one;

[0021] S343: Update the follower sparrows one by one;

[0022] S344: Randomly select pop*SD sparrows from the entire sparrow population as anti-predators, and update the paths of the anti-predators one by one. If the anti-predator X iIf the anti-predator is the best sparrow, the learning strategy is used to randomly learn the path from other sparrows and make corrections; if the anti-predator is not the best sparrow, the learning strategy is used to learn the path from the best sparrow and make corrections;

[0023] S345: combining the reachable path distances between welds, obtaining the traversed weld path distances of all sparrows in the current population one by one, comparing the traversed weld path distances of the current iteration with those of the previous iteration for each sparrow, if the traversed weld path distance of the current iteration is less than the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the current iteration; if the traversed weld path distance of the current iteration is greater than or equal to the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the previous iteration;

[0024] S346: Arrange the traversed weld sequence in ascending order according to the distances of all welds traversed;

[0025] S347: add 1 to the current number of iterations, iter_current = iter_current + 1. If the current number of iterations iter_current is less than or equal to the maximum number of iterations iter_max, go to S341 to continue iterative optimization.

[0026] S348: After the current number of iterations iter_current reaches the maximum number of iterations, if the number of re-searches iter_again is less than the maximum number of iterations iter_again_max, the number of re-searches is increased by 1, iter_again=iter_again+1, the current number of iterations is reset to 1, and go to S32 to continue searching for the best result; if the current number of re-searches iter_again is greater than or equal to the maximum number of iterations iter_again_max, go to S35.

[0027] Further, the specific process of S342 is: if the random number R 1 (R 1 ∈[0,1]) is less than the warning value ST, the weld sequence traversed by the discoverer sparrow is changed in a large range, divided into several subsequences and each subsequence has no less than 4 welds, and two welds x are randomly selected from each subsequence a 、x b , swap the two selected welds x in each subsequence a 、x b The position of each subsequence is selected by the weld x a 、x b The traversal directions of each are changed randomly; if the random number R 1 (R 1∈[0,1]) is greater than or equal to the warning value ST, the traversal weld sequence of the discoverer sparrow is changed in a small range, and two welds x are randomly selected from the entire traversal weld sequence. a 、x b , randomly select and exchange two welds x in the entire sequence a 、x b Position or reverse order of two welds x a 、x b The sequence between the two strategies is slightly changed, and the selected weld x in the sequence a 、x b The respective traversal directions change randomly.

[0028] Further, the specific process of S343 is: if the follower Sparrow X i If the ranking of the entire sparrow population is before pop(1+PD) / 2, that is, the ranking among followers is before 50%, then the follower sparrow X i Better performance, follower Sparrow X i Use the learning strategy to randomly learn the path from the better discoverer sparrow, and randomly select a discoverer sparrow X j As learning objects, two welds x are randomly selected from the entire traversed weld sequence. a 、x b , will follow the sparrow X i Weld Sequence x a 、x b The sequence between the two welds is replaced by the Finder Sparrow X j The sequence of corresponding positions, while the weld x a 、x b The respective traversal directions are randomly changed, and the follower sparrow X is replaced outside the sequence i The learned traversal weld sequence is corrected by randomly replacing the repeated welds with the missing welds in the random traversal direction; if the follower sparrow X i If the ranking of the entire sparrow population is after pop(1+PD) / 2, that is, after 50% of the followers, then the follower sparrow X i Poor performance, Sparrow X to followers i Initialize the traversal weld sequence and randomly generate the traversal weld sequence X i .

[0029] Furthermore, the sparrow search algorithm adopts a re-search mechanism. When the sparrow population falls into a local optimum, the weld traversal sequences of all sparrows tend to be consistent and the population cannot jump out of the local optimal state, the sparrow population is disrupted to increase the diversity of the sparrow population and make all sparrows search again.

[0030] An optimal path planning system for weld inspection based on an improved sparrow search algorithm comprises:

[0031] Three-dimensional position information acquisition module: used to obtain the three-dimensional position information of the workpiece weld and obstacles;

[0032] Traversal module: used to traverse using the artificial potential field method to obtain the accessible paths and path distances between each weld;

[0033] Optimal sequence acquisition module: used to discretize the sparrow search algorithm and use adaptive parameters and re-search mechanism in the population iteration process to obtain the optimal sequence with the shortest path to traverse the weld;

[0034] Optimal path acquisition module: used to combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld detection.

[0035] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the optimal path planning method for weld detection based on an improved sparrow search algorithm are implemented.

[0036] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the optimal path planning method for weld detection based on an improved sparrow search algorithm are implemented.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] The present invention designs a feasible path planning optimization algorithm to replace the manual solution and planning of the optimal path. The artificial potential field method is first used to obtain the reachable path and distance between each weld, and then the improved sparrow search algorithm is used to optimize the traversal weld sequence, which can greatly reduce the time and difficulty of solving the optimal path in the weld detection process, and improve the accuracy and efficiency of the optimal path planning. In order to better solve the discrete asymmetric TSP problem of traversing the optimal sequence of welds, the sparrow search algorithm is discretized, and an effective update strategy for the sparrow traversal weld sequence is proposed; in the iterative optimization process of the sparrow search algorithm, the warning value ST and the discoverer ratio PD that dynamically change with the number of iterations are used to better balance the optimization speed and the global optimal ability in the entire update process, and increase the possibility of jumping out of the local optimal; a re-search mechanism is added to make the sparrow search algorithm have two layers of loops. After the sparrow population falls into the local optimal state and cannot escape, the sparrow population is forcibly dispersed to escape the local optimal state, and the search is re-performed to increase the probability of finding the global optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is the overall flow chart of the present invention;

[0040] Figure 2 A three-dimensional model diagram of a barrel section workpiece to be inspected;

[0041] Figure 3 Solve the optimal sequence flow chart for traversing all welds for the improved sparrow search algorithm;

[0042] Figure 4 It is a schematic diagram of the traversal weld sequence of a single sparrow;

[0043] Figure 5 A schematic diagram of the strategy for traversing weld sequences was updated for the finder sparrow on a large scale;

[0044] Figure 6 Schematic diagram of two strategies for updating the traversal of weld sequences in a small range for the discoverer sparrow;

[0045] Figure 7 A diagram of the learning path strategy for sparrows;

[0046] Figure 8 The figure is a comparison chart of the number of iterations and average path distance of various methods. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0048] It should be noted that the words "front", "rear", "left", "right", "up" and "down" used in the following description refer to directions in the drawings, and the words "inside" and "outside" refer to directions toward or away from the geometric center of a specific component, respectively.

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0050] like Figure 1 As shown, the optimal path planning method for weld detection based on the improved sparrow search algorithm of the present invention includes the following steps:

[0051] S1: Obtain the three-dimensional position information of the workpiece weld and obstacles.

[0052] S2: Use the artificial potential field method to traverse and obtain the accessible paths and path distances between each weld.

[0053] S3: An improved sparrow search algorithm is used to solve the optimal sequence of the shortest path for traversing the weld. The improved sparrow search algorithm discretizes the sparrow search algorithm and uses adaptive parameters and a re-search mechanism in a population iteration process to obtain the optimal sequence for traversing the weld.

[0054] S4: Combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld inspection.

[0055] In S2, for a workpiece with n welds, there are several sequences X=[x 1 ,x 2 ,…,x n ], the weld traversal sequence X describes the order of traversing n welds, where x i (i=1,2,…,n) represents the number of the weld traversed by the i-th time point, x i =[x ij ,x ik ](j∈[1,2],k=3-j),x ij ,x ik Indicates weld x i The traversal direction.

[0056] The steps of using the improved sparrow search algorithm to solve the optimal sequence of the shortest weld path traversal include:

[0057] S31: Set the parameters of the improved sparrow search algorithm, including the sparrow population size pop, the maximum number of iterations iter_max, the current number of iterations iter_current, the warning value ST, the discoverer ratio PD, the anti-predator ratio SD, the number of re-searches iter_again, and the maximum number of re-searches iter_again_max;

[0058] S32: Initialize the sparrow population, and randomly generate a traversal weld sequence X for each sparrow i. i , get the pop bar traversal weld sequence;

[0059] S33: combining the reachable path distance between welds and the traversed weld sequence, obtaining the traversed weld path distances of all sparrows one by one, and arranging the traversed weld sequence in ascending order according to the traversed weld distances;

[0060] S34: Iteratively search for the optimal solution for the sparrow population, the specific steps include:

[0061] S341: The sparrow whose path distance ranks before pop*PD is regarded as the discoverer, representing a better traversal weld sequence, and the remaining sparrows are regarded as followers.

[0062] S342: Update the discoverer sparrows one by one. If the random number R 1 (R 1 ∈[0,1]) is less than the warning value ST, the weld sequence traversed by the discoverer sparrow is changed in a large range, divided into several subsequences and each subsequence has no less than 4 welds, and two welds x are randomly selected from each subsequence a 、x b , swap the two selected welds x in each subsequence a 、x b The position of each subsequence is selected by the weld x a 、x b The traversal directions of each are changed randomly; if the random number R 1 (R 1 ∈[0,1]) is greater than or equal to the warning value ST, the traversal weld sequence of the discoverer sparrow is changed in a small range, and two welds x are randomly selected from the entire traversal weld sequence. a 、x b , randomly select and exchange two welds x in the entire sequence a 、x b Position or reverse order of two welds x a 、x b The sequence between the two strategies is slightly changed, and the selected weld x in the sequence a 、x b The respective traversal directions change randomly.

[0063] S343: Update the follower sparrows one by one. If the follower sparrow X i If the ranking of the entire sparrow population is before pop(1+PD) / 2, that is, the ranking among followers is before 50%, then the follower sparrow X i Better performance, follower Sparrow X i Use the learning strategy to randomly learn the path from the better discoverer sparrow, and randomly select a discoverer sparrow X j As learning objects, two welds x are randomly selected from the entire traversed weld sequence. a 、x b , will follow the sparrow X i Weld Sequence x a 、x b The sequence between the two welds is replaced by the Finder Sparrow X j The sequence of corresponding positions, while the weld x a 、xb The respective traversal directions are randomly changed, and the follower sparrow X is replaced outside the sequence i The learned traversal weld sequence is corrected by randomly replacing the repeated welds with the missing welds in the random traversal direction; if the follower sparrow X i If the ranking of the entire sparrow population is after pop(1+PD) / 2, that is, after 50% of the followers, then the follower sparrow X i Poor performance, Sparrow X to followers i Initialize the traversal weld sequence and randomly generate the traversal weld sequence X i .

[0064] S344: Randomly select pop*SD sparrows from the entire sparrow population as anti-predators, and update the paths of the anti-predators one by one. If the anti-predator X i If it is the best sparrow, the learning strategy is used to randomly learn the path from other sparrows and make corrections; if the anti-predator is not the best sparrow, the learning strategy is used to learn the path from the best sparrow and make corrections.

[0065] S345: Combined with the reachable path distance between welds, the traversal weld path distances of all sparrows in the current population are obtained one by one, and the traversal weld path distances of the current iteration and the previous iteration are compared for each sparrow. If the traversal weld path distance of the current iteration is less than the traversal weld path distance of the previous iteration, the traversal weld sequence and path distance of the current iteration are retained; if the traversal weld path distance of the current iteration is greater than or equal to the traversal weld path distance of the previous iteration, the traversal weld sequence and path distance of the previous iteration are retained.

[0066] S346: Arrange the traversed weld sequence in ascending order according to the distances of traversing all welds.

[0067] S347: The current number of iterations is increased by 1, iter_current=iter_current+1. If the current number of iterations iter_current is less than or equal to the maximum number of iterations iter_max, go to S341 to continue iterating and optimizing.

[0068] S348: After the current number of iterations iter_current reaches the maximum number of iterations, if the number of re-searches iter_again is less than the maximum number of iterations iter_again_max, the number of re-searches is increased by 1, iter_again=iter_again+1, the current number of iterations is reset to 1, and go to S32 to continue searching for the best result; if the current number of re-searches iter_again is greater than or equal to the maximum number of iterations iter_again_max, go to S35.

[0069] S35: outputting the first-ranked weld traversal sequence as the optimal weld traversal sequence, and outputting the first weld traversal path distance as the optimal weld traversal distance.

[0070] The warning value ST is improved adaptively. In the early stage of the algorithm, a larger warning value ST is used, which is mainly for the sparrow population to search in a large range, grasp the global information faster, and obtain a better weld traversal sequence in the global range faster; in the later stage of the algorithm, a smaller warning value ST is used, mainly based on the current optimal weld traversal sequence, and a small range adjustment is performed; the value of the warning value ST is shown in the following formula:

[0071]

[0072] The discoverer ratio PD adopts adaptive improvement. In the early stage of iteration, a larger proportion of discoverer sparrows ensures that the solution space can be fully explored and a better weld traversal sequence can be found faster. In the middle and late stages of the algorithm, the proportion of discoverer sparrows decreases and the proportion of follower sparrows increases, which can better explore the optimal weld traversal sequence found so far. In the late stage of the algorithm, the sparrow population is prone to fall into the local optimum, and the weld traversal sequences of all sparrows are almost the same. The learning path and local exploration effect of the follower sparrows are reduced, and most sparrows are converted into discoverers again, increasing the possibility of jumping out of the local optimum. The value of the discoverer ratio PD is shown in the following formula:

[0073]

[0074] The improved sparrow search algorithm adopts a re-search mechanism. When the sparrow population falls into a local optimum, the weld traversal sequences of all sparrows tend to be consistent and the population cannot jump out of the local optimum state, the sparrow population is forcibly disrupted to increase the diversity of the sparrow population and make all sparrows re-search.

[0075] by Figure 2 The three-dimensional model diagram of the "barrel section workpiece to be inspected" example is an implementation example, which illustrates the method of obtaining the optimal path for traversing the weld seam according to the present invention:

[0076] (1) Obtain the three-dimensional position information of welds and obstacles.

[0077] There are 24 welds in the cylinder section to be inspected. The starting point and end point of each weld are defined as weld point 1 and weld point 2 respectively. There is an obstacle in the inspection environment, and its position information is shown in Table 1 and Table 2:

[0078] Table 1 Welding information

[0079]

[0080]

[0081] Table 2 Obstacle information

[0082]

[0083] (2) The artificial potential field method is used to traverse and obtain the accessible paths and path lengths between the 24 welds.

[0084] (3) The optimal sequence for traversing welds is solved based on the improved sparrow search algorithm.

[0085] like Figure 3 As shown in the figure, the optimal sequence of traversing welds is solved based on the improved sparrow search algorithm. The steps are as follows:

[0086] S31: Set the parameters of the improved sparrow search algorithm, set the sparrow population size pop = 300, the maximum number of iterations iter_max = 500, the current number of iterations iter_current = 1, the anti-predator ratio SD = 20%, the number of re-searches iter_again = 1, the maximum number of iterations iter_again_max = 5, and the warning value ST is:

[0087]

[0088] The value of the discoverer ratio PD is:

[0089]

[0090] S32: Sparrow population initialization, such as Figure 4 As shown, a traversal weld sequence Xi is randomly generated for each sparrow i, where n is the weld number to be visited, start is the starting weld point number of weld n, and end is the ending weld point number of weld n; a total of pop strips of traversal weld sequences are obtained for the entire sparrow population.

[0091] S33: combining the reachable path distance between welds and the traversed weld sequence, obtaining the traversed weld path distances of all sparrows one by one, and arranging the traversed weld sequence in ascending order according to the traversed weld distances.

[0092] S34: Iteratively search for the optimal solution for the sparrow population, the specific steps include:

[0093] S341: Calculate the discoverer ratio PD, and take the sparrows whose path distance ranks before pop*PD as discoverers, representing a better traversal weld sequence, and the remaining sparrows as followers.

[0094] S342: Update the discoverer sparrows one by one. If the random number R1 (R1∈[0,1]) is less than the warning value ST, the traversal sequence of the discoverer sparrow is changed in a large range to search for a better sequence, such as Figure 5As shown, it is divided into several subsequences and each subsequence has no less than 4 welds. Two welds x are randomly selected from each subsequence. a 、x b , swap the two selected welds x in each subsequence a 、x b The position of each subsequence is selected by the weld x a 、x b The traversal directions of each are randomly changed, x a 、x b The four traversal directions are randomly selected; if the random number R1 (R1∈[0,1]) is greater than or equal to the warning value ST, the traversal sequence of the sparrow is changed slightly to search for a better sequence, such as Figure 6 As shown, two welds x are randomly selected from the entire traversed weld sequence. a 、x b , randomly select and exchange two welds x in the entire sequence a 、x b Position or reverse order of two welds x a 、x b The sequence between the two strategies is slightly changed, and the selected weld x in the sequence a 、x b The traversal directions of each are randomly changed, x a 、x b The four traversal directions are randomly selected.

[0095] S343: Update the follower sparrows one by one. If the follower sparrow Xi ranks before pop(1+PD) / 2 in the entire sparrow population, that is, it ranks before 50% among the followers, then the follower sparrow Xi performs well. The follower sparrow Xi adopts a learning strategy to randomly learn paths from a better discoverer sparrow to perform local exploration of the current better sequence, such as Figure 7 As shown in the figure, a discoverer sparrow Xj is randomly selected as the learning object, and two welds xj are randomly selected from the entire traversed weld sequence. a 、x b , will follower Sparrow Xi weld sequence x a 、x b The sequence between the two welds is replaced by the sequence of the corresponding position of the finder sparrow Xj, and the weld x a 、x b The traversal directions of each are randomly changed, x a 、x bThe four traversal directions are randomly selected, and the traversal weld sequence of the follower sparrow Xi after learning is corrected outside the replacement sequence, and the repeated welds are randomly replaced with the missing welds of the random traversal direction; if the follower sparrow Xi ranks after pop(1+PD) / 2 in the entire sparrow population, that is, after 50% of the followers, the follower sparrow Xi performs poorly, the traversal weld sequence of the follower sparrow Xi is initialized, and the traversal weld sequence Xi is randomly generated.

[0096] S344: Randomly select pop*SD sparrows from the entire sparrow population as anti-predators, and update the sequence of anti-predators one by one. If the anti-predator Xi is the best sparrow, use Figure 7 The learning strategy shown is to randomly learn from other sparrows and make corrections; if the anti-predator Xi is not the optimal sparrow, then Figure 7 The learning strategy shown learns from the optimal sparrow and makes corrections.

[0097] S345: combining the reachable path distances between welds, obtaining the traversed weld path distances of all sparrows in the current population one by one, comparing the traversed weld path distances of the current iteration with those of the previous iteration for each sparrow, if the traversed weld path distance of the current iteration is less than the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the current iteration; if the traversed weld path distance of the current iteration is greater than or equal to the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the previous iteration;

[0098] S346: Arrange the traversed weld sequence in ascending order according to the distances of traversing all welds.

[0099] S347: The current number of iterations is increased by 1, iter_current=iter_current+1. If the current number of iterations iter_current is less than or equal to the maximum number of iterations iter_max, go to S341 to continue iterating and optimizing.

[0100] S35: If the number of re-search times iter_again is less than the maximum number of iterations iter_again_max, the number of re-searches is increased by 1, iter_again=iter_again+1, the current number of iterations is reset to 1, and go to S32 to continue searching for optimization; if the current number of re-searches iter_again is greater than or equal to the maximum number of iterations iter_again_max, the first-ranked traversal weld sequence is output as the optimal sequence for traversing the welds, and the first traversal weld path distance is output as the optimal distance for traversing the welds.

[0101] (4) The optimal path that traverses all welds is obtained by combining the three-dimensional information of the welds, the accessible paths between welds, and the optimal sequence of traversing the welds.

[0102] like Figure 8 As shown in the figure, the comparison chart of the number of iterations and the average path distance of the optimal path planning of 10 traversals of the weld seam for the inspected barrel section workpiece using the simulated annealing algorithm, the whale optimization algorithm, the gray wolf optimization algorithm, the standard sparrow search algorithm, and the improved sparrow search algorithm is shown. It can be seen that when the improved sparrow search algorithm is used, the path length is the shortest under the same number of iterations.

[0103] The following are device embodiments of the present invention, which can be used to perform method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.

[0104] In another embodiment of the present invention, a weld detection optimal path planning system based on an improved sparrow search algorithm is provided. The weld detection optimal path planning system based on the improved sparrow search algorithm can be used to implement the above-mentioned weld detection optimal path planning method based on the improved sparrow search algorithm. Specifically, the weld detection optimal path planning system based on the improved sparrow search algorithm includes a three-dimensional position information acquisition module, a traversal module, an optimal sequence acquisition module and an optimal path acquisition module.

[0105] Among them, the three-dimensional position information acquisition module is used to obtain the three-dimensional position information of the workpiece weld and obstacles.

[0106] The traversal module is used to traverse using the artificial potential field method to obtain the accessible paths and path distances between each weld.

[0107] The optimal sequence acquisition module is used to discretize the sparrow search algorithm and use adaptive parameters and re-search mechanism in the population iteration process to obtain the optimal sequence with the shortest path to traverse the weld.

[0108] The optimal path acquisition module is used to combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld detection.

[0109] In another embodiment of the present invention, a terminal device is provided, the terminal device includes a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGAs), or other processors. GateArray, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., which are the computing core and control core of the terminal, which are suitable for implementing one or more instructions, and are specifically suitable for loading and executing one or more instructions to implement corresponding method processes or corresponding functions; the processor described in the embodiment of the present invention can be used for the operation of the optimal path planning method for weld detection based on the improved sparrow search algorithm, including: S1: obtaining the three-dimensional position information of the workpiece weld and obstacles; S2: using the artificial potential field method to traverse and obtain the reachable path and path distance between each weld; S3: discretizing the sparrow search algorithm, and using adaptive parameters and re-search mechanism in the population iteration process to obtain the shortest optimal sequence of the reachable path of the traversal weld; S4: combining the three-dimensional position information of the weld, the reachable path between the welds and the optimal sequence of traversing the welds, to obtain a complete optimal path for weld detection.

[0110] In another embodiment, the present invention further provides a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory.

[0111] One or more instructions stored in a computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps of the optimal path planning method for weld detection based on an improved sparrow search algorithm in the above-mentioned embodiment; one or more instructions in the computer-readable storage medium are loaded by the processor and execute the following steps: S1: obtaining three-dimensional position information of workpiece welds and obstacles; S2: using an artificial potential field method to traverse and obtain the reachable paths and path distances between each weld; S3: discretizing the sparrow search algorithm, and using adaptive parameters and a re-search mechanism in a population iteration process to obtain the shortest optimal sequence of reachable paths for traversing welds; S4: combining the three-dimensional position information of welds, the reachable paths between welds, and the optimal sequence for traversing welds to obtain a complete optimal path for weld detection.

[0112] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0113] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0114] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0116] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0117] It should be understood that the above description is for illustration and not for limitation. Many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art upon reading the above description. Therefore, the scope of the present teachings should not be determined with reference to the above description, but rather with reference to the foregoing claims and the full scope of equivalents to which such claims are entitled. For the purpose of comprehensiveness, all articles and references, including disclosures of patent applications and publications, are incorporated herein by reference. The omission of any aspect of the subject matter disclosed herein in the foregoing claims is not intended to be a waiver of such subject matter, nor should it be considered that the applicant has not considered such subject matter to be part of the disclosed inventive subject matter.

Claims

1. A weld detection optimal path planning method based on an improved sparrow search algorithm, characterized in that: The process includes: S1: Obtain the three-dimensional position information of the workpiece weld and obstacles; S2: Use the artificial potential field method to traverse and obtain the accessible paths and path distances between each weld; S3: Discretize the sparrow search algorithm and use adaptive parameters and re-search mechanism in the population iteration process to obtain the optimal sequence with the shortest reachable path through the weld; S4: Combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld inspection.

2. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 1 is characterized in that: In S2, for a workpiece with n welds, there are several sequences X = [x1, x2, ..., x n ], the weld traversal sequence X describes the order of traversing n welds, where x i (i=1,2,…,n) represents the number of the weld traversed by the i-th time point, x i =[x ij ,x ik ](j∈[1,2],k=3-j),x ij ,x ik Indicates weld x i The traversal direction.

3. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 1 is characterized in that: The specific process of S3 is: S31: Set the parameters of the sparrow search algorithm, including the size of the sparrow population pop, the maximum number of iterations iter_max, the current number of iterations iter_current, the warning value ST, the proportion of discoverers PD, the proportion of anti-predators SD, the number of re-searches iter_again, and the maximum number of re-searches iter_again_max; S32: Initialize the sparrow population, and randomly generate a traversal weld sequence X for each sparrow i. i , get the pop bar traversal weld sequence; S33: combining the reachable path distance between welds and the traversed weld sequence, obtaining the traversed weld path distances of all sparrows one by one, and arranging the traversed weld sequence in ascending order according to the traversed weld distances; S34: iteratively searching for an optimal solution for the sparrow population according to the parameters set in S31; S35: outputting the first-ranked weld traversal sequence as the optimal weld traversal sequence, and outputting the first weld traversal path distance as the optimal weld traversal distance.

4. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 3 is characterized in that: The specific process of S34 is as follows: S341: The sparrow whose path distance ranks before pop*PD is regarded as the discoverer, representing a better traversal weld sequence, and the remaining sparrows are regarded as followers; S342: Update the finder sparrows one by one; S343: Update the follower sparrows one by one; S344: Randomly select pop*SD sparrows from the entire sparrow population as anti-predators, and update the paths of the anti-predators one by one. If the anti-predator X i If it is the best sparrow, it will use the learning strategy to randomly learn the paths from other sparrows and make corrections; If the anti-predator is not the optimal sparrow, a learning strategy is used to learn the path from the optimal sparrow and make corrections; S345: combining the reachable path distances between welds, obtaining the traversed weld path distances of all sparrows in the current population one by one, comparing the traversed weld path distances of the current iteration with those of the previous iteration for each sparrow, if the traversed weld path distance of the current iteration is less than the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the current iteration; if the traversed weld path distance of the current iteration is greater than or equal to the traversed weld path distance of the previous iteration, retaining the traversed weld sequence and path distance of the previous iteration; S346: Arrange the traversed weld sequence in ascending order according to the distance of traversing all weld paths; S347: add 1 to the current number of iterations, iter_current = iter_current + 1. If the current number of iterations iter_current is less than or equal to the maximum number of iterations iter_max, go to S341 to continue iterative optimization. S348: After the current number of iterations iter_current reaches the maximum number of iterations, if the number of re-searches iter_again is less than the maximum number of iterations iter_again_max, the number of re-searches is increased by 1, iter_again=iter_again+1, the current number of iterations is reset to 1, and go to S32 to continue searching for the best result; if the current number of re-searches iter_again is greater than or equal to the maximum number of iterations iter_again_max, go to S35.

5. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 4 is characterized in that: The specific process of S342 is as follows: if the random number R1 (R1∈[0,1]) is less than the warning value ST, the weld sequence traversed by the discoverer sparrow is changed in a large range, and it is divided into several subsequences, and each subsequence has no less than 4 welds. Two welds x are randomly selected from each subsequence. a 、x b , swap the two selected welds x in each subsequence a 、x b The position of each subsequence is selected by the weld x a 、x b The traversal directions of each are randomly changed; if the random number R1 (R1∈[0,1]) is greater than or equal to the warning value ST, the traversal weld sequence of the discoverer sparrow is changed in a small range, and two welds x are randomly selected from the entire traversal weld sequence. a 、x b , randomly select and exchange two welds x in the entire sequence a 、x b Position or reverse order of two welds x a 、x b The sequence between the two strategies is slightly changed, and the selected weld x in the sequence a 、x b The respective traversal directions change randomly.

6. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 4 is characterized in that: The specific process of S343 is: If the follower Sparrow X i If the ranking of the entire sparrow population is before pop(1+PD) / 2, that is, the ranking among followers is before 50%, then the follower sparrow X i Better performance, follower Sparrow X i Use the learning strategy to randomly learn the path from the better discoverer sparrow, and randomly select a discoverer sparrow X j As learning objects, two welds x are randomly selected from the entire traversed weld sequence. a 、x b , will follow the sparrow X i Weld Sequence x a 、x b The sequence between the two welds is replaced by the Finder Sparrow X j The sequence of corresponding positions, while the weld x a 、x b The respective traversal directions are randomly changed, and the follower sparrow X is replaced outside the sequence i The learned traversal weld sequence is corrected by randomly replacing the repeated welds with the missing welds in the random traversal direction; if the follower sparrow X i If the ranking of the entire sparrow population is after pop(1+PD) / 2, that is, after 50% of the followers, then the follower sparrow X i Poor performance, Sparrow X to followers i Initialize the traversal weld sequence and randomly generate the traversal weld sequence X i .

7. The optimal path planning method for weld detection based on the improved sparrow search algorithm according to claim 4 is characterized in that: The sparrow search algorithm adopts a re-search mechanism. When the sparrow population falls into a local optimum, the weld traversal sequences of all sparrows tend to be consistent and the population cannot jump out of the local optimal state, the sparrow population is disrupted to increase the diversity of the sparrow population and make all sparrows search again.

8. An optimal path planning system for weld inspection based on an improved sparrow search algorithm, characterized in that: include: Three-dimensional position information acquisition module: used to obtain the three-dimensional position information of the workpiece weld and obstacles; Traversal module: used to traverse using the artificial potential field method to obtain the accessible paths and path distances between each weld; Optimal sequence acquisition module: used to discretize the sparrow search algorithm and use adaptive parameters and re-search mechanism in the population iteration process to obtain the optimal sequence with the shortest path to traverse the weld; Optimal path acquisition module: used to combine the three-dimensional position information of the weld, the reachable path between the welds, and the optimal sequence of traversing the welds to obtain the complete optimal path for weld detection.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the optimal path planning method for weld detection based on the improved sparrow search algorithm as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the optimal path planning method for weld detection based on the improved sparrow search algorithm as described in any one of claims 1 to 7 are implemented.