Robot Inspection Path Optimization and Rapid Changeover Method Based on Digital Twin

By optimizing the battery tray detection path through digital twin technology and improved ant colony algorithm, the problem of frequent production changes caused by manual teaching was solved, realizing an efficient and safe detection process and rapid production changeover, thereby improving production efficiency.

CN120862671BActive Publication Date: 2026-05-26GUANGDONG UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG UNIV OF TECH
Filing Date
2025-07-28
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, the detection of battery trays relies on manual teaching, which leads to frequent production changes, long processing times, and a lack of systematic and optimization methods in path planning, thus affecting production efficiency.

Method used

A robot detection path optimization method based on digital twins is adopted. By constructing a digital twin model of the detection equipment, the teaching point sequence is generated using the inverse kinematics algorithm, and the detection path is optimized by combining the improved ant colony algorithm with genetic mutation operation and backtracking reset mechanism.

Benefits of technology

It significantly shortens the production changeover cycle, improves testing efficiency and equipment utilization, enhances the flexibility and intelligence of the production process, and ensures the smoothness and safety of the testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120862671B_ABST
    Figure CN120862671B_ABST
Patent Text Reader

Abstract

This invention relates to the field of path optimization technology, and proposes a method for optimizing robot inspection paths and rapid production changeover based on digital twins. The method includes: constructing a digital twin model of the physical inspection equipment; configuring the joint hierarchy and motion constraints of the visual inspection robot based on the robot's DH parameters; controlling the end effector of the visual inspection robot to move to the inspection point on the battery tray based on an inverse kinematics algorithm, generating a teaching point sequence and an initial inspection path; inputting the teaching point sequence into an improved ant colony algorithm, optimizing the initial inspection path by incorporating genetic mutation operations and a backtracking reset mechanism, obtaining the optimized path; driving the inspection equipment to execute the complete inspection process based on the optimized path, and verifying the feasibility of the flipping timing of the flipping positioner, the movement of the positioning fixture, and the coordination of the visual inspection robot's trajectory; and converting the optimized path into control commands and sending them to the inspection equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of path optimization technology, and in particular to a method for optimizing robot detection paths and rapid production changeover based on digital twins. Background Technology

[0002] With the booming development of the new energy vehicle industry, the testing efficiency and production changeover speed of battery trays have become key factors affecting production efficiency.

[0003] In existing technologies, battery tray inspection primarily relies on robotic inspection workstations, which employ manual teaching for inspection path planning. In small-batch, multi-variety production models, frequent product changeovers necessitate continuous re-teaching of inspection points. Each changeover requires operators to manually adjust the robot's inspection path and recalibrate the teaching points, a process that is not only time-consuming but also demands a high level of operator skill. Furthermore, manual path planning lacks systematic approaches and optimization methods, resulting in inefficient inspection paths, long robot travel distances, significant time consumption, and the inability to monitor the robot's operating status in real time, severely hindering overall production efficiency. Summary of the Invention

[0004] To address the aforementioned shortcomings, the present invention aims to propose a robot detection path optimization and rapid production changeover method based on digital twins. It aims to improve the ant colony algorithm through genetic mutation operations and backtracking reset mechanisms, thereby achieving simultaneous improvement in global detection path optimization and production changeover efficiency.

[0005] To achieve this objective, the present invention adopts the following technical solution:

[0006] A method for optimizing robot inspection paths and rapid changeover based on digital twins is proposed. The method is applied to inspection equipment, which includes a flipping and positioning machine, a positioning fixture, and a vision inspection robot. The flipping and positioning machine includes a flipping bracket, a flipping driver, and a bottom slide rail. The flipping driver is located at both ends of the bottom slide rail.

[0007] In use, the distance between the flipping drivers is adjusted by the slide rail to fit the size of the battery tray. The positioning fixture clamps and fixes the battery tray on the flipping bracket. The flipping driver adjusts the flipping bracket to a specified angle according to the preset setting. The vision inspection robot scans and inspects the battery tray according to the teaching point position.

[0008] The robot inspection path optimization and rapid changeover method includes:

[0009] Construct a digital twin model of the physical inspection equipment, and configure the joint hierarchy and motion constraints of the visual inspection robot based on the robot's DH parameters;

[0010] Based on the inverse kinematics algorithm, the end effector of the vision inspection robot is controlled to move to the point to be inspected on the battery tray, generating a teaching point sequence and an initial detection path;

[0011] The teaching point sequence is input into the improved ant colony algorithm. The initial detection path is optimized by incorporating genetic mutation operation and backtracking reset mechanism to obtain the optimized path. The genetic mutation operation includes introducing genetic mutation operation in each iteration to randomly perturb the current optimal path to escape local optima. The backtracking reset mechanism includes triggering a backtracking reset operation when the optimal solution has not been updated for a continuous period of time to reinitialize the pheromone matrix.

[0012] The detection device is driven by the optimized path to perform the complete detection process, and the feasibility of the coordination between the flipping timing of the flipping positioner, the action of the positioning fixture and the trajectory of the vision detection robot is verified.

[0013] The optimized path is converted into control commands and sent to the detection device.

[0014] Preferably, inputting the teaching point sequence into the improved ant colony algorithm includes the following steps:

[0015] S11: Initialize ant colony algorithm parameters;

[0016] S12: Place the ants and determine the candidate point set for the current teaching point of each ant;

[0017] S13: Use the transition probabilities to determine the next teaching point to be visited for each ant. The transition probabilities satisfy the following relationship:

[0018]

[0019] Where allowed represents the set of candidate points for the next teaching point of ant k. The pheromone concentration between teaching point i and teaching point j at time t is α, where α is the pheromone importance coefficient. β is the reciprocal of the distance between teaching point i and teaching point j, β is the importance coefficient of the distance between teaching points, and s represents the set of unvisited teaching points;

[0020] S14: Determine whether all teaching points have been traversed: If the traversal is not complete, return to step S12 to update the current candidate teaching point set and continue traversing;

[0021] If the traversal has been completed, select the current optimal path from the ant traversal paths.

[0022] Preferably, the incorporation of genetic variation includes:

[0023] Set the target number of swaps for the genetic mutation operation and generate random swap position indices;

[0024] Based on the swap position index, perform pairwise swap operations on the node order of the current optimal path;

[0025] Calculate the length of the new path after the swap operation;

[0026] Determine whether the length of the new path is less than the length of the path before the mutation: if it is less, then the new path is adopted as the current optimal path; if it is not less, then the original path is retained.

[0027] Preferably, the inclusion of a backtracking reset mechanism includes:

[0028] For the optimal solution of the ant colony algorithm, monitor the update status of the optimal path during the iteration process;

[0029] If the number of consecutive times the optimal path has not been updated reaches a threshold T max Once the pheromone dispersion point is determined, a backtracking reset operation is performed:

[0030] Reset the pheromone matrix;

[0031] The pheromone is updated using a divergence-point adaptive update rule, satisfying the following relation:

[0032]

[0033] Where T0 is the iteration number of the pheromone dispersion point, a and b represent the increase and evaporation of pheromones after the dispersion point, and t is the current iteration number. ρ is the pheromone residue coefficient;

[0034] If the optimal value changes or the number of consecutive times the optimal path has not been updated does not reach the threshold T. max Update pheromones according to the following formula:

[0035]

[0036] Where, Δτ ij (t) represents the information increment. Let Q be the pheromone left by the ant on the path (i,j) at time t, Q be the total amount of pheromone released by the ant when traversing all teaching points, and D be the total length of the path taken by the ant when traversing all teaching points.

[0037] Preferably, before inputting the teaching point sequence into the improved ant colony algorithm, the following steps are included:

[0038] Establish a mathematical model for the shortest path using Euclidean distance, satisfying the following relationship:

[0039]

[0040] in For Euclidean distances, satisfy the following relation:

[0041]

[0042] Preferably, the detection device is driven to execute the complete detection process based on the optimized path, and the feasibility of coordinating the flipping timing of the flipping positioner, the movement of the positioning fixture, and the trajectory of the vision inspection robot is verified, including:

[0043] In the digital twin model, the control positioning fixture performs the battery tray clamping action;

[0044] Determine whether the current inspection stage requires driving the flip stand: If so, control the vision inspection robot to move to a safe avoidance position, drive the flip stand to perform a flip operation to the specified angle, and return to the scanning and inspection stage;

[0045] If the flipping bracket is not required, control the vision inspection robot to perform scanning and inspection according to the optimized path;

[0046] Determine if all teaching points have been traversed: If not, return to the step of determining whether the current detection phase requires driving the flip bracket.

[0047] If the traversal is complete, control the positioning fixture to release the battery tray.

[0048] Preferably, after converting the optimized path into control commands and sending them to the detection device, the process includes:

[0049] The detection equipment receives and parses control commands, and simultaneously feeds back the real-time status to the digital twin model. The communication protocol uses structured data to encapsulate commands and status.

[0050] One of the above technical solutions has the following advantages or beneficial effects:

[0051] This invention constructs a digital twin model of the inspection equipment and configures the joint hierarchy and motion constraints of the visual inspection robot based on the robot's DH parameters. This accurately maps the characteristics of the physical equipment, laying the foundation for subsequent path optimization and rapid production changeover. Next, an inverse kinematics algorithm is used to control the end effector of the visual inspection robot to move to the inspection point on the battery tray, generating a teaching point sequence and an initial inspection path. This process achieves efficient teaching in a virtual environment, avoiding the tediousness and time consumption of traditional manual teaching. Subsequently, the teaching point sequence is input into an improved ant colony algorithm. By incorporating genetic mutation operations and a backtracking reset mechanism, the initial inspection path is optimized, effectively solving the problem of traditional ant colony algorithms easily getting trapped in local optima, thus improving the efficiency and quality of path optimization. Based on the optimized path, the inspection equipment is driven to execute the complete inspection process, and the feasibility of the coordinated movement of the flipping positioner, positioning fixture, and visual inspection robot trajectory is verified, ensuring the smoothness and safety of the inspection process. Finally, the optimized path is converted into control commands and sent to the inspection equipment, achieving precise control of the physical equipment from the virtual environment. In summary, this invention significantly shortens the production changeover cycle and reduces changeover costs through digital means and intelligent algorithm optimization, while improving testing efficiency and equipment utilization, and enhancing the flexibility and intelligence of the production process. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0053] Figure 1 This is a flowchart of a robot detection path optimization and rapid production changeover method based on digital twins provided in an embodiment of the present invention;

[0054] Figure 2 This is a first structural schematic diagram of the detection equipment corresponding to the robot detection path optimization and rapid production changeover method based on digital twin provided in this embodiment of the invention;

[0055] Figure 3 This is a schematic diagram of the second structure of the detection equipment corresponding to the robot detection path optimization and rapid changeover method based on digital twin provided in the embodiments of the present invention;

[0056] Figure 4 This is a DH parameter diagram of the vision inspection robot corresponding to the robot detection path optimization and rapid changeover method based on digital twin provided in this embodiment of the invention.

[0057] Figure 5This is a schematic diagram of robot joint settings corresponding to the robot detection path optimization and rapid changeover method based on digital twin provided in the embodiments of the present invention;

[0058] Figure 6 This is a schematic diagram of a battery tray for a robot detection path optimization and rapid production changeover method based on digital twins provided in an embodiment of the present invention.

[0059] Figure 7 This is a schematic diagram of the positioning fixture structure for the robot detection path optimization and rapid changeover method based on digital twin provided in an embodiment of the present invention;

[0060] Figure 8 This is a comparison diagram of the effects of the robot detection path optimization and rapid changeover method based on digital twin provided in this embodiment of the invention with other algorithms in the first tooling;

[0061] Figure 9 This is a comparison diagram of the robot detection path optimization and rapid changeover method based on digital twin provided in this embodiment of the invention with other algorithms in the second tooling;

[0062] Figure 10 This is a comparison chart of the effects of the robot detection path optimization and rapid changeover method based on digital twin provided in this embodiment of the invention with other algorithms in the third tooling;

[0063] Among them, there are 1 flipping and positioning machine, 11 flipping bracket, 12 flipping driver, 13 bottom slide rail, 2 positioning fixture, 21 cylinder rod, 22 connecting rod, 23 upper clamping part, 24 lower clamping part, 3 vision inspection robot, 4 battery tray, and 5 safety guardrail. Detailed Implementation

[0064] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0065] In this invention, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0066] A method for optimizing robot inspection paths and enabling rapid changeover based on digital twins, wherein the method is applied to inspection equipment, such as... Figure 2-3 As shown, in a preferred embodiment of the present invention, the detection device includes a flipping and positioning machine 1, a positioning fixture 2, and a vision inspection robot 3. The flipping and positioning machine 1 includes a flipping bracket 11, a flipping driver 12, and a bottom slide rail 13. The flipping driver 12 is disposed at both ends of the bottom slide rail 13.

[0067] In use, the distance between the flipping actuators 12 is adjusted via the bottom slide rail 13 to accommodate the size of the battery tray 4. The positioning clamp 2 holds and fixes the battery tray 4 onto the flipping bracket. In this embodiment, as shown... Figure 7 As shown, the positioning fixture 2 includes a cylinder rod 21, a connecting rod 22, an upper clamping member 23, and a lower clamping member 24. Specifically, when the positioning fixture performs a clamping operation, the cylinder rod 21 receives a clamping signal and begins to move downwards (or performs a corresponding retraction action according to the actual cylinder type). One end of the connecting rod 22 is connected to the cylinder rod 21, and the other end is connected to the upper clamping member 23. The downward movement of the cylinder rod 21 causes the connecting rod 22 to move downwards, causing the upper clamping member 23 to move downwards and gradually approach the lower clamping member 24. When the lower clamping member 24 remains fixed, the distance between the upper clamping member 23 and the lower clamping member 24 gradually decreases, ultimately firmly clamping the battery tray between them, ensuring its stability during the testing process. During the release operation, after receiving the release signal, the cylinder rod 21 begins to move upward (or performs a corresponding extension action), and the connecting rod 22 moves upward accordingly, causing the upper clamping member 23 to lift upward and separate from the lower clamping member 24, thereby releasing the battery tray and completing the release action. This design converts the linear motion of the cylinder rod 21 into the up-and-down movement of the upper clamping member 23 via the connecting rod 22, realizing the clamping and releasing functions. It has a simple structure and reliable operation, effectively fixing and releasing the battery tray (e.g., ...). Figure 6 (As shown), in conjunction with the flipping and positioning machine and the vision inspection robot, the inspection task is completed. Subsequently, the flipping driver 12 adjusts the flipping bracket 11 to a specified angle according to the preset settings, and the vision inspection robot 3 scans and inspects the battery tray 4 according to the teaching point position;

[0068] like Figure 1 As shown, the robot detection path optimization and rapid changeover method includes:

[0069] S1: Construct a digital twin model of the physical inspection equipment, and configure the joint hierarchy and motion constraints of the visual inspection robot based on the robot's DH parameters;

[0070] It's important to note that a digital twin model refers to a precise model built in virtual space that corresponds to a physical inspection device. It can reflect the state and behavior of the physical device in real time. Robot DH parameters are a set of parameters used to describe the geometric relationships between robot links and joints, including link lengths, link torsion angles, and joint offsets. These parameters are crucial for accurately constructing the robot's digital twin model. In this step, the joint hierarchy and motion constraints of the vision inspection robot are configured using DH parameters to ensure that the virtual model can accurately simulate the motion characteristics of a real robot.

[0071] Understandably, the purpose of building a digital twin model is to provide a precise virtual environment for subsequent virtual teaching and path optimization. Through digital twin technology, testing equipment can be operated and tested in virtual space, avoiding frequent adjustments to the physical equipment and thus improving changeover efficiency. The configuration of DH parameters ensures consistency between the virtual model and the physical equipment, enabling the teaching and optimization results performed in the virtual environment to be accurately applied to the physical equipment.

[0072] For example, taking the IRB7600-340-280 vision inspection robot as an example, its DH parameters are as follows: Figure 4 As shown. Based on these parameters, the hierarchical relationships between joints of the robot are set in the digital twin model (e.g., ...). Figure 5 As shown in the diagram, this ensures that the movement of each joint accurately reflects the motion characteristics of the real robot. In this way, during subsequent virtual teaching, operators can generate a sequence of teaching points and an initial detection path by dragging the robot's end effector to each battery tray testing point, without needing to frequently operate the physical device.

[0073] S2: Based on the inverse kinematics algorithm, control the end effector of the vision inspection robot to move to the point to be inspected on the battery tray, and generate a teaching point sequence and an initial detection path;

[0074] It should be noted that inverse kinematics is an algorithm used to calculate the joint pose of a robot. It takes the robot's end-effector pose matrix as input and solves for the pose of each joint. In this step, the inverse kinematics algorithm is used to control the end-effector of the vision inspection robot to move to the point to be inspected on the battery tray, generating a teaching point sequence and an initial detection path.

[0075] Understandably, the application of inverse kinematics algorithms allows operators to intuitively teach robots in a virtual environment. By dragging the robot's end effector to the point to be tested, the system automatically calculates the corresponding joint pose, thereby generating a sequence of teaching points and an initial detection path. This process avoids the tediousness and time consumption of traditional manual teaching, while improving the accuracy and efficiency of teaching. Possible implementation methods include: using analytical inverse kinematics algorithms for fast solutions; or using numerical inverse kinematics algorithms to adapt to more complex robot structures. Different implementation methods can be selected based on the complexity of the robot model and computational resources to achieve efficient and accurate teaching results.

[0076] For example, in a battery tray detection scenario built in a digital twin model, the operator drags the robot's end effector to various detection points on the battery tray via an interface. The system calculates and records the robot's joint poses based on inverse kinematics algorithms, generating a sequence of teaching points. For instance, for the front and back detection points of the battery tray, the operator drags the robot's end effector to these points respectively, and the system automatically generates the corresponding sequence of teaching points, providing basic data for subsequent path optimization.

[0077] S3: Input the teaching point sequence into the improved ant colony algorithm, optimize the initial detection path by incorporating genetic mutation operation and backtracking reset mechanism, and obtain the optimized path. The genetic mutation operation includes introducing genetic mutation operation in each iteration to randomly perturb the current optimal path to escape the local optimum; the backtracking reset mechanism includes triggering the backtracking reset operation when the optimal solution has not been updated for a continuous period of time, and re-initializing the pheromone matrix.

[0078] It should be noted that the improved ant colony algorithm is a path optimization algorithm that simulates the foraging behavior of ants, incorporating genetic mutation operations and a backtracking reset mechanism to avoid getting trapped in local optima. The genetic mutation operation increases the diversity of solutions by randomly perturbing the current optimal path, while the backtracking reset mechanism reinitializes the pheromone matrix when the optimal solution has not been updated for a consecutive period, preventing the algorithm from converging prematurely.

[0079] Understandably, optimizing the initial detection path by improving the ant colony algorithm can yield shorter and more efficient detection paths. The introduction of genetic mutation operations and backtracking reset mechanisms effectively solves the problem of traditional ant colony algorithms easily getting trapped in local optima, improving the efficiency and quality of path optimization.

[0080] Specifically, the sequence of teaching points generated in step S2 is used as input to the improved ant colony algorithm. After initializing the parameters, the algorithm begins the iterative optimization process. In each iteration, the ants select the next teaching point based on the transition probability and construct a path. Genetic mutation operations randomly perturb the current optimal path in each iteration, increasing the diversity of solutions. A backtracking reset mechanism monitors the update status of the optimal path; if the number of consecutive updates reaches a threshold, the pheromone matrix is ​​reinitialized. Possible implementation methods include: adjusting the probability and perturbation magnitude of genetic mutation to adapt to different path optimization problems; or setting different backtracking reset thresholds to balance the convergence speed and optimization quality of the algorithm. Different implementation methods can be adjusted according to the characteristics of the specific problem to achieve the best optimization effect.

[0081] S4: Based on the optimized path, drive the detection device to execute the complete detection process, and verify the feasibility of the coordination between the flipping timing of the flipping positioner, the action of the positioning fixture and the trajectory of the vision detection robot.

[0082] It should be noted that verifying the feasibility of coordinating the flipping timing of the flipping positioner, the movement of the positioning fixture, and the trajectory of the vision inspection robot means simulating the complete inspection process of the inspection equipment in a digital twin model to ensure that the movements of each device are coordinated and consistent, and to avoid collisions and interference.

[0083] Understandably, by verifying the collaborative feasibility of the testing process in a digital twin model, potential equipment collaboration issues can be identified and resolved in advance, ensuring the smooth operation of physical equipment during actual testing and improving production efficiency and safety.

[0084] For example, the inspection process of a battery tray is simulated in a digital twin model. The positioning fixture first clamps the battery tray, and then, according to the requirements of the inspection path, a flipping positioner drives a tilting bracket to a specified angle. The vision inspection robot then scans and inspects the tray along the optimized path. For instance, when inspecting the back of the battery tray, the flipping positioner rotates 180°, the robot moves to a safe avoidance position, and waits for the rotation to complete before continuing the inspection task. This simulation verification ensures the coordination and safety of the physical equipment in actual operation.

[0085] S5: Convert the optimized path into control commands and send them to the detection device.

[0086] It should be noted that converting the optimized path into control commands and sending them to the detection device means converting the optimized detection path obtained in the digital twin model into control commands that the physical device can recognize and execute.

[0087] For example, the digital twin model converts the optimized detection path into control commands in JSON format and sends them to the entity detection device via the Socket communication protocol. Upon receiving the commands, the device controls the vision inspection robot to perform scanning and detection according to the optimized path and provides real-time feedback on the execution status to the digital twin model. For instance, when the robot completes the scanning of a detection point, it immediately reports the current status, and the digital twin model updates the virtual model based on the feedback information, ensuring consistency between the virtual and the physical entity.

[0088] In this invention, by comparing the experimental data of this invention (GA_Back-ACO) with those of the Greedy algorithm, the Q-Learning algorithm using the UCB strategy (UCB-Q) in Q-learning algorithms, the genetic algorithm that mixes a greedy initial population with adaptive dynamic crossover and mutation probabilities (Greedy Adaptive-GA) in genetic algorithms, the ant colony algorithm that integrates initial greedy pheromones, adaptive genetic mutation operations, and transition probability perturbation factors (Greed_GA_R-ACO) in ant colony algorithms, and the ant colony algorithm that integrates adaptive genetic mutation operations and adds backtracking reset operations (GA_Back-ACO), the superiority of this algorithm can be clearly seen. Figures 8 to 10 As shown, in tests conducted on fixtures 1, 2, and 3, the algorithm proposed in this invention exhibits significant advantages in path length optimization: compared to greedy algorithms, this invention effectively avoids local optima, finding shorter detection paths and thus improving detection efficiency; compared to the UCB-Q algorithm, this invention demonstrates greater stability during path exploration and can quickly converge to a better solution; in comparison with the Greedy Adaptive-GA algorithm, this invention further improves the accuracy and efficiency of path optimization by incorporating genetic mutation and backtracking reset mechanisms; compared to the Greed_GA_R-ACO algorithm, this invention significantly enhances data stability while maintaining path optimization capabilities, resulting in smaller variance and a narrower fluctuation range; and compared to the GA_Back-ACO algorithm, this invention demonstrates superior performance in both path length and stability. In summary, the algorithm proposed in this invention not only outperforms other algorithms in path length but also exhibits good robustness in data stability, providing a more reliable and efficient solution for robot detection path optimization.

[0089] Preferably, inputting the teaching point sequence into the improved ant colony algorithm includes the following steps:

[0090] S11: Initialize ant colony algorithm parameters;

[0091] It should be noted that the ant colony optimization (ACO) parameters include the number of ants, the pheromone importance coefficient α, the importance coefficient of the distance between teaching points β, and the pheromone evaporation coefficient. The initial settings of these parameters directly affect the algorithm's convergence speed and optimization performance. In this step, by setting these parameters appropriately, we lay the foundation for the subsequent path optimization process.

[0092] Understandably, the purpose of initializing the ant colony algorithm parameters is to ensure that the algorithm can effectively explore the solution space and find the optimal path in subsequent iterations. By setting the parameters appropriately, the algorithm's exploration ability and convergence speed can be balanced, thereby improving optimization efficiency.

[0093] Specifically, the parameters of the ant colony algorithm are set according to the complexity of the detection task and the number of teaching points. For example, for complex detection tasks, the number of ants can be increased to improve the diversity of solutions; the values ​​of α and β can be adjusted to balance the weights of pheromone and distance in path selection. Possible implementation methods include: determining the initial values ​​of the parameters through experiments and experience; or adopting an adaptive parameter adjustment strategy to dynamically adjust the parameters according to the algorithm's running status.

[0094] S12: Place the ants and determine the candidate point set for the current teaching point of each ant;

[0095] It should be noted that placing ants refers to randomly placing a certain number of ants at different teaching points at the initial moment. The candidate point set for each ant's current teaching point refers to the set of next teaching points that the ant can choose from at its current position according to the transition probability formula. In this step, by initializing the ant's position and determining the candidate point set, a starting point is provided for subsequent path construction.

[0096] Understandably, placing ants appropriately and determining the set of candidate points can ensure that the algorithm can cover as much of the solution space as possible in the initial stage, thereby improving the comprehensiveness and effectiveness of path optimization.

[0097] Specifically, in the digital twin model, ants are randomly placed on different teaching points according to the teaching point sequence. For each ant, a set of candidate points is determined based on its current location and the teaching points it has visited. Possible implementation methods include: randomly initializing the ant's position; or initializing the ant's position according to a certain heuristic rule (such as nearest neighbor priority).

[0098] S13: Use the transition probabilities to determine the next teaching point to be visited for each ant. The transition probabilities satisfy the following relationship:

[0099]

[0100] Where allowed represents the set of candidate points for the next teaching point of ant k. The pheromone concentration between teaching point i and teaching point j at time t is α, where α is the pheromone importance coefficient. β is the reciprocal of the distance between teaching point i and teaching point j, β is the importance coefficient of the distance between teaching points, and s represents the set of unvisited teaching points;

[0101] It's important to note that the transition probability refers to the probability that an ant will choose the next teaching point from the current teaching point. It is determined by a combination of pheromone concentration and the reciprocal of the distance. The pheromone concentration reflects the amount of information accumulated along the path, while the reciprocal of the distance reflects the path's length. In this step, by calculating the transition probability, the ant selects the next teaching point and constructs a path.

[0102] Understandably, the calculation of transition probabilities allows ants to consider both the path length (reciprocal of distance) and historical path information (pheromone concentration) when choosing the next teaching point. This combined strategy guides ants to tend towards choosing shorter paths, while gradually converging to the optimal path through the accumulation and volatilization mechanism of pheromones.

[0103] Specifically, for each ant, based on its current location and the candidate point set, the probability of moving to each unvisited teaching point is calculated. The next teaching point is selected based on the highest probability, and a path is constructed. For example, in the battery tray detection path optimization, the ant is currently at teaching point A, and the candidate point set includes teaching points B, C, and D. The probabilities of the ant moving to B, C, or D are calculated using the transition probability formula, and the teaching point with the highest probability is selected as the next visiting point. For instance, if the calculated probability of moving to B is 0.6, to C is 0.3, and to D is 0.1, the ant chooses to move to B.

[0104] S14: Determine whether all teaching points have been traversed: If the traversal is not complete, return to step S12 to update the current candidate teaching point set and continue traversing;

[0105] If the traversal has been completed, select the current optimal path from the ant traversal paths.

[0106] Determining whether all teaching points have been traversed involves checking if the ants have visited all points to be tested. If not, the current candidate teaching point set is updated and the traversal continues; if completed, the current optimal path is selected from the ant's traversal path. In this step, a complete testing path is gradually constructed through iterative traversal and path selection, and the optimal path is updated after each traversal.

[0107] Understandably, through repeated traversal and path updates, the algorithm can gradually optimize the path and eventually find the optimal solution. After each traversal, updating the optimal path ensures continuous improvement and enhances the optimization effect. For example, in the battery tray detection path optimization, after each ant completes a path traversal, its path length is recorded. For instance, ant 1's path length is 100 units, ant 2's path length is 95 units, and ant 3's path length is 110 units. The current optimal path is ant 2's path, with a length of 95 units. In the next iteration, the path continues to be updated and optimized.

[0108] Preferably, the incorporation of genetic variation includes:

[0109] Set the target number of swaps for the genetic mutation operation and generate random swap position indices;

[0110] The target number of swaps in the genetic mutation operation refers to the number of node swaps performed on the current optimal path, and the swap position index refers to the randomly generated node positions to be swapped. In this step, by setting the target number of swaps and generating the swap position index, specific operational guidance is provided for subsequent path perturbations.

[0111] The purpose of genetic mutation is to increase the diversity of solutions through random perturbation, thus preventing the algorithm from converging to a local optimum prematurely. By setting a reasonable number of swaps and randomly generating swap positions, more solution space can be explored while maintaining path feasibility.

[0112] For example, in battery tray detection path optimization, the current optimal path contains 10 teaching points. The target number of swaps is set to 2, and the swap position indices are randomly generated as 3 and 7. This means that swap operations will be performed on the 3rd and 7th nodes in the path.

[0113] Based on the swap position index, perform pairwise swap operations on the node order of the current optimal path;

[0114] Pairwise swapping refers to exchanging the positions of two nodes in a path. This can generate new path solutions while maintaining path feasibility, increasing solution diversity. The operation is simple and effective, introducing new solutions without disrupting the path structure. In this step, the nodes of the current optimal path are swapped according to the swap position index to generate a new path. Specifically, the positions of corresponding nodes in the path are swapped based on the generated swap position index. For example, in the battery tray detection path optimization, the current optimal path is P1-P2-P3-P4-P5-P6-P7-P8-P9-P10. Based on swap position indices 3 and 7, the positions of P3 and P7 are swapped, generating the new path P1-P2-P7-P4-P5-P6-P3-P8-P9-P10.

[0115] Calculate the length of the new path after the swap operation;

[0116] Determine whether the length of the new path is less than the length of the path before the mutation: if it is less, then the new path is adopted as the current optimal path; if it is not less, then the original path is retained.

[0117] Preferably, the inclusion of a backtracking reset mechanism includes:

[0118] For the optimal solution of the ant colony algorithm, monitor the update status of the optimal path during the iteration process;

[0119] Monitoring the optimal path update status during iteration refers to recording whether the optimal path has changed during the ant colony algorithm's execution. In this step, a counter is set to record the number of consecutive times the optimal path has not been updated, providing a trigger condition for subsequent backtracking and resetting operations. By monitoring the update status of the optimal path, it is possible to promptly detect whether the algorithm has gotten stuck in a local optimum, providing a basis for backtracking and resetting operations and ensuring that the algorithm can continuously optimize.

[0120] After each iteration, compare the current optimal path with the previous optimal path. If they are the same, increment the unupdated counter; otherwise, reset the counter. Possible implementation methods include: setting a counter threshold, such as triggering a backtracking reset operation after 10 consecutive unupdated iterations; or dynamically adjusting the threshold based on iteration progress and path length changes.

[0121] If the number of consecutive times the optimal path has not been updated reaches a threshold T max Once the pheromone dispersion point is determined, a backtracking reset operation is performed:

[0122] Reset the pheromone matrix;

[0123] By resetting the pheromone matrix, the accumulation of pheromones in local optimal paths can be eliminated, forcing ants to re-explore new paths and increasing the diversity of solutions.

[0124] The pheromone is updated using a divergence-point adaptive update rule, satisfying the following relation:

[0125]

[0126] Where T0 is the iteration number of the pheromone dispersion point, a and b represent the increase and evaporation of pheromones after the dispersion point, and t is the current iteration number. ρ is the pheromone residue coefficient;

[0127] The divergence point adaptive update rule refers to adjusting the increase and evaporation of pheromones based on the number of iterations after the pheromone divergence point. In this step, the pheromone evaporation coefficient and increment are adjusted to adapt to the algorithm's running state, ensuring reasonable pheromone updates. Through the divergence point adaptive update rule, the pheromone update strategy can be adjusted at different stages of the algorithm's operation, improving the algorithm's convergence speed and optimization effect. Specifically, the pheromone evaporation coefficient and increment are dynamically adjusted based on the number of iterations and path length. For example, in the early stages of the algorithm, the pheromone increment is increased to improve exploration ability; in the later stages of the algorithm, the pheromone evaporation coefficient is increased to accelerate convergence.

[0128] If the optimal value changes or the number of consecutive times the optimal path has not been updated does not reach the threshold T. max Update pheromones according to the following formula:

[0129]

[0130] Where, Δτ ij (t) represents the information increment. Let Q be the pheromone left by the ant on the path (i,j) at time t, Q be the total amount of pheromone released by the ant when traversing all teaching points, and D be the total length of the path taken by the ant when traversing all teaching points.

[0131] Pheromone updating refers to updating the pheromone matrix based on the path length of the ants. In this step, if the optimal value changes or the number of consecutive times the optimal path has not been updated has not reached a threshold, the pheromone matrix is ​​updated based on the path length of all ants.

[0132] It is understandable that by updating pheromones, the pheromone concentration of shorter paths can be increased, guiding ants to choose shorter paths and gradually converge to the optimal solution.

[0133] Based on the path length of each ant, its contribution to the pheromone is calculated, and the pheromone matrix is ​​updated. Possible implementation methods include: directly using the pheromone update formula described above; or introducing a weighting factor to weight the pheromone contributions of different ants. Different implementation methods can be chosen based on the characteristics of the specific problem to balance the algorithm's exploration capability and convergence speed.

[0134] Preferably, before inputting the teaching point sequence into the improved ant colony algorithm, the following steps are included:

[0135] Establish a mathematical model for the shortest path using Euclidean distance, satisfying the following relationship:

[0136]

[0137] in For Euclidean distances, satisfy the following relation:

[0138]

[0139] The shortest path mathematical model is an optimization model that aims to minimize the total path length. In this step, a mathematical model is established by defining the objective function and decision variables, providing a mathematical foundation for subsequent path optimization.

[0140] Understandably, the purpose of establishing a shortest path mathematical model is to clarify the optimization objective, namely, to find the path that minimizes the total path length. By establishing a mathematical model, the practical problem can be transformed into a mathematical problem, facilitating its solution using various optimization algorithms. Specifically, based on the sequence of teaching points, the distance between each teaching point is defined, and a 0-1 decision variable is introduced to represent whether an ant moves from one teaching point to another. The objective function is to minimize the total length of all transfer paths. Possible implementation methods include: directly using Euclidean distance as the path length; or introducing weighting factors to weight different path segments.

[0141] Preferably, the detection device is driven to execute the complete detection process based on the optimized path, and the feasibility of coordinating the flipping timing of the flipping positioner, the movement of the positioning fixture, and the trajectory of the vision inspection robot is verified, including:

[0142] In the digital twin model, the control positioning fixture performs the battery tray clamping action;

[0143] Determine whether the current inspection stage requires driving the flip stand: If so, control the vision inspection robot to move to a safe avoidance position, drive the flip stand to perform a flip operation to the specified angle, and return to the scanning and inspection stage;

[0144] Determining whether the flipping support needs to be driven during the current inspection phase refers to determining whether the battery tray needs to be flipped to inspect its back side based on the inspection path and the position of the teaching point. The safe avoidance position refers to the location the vision inspection robot needs to move to during the flipping process to avoid collisions with the flipping support. In this step, by determining whether a flipping is necessary and controlling the robot to move to a safe position, the safety of the flipping operation is ensured. Specifically, in the digital twin model, based on the current inspection phase and the optimized path, it is determined whether the flipping support needs to be driven. If so, the vision inspection robot is controlled to move to a preset safe avoidance position, and then the flipping support is driven to perform the flipping operation to a specified angle. Possible implementation methods include: setting multiple safe avoidance positions and selecting an appropriate position based on different flipping angles; or dynamically calculating the safe avoidance position and adjusting it in real time based on the robot's current posture and the position of the flipping support.

[0145] If the rotating support is not required, the vision inspection robot is controlled to perform scanning inspections according to the optimized path. Guided by the optimized path, the robot can complete the scanning of all inspection points along the shortest path, reducing travel time and distance and improving inspection efficiency. Specifically, in the digital twin model, control commands are sequentially sent to the vision inspection robot according to the optimized path, driving it to move to each teaching point for scanning inspection. Possible implementation methods include: using interpolation algorithms to smooth the robot's motion trajectory; or introducing speed control to adjust the robot's movement speed to adapt to different inspection requirements.

[0146] Determine if all teaching points have been traversed: If not, return to the step of determining whether the current detection phase requires driving the flip bracket.

[0147] If the traversal is complete, control the positioning fixture to release the battery tray.

[0148] Preferably, after converting the optimized path into control commands and sending them to the detection device, the process includes:

[0149] The detection equipment receives and parses control commands, and simultaneously feeds back the real-time status to the digital twin model. The communication protocol uses structured data to encapsulate commands and status.

[0150] Control commands are instructions sent from the digital twin model to the detection device to control the device's actions. Real-time status feedback refers to the status information sent by the detection device to the digital twin model during execution, used to update the virtual model. The communication protocol uses structured data (such as JSON) to encapsulate commands and status, ensuring the accuracy and ease of data transmission. In this step, bidirectional communication between the digital twin model and the physical device is achieved through the Socket communication protocol, ensuring accurate transmission of control commands and real-time feedback of status information. By implementing virtual-to-physical control through the Socket communication protocol, the optimized detection path can be transmitted to the physical device in real time, while simultaneously acquiring the device's real-time status, ensuring consistency between the virtual model and the physical device, and improving the intelligence and automation level of the production process.

[0151] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0152] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims

1. A method for optimizing robot detection paths and rapid changeover based on digital twins, characterized in that, The robot inspection path optimization and rapid changeover method is applied to inspection equipment, which includes a flipping and positioning machine, a positioning fixture, and a vision inspection robot. The flipping and positioning machine includes a flipping bracket, a flipping driver, and a bottom slide rail, with the flipping driver located at both ends of the bottom slide rail. In use, the distance between the flipping drivers is adjusted by the slide rail to accommodate the size of the battery tray. The positioning fixture clamps and fixes the battery tray on the flipping bracket. The flipping driver adjusts the flipping bracket to a specified angle according to the preset setting. The vision inspection robot scans and inspects the battery tray according to the teaching point position. The robot inspection path optimization and rapid changeover method includes: Construct a digital twin model of the physical inspection equipment, and configure the joint hierarchy and motion constraints of the visual inspection robot based on the robot's DH parameters; Based on the inverse kinematics algorithm, the end effector of the vision inspection robot is controlled to move to the point to be inspected on the battery tray, generating a teaching point sequence and an initial detection path; The teaching point sequence is input into the improved ant colony algorithm. The initial detection path is optimized by incorporating genetic mutation operation and backtracking reset mechanism to obtain the optimized path. The genetic mutation operation includes introducing genetic mutation operation in each iteration to randomly perturb the current optimal path to escape local optima. The backtracking reset mechanism includes triggering a backtracking reset operation when the optimal solution has not been updated for a continuous period of time to reinitialize the pheromone matrix. The detection device is driven by the optimized path to perform the complete detection process, and the feasibility of the coordination between the flipping timing of the flipping positioner, the action of the positioning fixture and the trajectory of the vision detection robot is verified. The optimized path is converted into control commands and sent to the detection equipment; After inputting the teaching point sequence into the improved ant colony algorithm, the following steps are included: S11: Initialize ant colony algorithm parameters; S12: Place the ants and determine the candidate point set for the current teaching point of each ant; S13: Use the transition probabilities to determine the next teaching point to be visited for each ant. The transition probabilities satisfy the following relationship: in, Let represent the set of candidate points for the next teaching point of ant k. It is the pheromone concentration between teaching point i and teaching point j at time t. The pheromone importance coefficient. Let i be the reciprocal of the distance between teaching point i and teaching point j. The distance between teaching points is the importance coefficient, where s represents the set of unvisited teaching points; S14: Determine whether all teaching points have been traversed: If the traversal is not complete, return to step S12 to update the current candidate teaching point set and continue traversing; If the traversal has been completed, select the current optimal path from the ant traversal paths; Incorporation of genetic variations includes: Set the target number of swaps for the genetic mutation operation and generate random swap position indices; Based on the swap position index, perform pairwise swap operations on the node order of the current optimal path; Calculate the length of the new path after the swap operation; Determine whether the length of the new path is less than the length of the path before the mutation: if it is less, then the new path is adopted as the current optimal path; if it is not less, then the original path is retained. The inclusion of a rollback and reset mechanism includes: For the optimal solution of the ant colony algorithm, monitor the update status of the optimal path during the iteration process; If the number of consecutive times the optimal path has not been updated reaches a threshold Once the pheromone dispersion point is determined, a backtracking reset operation is performed: Reset the pheromone matrix; The pheromone is updated using a divergence-point adaptive update rule, satisfying the following relation: in, Let t be the iteration number of the pheromone dispersion point, a and b represent the increase and evaporation of pheromones after the dispersion point, and t be the current iteration number. = , The pheromone residue coefficient; If the optimal value changes or the number of consecutive times the optimal path has not been updated has not reached the threshold. Update pheromones according to the following formula: in, For information increment, Let ant be on path t at time t. The pheromones left on the surface It is the total amount of pheromones released by the ants as they traverse all the teaching points. This represents the total length of the path the ant takes when traversing all teaching points; The optimized path drives the detection device to execute the complete detection process, and verifies the feasibility of coordination between the flipping timing of the flipping positioner, the movement of the positioning fixture, and the trajectory of the vision inspection robot, including: In the digital twin model, the control positioning fixture performs the battery tray clamping action; Determine whether the current inspection stage requires driving the flip stand: If so, control the vision inspection robot to move to a safe avoidance position, drive the flip stand to perform a flip operation to the specified angle, and return to the scanning and inspection stage; If the flipping bracket is not required, control the vision inspection robot to perform scanning and inspection according to the optimized path; Determine if all teaching points have been traversed: If not, return to the step of determining whether the current detection phase requires driving the flip bracket. If the traversal is complete, control the positioning fixture to release the battery tray.

2. The method for optimizing robot detection paths and rapid changeover based on digital twins according to claim 1, characterized in that, Before inputting the teaching point sequence into the improved ant colony algorithm, the following steps are included: Establish a mathematical model for the shortest path using Euclidean distance, satisfying the following relationship: in For Euclidean distances, satisfy the following relation: 。 3. The method for optimizing robot detection paths and rapid changeover based on digital twins according to claim 1, characterized in that, After the optimized path is converted into control commands and sent to the detection device, the following steps are included: The detection equipment receives and parses control commands, and simultaneously feeds back the real-time status to the digital twin model. The communication protocol uses structured data to encapsulate commands and status.