Path planning method and system based on ant colony algorithm and dynamic window
By adopting ant colony algorithm and dynamic window path planning method in the AGV transport robot, combined with depth camera data and expansion tree stochastic optimization method, the problem of path planning failure in dynamic environments is solved, efficient map update, path planning and dynamic obstacle avoidance are achieved, and the AGV handling efficiency is improved.
Patent Information
- Application Number
- CN202411707285.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-27
AI Technical Summary
The prior art is difficult to effectively update maps, path planning and dynamic obstacle avoidance in a dynamic environment, resulting in the AGV handling robot being unable to predict static obstacles in advance, resulting in path planning failure and time wasted.
The path planning method based on ant colony algorithm and dynamic window is adopted, combined with depth camera data and expansion tree stochastic optimization method, map and path planning are updated in real time, obstacle avoidance is avoided dynamically, and the transport path is optimized through the path automatic tuning model.
It realizes reasonable map updates, path planning and dynamic obstacle avoidance without collisions and meeting customer needs, improving the reliability of path planning and the handling efficiency of AGVs.
Smart Images

Figure CN119204379B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of robot path planning scheme design, and in particular to a path planning method and system based on ant colony algorithm and dynamic window. Background Art
[0002] In the production line environment, the environment is complex and changeable. Frequent handling of production tools, production materials or production raw materials will bring about changes in the position of static obstacles, which will cause the AGV handling robot to face the problem of avoiding dynamic obstacles. Therefore, for the changing environment, it is necessary to design a reasonable environment modeling update strategy and a flexible obstacle avoidance strategy corresponding to complex dynamic obstacles. Therefore, how to reasonably update the map, plan the path, and avoid dynamic obstacles without collision and meet customer needs are unresolved problems. In addition, in the prior art, there is a lack of solutions for further optimizing the AGV's handling path in real time according to the production task of the production line. Often, many static obstacles are temporarily piled up on the production line. Different production tasks often have different static obstacles piled up. Since the robot cannot predict in advance, the original path planning will fail, and the robot cannot pass. The path needs to be replanned, which may cause the robot to detour a long way, resulting in a lot of time wasted.
[0003] Therefore, the prior art needs to be further developed. Summary of the invention
[0004] The purpose of the present invention is to overcome the above technical deficiencies and provide a path planning method and system based on ant colony algorithm and dynamic window to solve the problems existing in the prior art.
[0005] To achieve the above technical objectives, according to a first aspect of the present invention, the present invention provides a path planning method based on an ant colony algorithm and a dynamic window, comprising:
[0006] S100, construct a preset environment map of the production line, divide the preset environment map into several grid areas using a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV transport robot and obtaining a first moving path; using the preset environment map of the production line, obtain the serial number of each production equipment near the first moving path, and then obtain the current production tasks of each production equipment that the AGV transport robot will pass through in sequence during the movement along the first path in the MES system, form a production task list, and when the AGV transport robot moves along the preset transport route In the process, a depth camera arranged on the AGV transport robot is used to collect the depth image data in front, the collected data is processed, the processed depth camera data is used to judge the passable window according to the preset judgment rule, and the travel rule is formulated based on the judgment result. After the AGV transport robot moves according to the first moving path and the formulated travel rule and completes the transport task, the first moving path, the actual moving path and the production task list of the AGV transport robot are obtained, which are recorded as the path coupling data set, and a preset number of path coupling data sets are obtained, and the collected path coupling data set is divided into a training data set and a verification data set according to a first preset ratio;
[0007] S200, using the collected training data set to train the path automatic tuning model, using the verification data set to optimize the path automatic tuning model, optimizing the model parameters, and completing the path automatic tuning model training;
[0008] S300. When the model training is completed, the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path are obtained, the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path.
[0009] Specifically, the construction of a preset environment map of the production line includes:
[0010] Construct a preset environmental map of the production line, control the AGV transport robot to enter the production line, use the depth camera installed on the AGV transport robot to collect the surrounding image data of the AGV transport robot, and use the surrounding image data and position data collected by the depth camera and positioning device installed on the AGV transport robot to update the preset environmental map of the production line.
[0011] Specifically, the processing of the collected data includes:
[0012] First, we obtain the set of depth arrays {Ad1, Ad2, …, Adn} and the corresponding angles and distances {d1, d2, …, dn} in the depth image data, where 125° of the laser radar corresponds to 0° of the depth camera's viewing angle. We count the points in the image within the range of d1±dσ and store the coordinates in array Ad1. We obtain the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in array Ad1. We establish a target search box M1 based on the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in Ad1. We count the points in the image within the range of d2±dσ and store the coordinates in array Ad2, …, and so on. The depth image is divided into a series of target search boxes Mn.
[0013] Specifically, the processing of the depth camera data to determine the passable window according to the preset determination rules, and formulating the travel rules based on the determination results, include:
[0014] Calculate the distance difference of adjacent target search boxes respectively, and determine whether the maximum distance difference is greater than or equal to the first preset threshold. If so, determine whether the width of the target search box with a larger distance between the two target search boxes that produce the maximum distance difference is greater than or equal to the second preset threshold, and at the same time determine whether the height of the target search box is greater than or equal to the third preset threshold. If so, the area indicated by the target search box is a passable window, then calculate the deviation angle between the center of the target search box and the driving direction of the AGV transport robot, and calculate the distance that the AGV transport robot needs to move left or right based on the distance and the deviation angle. The AGV transport robot moves this distance left or right so that the forward direction of the AGV transport robot and the center of the target search box are located in the same vertical plane, and then the AGV transport robot enters the passable window along the intersection of the vertical plane and the horizon.
[0015] Specifically, the method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the automatic path tuning model training includes:
[0016] The training data set is input into the preset network layer in batches for training, and the preset network layer includes a Transformer network layer, and the Transformer network layer is used to predict the next path coupling data set based on the forward propagation of the current path coupling data set, and then obtain the predicted loss value; the loss value of the preset network layer is calculated and input into the optimizer for optimization, and the direction in which the parameter gradient of the path automatic tuning model decreases fastest is determined; the path automatic tuning model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the path automatic tuning model.
[0017] Specifically, the method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the automatic path tuning model training also includes:
[0018] After each training, the verification data set is input into the preset network layer of the previous training in batches for model parameter verification, and cyclic training is performed, with the total number of training rounds set to the first preset round; the loss value of the preset network layer is recorded, and it is determined whether the loss value meets the first preset condition, and whether to end the training and output the model parameters based on the judgment result.
[0019] Specifically, the determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes:
[0020] If the loss value meets the first preset condition, the training is terminated and the parameters of the current path automatic tuning model are output; if the loss value does not meet the first preset condition, the training continues.
[0021] Specifically, the first preset condition includes:
[0022] After the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
[0023] Specifically, the ant colony algorithm is used for global path planning, and the extension tree random optimization method is used to optimize the ant colony algorithm, including:
[0024] Assume that the total number of ants is M, the pheromone between nodes is represented by the matrix Pheromone, the optimal path length is BestLength, the optimal path is BestTour, each ant has its own memory to store the nodes that the ant has visited, thereby avoiding the ant from searching the node for the second time; in addition, a node table allowed to be visited is established to represent the nodes visited by the ant, and a matrix is used to store the pheromone information released by the path passed by the ant in one iteration; assume that the algorithm runs Maxgen times in total, and the current number of iterations is t;
[0025] The steps are as follows:
[0026] Step a, parameter initialization setting;
[0027] The number of ants is k, the pheromone inspiration factor is α, the expected inspiration factor is β, the pheromone volatility factor is ρ, and the pheromone intensity is Q;
[0028] Step b, number of cycles t=t+1;
[0029] Step c, the ant's taboo table index number k=1;
[0030] Step d, the number of ants k = k + 1;
[0031] Step e: The ant individual selects an element and moves forward according to the probability calculated by the state transition probability formula. The probability distribution of the starting point is calculated according to the following formula:
[0032]
[0033] where t ij is the pheromone volatilization between node i and node j, η ij is a heuristic function;
[0034] Step f, modify the taboo table pointer, that is, after selecting, move the ant to a new node, and move the node to the taboo table of the ant individual;
[0035] Step g, update pheromone, the pheromone update formula is as follows:
[0036]
[0037] Where Δt ij represents the sum of pheromones released by all ants on the path;
[0038] Step h: If the maximum number of iterations Maxgen is reached, the algorithm terminates and outputs the first path; otherwise, go to step b.
[0039] According to a second aspect of the present invention, there is provided a path planning system based on an ant colony algorithm and a dynamic window, comprising:
[0040] An acquisition module is used to obtain the serial number of each production equipment near the first moving path by using the preset environment map of the production line, and then obtain the current production tasks of each production equipment that the AGV handling robot will pass in sequence during the movement along the first path in the MES system to form a production task list; and is used to obtain the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path after the model training is completed;
[0041] The control module is used to construct a preset environment map of the production line, divide the preset environment map into several grid areas by adopting a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV handling robot and obtaining a first moving path; and is used to collect the depth image data of the front by using a depth camera arranged on the AGV handling robot during the movement of the AGV handling robot according to the preset handling route, process the collected data, use the processed depth camera data to judge the passable window according to the preset judgment rule, formulate a travel rule based on the judgment result, and when the AGV handling robot follows the first moving path and the formulated The robot moves according to the travel rules, and after completing the handling task, obtains the first moving path, the actual moving path and the production task list of the AGV handling robot, which are recorded as a path coupling data set, obtains a preset number of path coupling data sets, and divides the collected path coupling data sets into a training data set and a verification data set according to a first preset ratio; it is used to train the path automatic tuning model using the collected training data set, and optimize the path automatic tuning model using the verification data set, optimize the model parameters, and complete the path automatic tuning model training; it is used to input the first path corresponding to the next handling task and the production task list corresponding to the first path into the path automatic tuning model when the model training is completed, and use the path output by the model as the optimal path.
[0042] Beneficial effects:
[0043] The present invention firstly performs global path planning based on the ant colony algorithm, optimizes the ant colony algorithm by using the extension tree random optimization method, obtains a first moving path, and in the process of the robot moving along the first moving path, uses a depth camera arranged on the AGV transport robot to collect depth image data in front, processes the collected data, uses the processed depth camera data to judge the passable window according to preset judgment rules, formulates travel rules based on the judgment results, and after the AGV transport robot moves according to the first moving path and the formulated travel rules and completes the transport task, obtains the first moving path, the actual moving path and the production task list of the AGV transport robot, which are recorded as a path coupling data set, and then trains a path automatic tuning model. When the model training is completed, obtains the first path of the AGV transport robot for the next transport task and the production task list corresponding to the first path, inputs the first path and the production task list corresponding to the first path into the path automatic tuning model, and uses the path output by the model as the optimal path. It realizes reasonable map updating, path planning, and dynamic obstacle avoidance without collision and meeting customer needs, and further optimizes the AGV's transportation path in real time according to the production task of the production line. It solves the problem that different production tasks often have different static obstacles stacked, and the robot cannot predict them in advance, which will cause the original path planning to fail, the robot cannot pass, and the path needs to be replanned, which may cause the robot to take a long detour and waste a lot of time. It further improves the reliability of path planning and the transportation efficiency of AGV. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flow chart of a path planning method based on ant colony algorithm and dynamic window provided in a specific embodiment of the present invention;
[0045] Figure 2 Schematic diagram of the system composition of a path planning system based on an ant colony algorithm and a dynamic window provided in a specific embodiment of the present invention;
[0046] Figure 3 It is a structural diagram of a path optimization model provided in a specific embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution of the present invention is clearly and completely described below in conjunction with the accompanying drawings of the present invention. Based on the embodiments in this application, other similar embodiments obtained by ordinary technicians in this field without making creative work should all fall within the scope of protection of this application. In addition, the directional words mentioned in the following embodiments, such as "up", "down", "left", "right", etc., are only reference to the directions of the accompanying drawings. Therefore, the directional words used are used to illustrate rather than limit the invention.
[0048] The present invention will be further described below in conjunction with the accompanying drawings and preferred embodiments.
[0049] See also Figure 1 The present invention provides a path planning method based on ant colony algorithm and dynamic window, comprising:
[0050] S100, construct a preset environment map of the production line, divide the preset environment map into several grid areas using a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV transport robot and obtaining a first moving path; using the preset environment map of the production line, obtain the serial number of each production equipment near the first moving path, and then obtain the current production tasks of each production equipment that the AGV transport robot will pass through in sequence during the movement along the first path in the MES system, form a production task list, and when the AGV transport robot moves along the preset transport route During the process, a depth camera arranged on the AGV transport robot is used to collect depth image data in front, the collected data is processed, and the processed depth camera data is used to judge the passable window according to preset judgment rules, and travel rules are formulated based on the judgment results. After the AGV transport robot moves according to the first moving path and the formulated travel rules and completes the transport task, the first moving path, actual moving path and production task list of the AGV transport robot are obtained, recorded as a path coupling data set, a preset number of path coupling data sets are obtained, and the collected path coupling data set is divided into a training data set and a verification data set according to a first preset ratio.
[0051] Specifically, the construction of a preset environment map of the production line includes:
[0052] Construct a preset environmental map of the production line, control the AGV transport robot to enter the production line, use the depth camera installed on the AGV transport robot to collect the surrounding image data of the AGV transport robot, and use the surrounding image data and position data collected by the depth camera and positioning device installed on the AGV transport robot to update the preset environmental map of the production line.
[0053] Specifically, the three-dimensional model of the production line is established by using the depth data and position data collected by the depth camera and the positioning device provided on the AGV handling robot, including:
[0054] A positioning device is provided on the AGV transport robot to obtain the current positioning data of the AGV transport robot, and a depth camera provided on the AGV transport robot is used to obtain the depth data of each pixel within the current field of view of the camera. The obtained current positioning data of the AGV transport robot and the depth data of each pixel within the current field of view of the camera are integrated to obtain three-dimensional data within the current field of view of the camera, and a three-dimensional model of the production line is established based on the three-dimensional data within the current field of view of the camera.
[0055] It should be noted here that, in the technical solution of the present invention, the initial map of the production line is first established with the help of the production line drawing, and the AGV transport robot virtual prototype and virtual simulation platform are established. After the switch receives the data sent by the relay machine, it forwards it to the host computer. After the host computer solves the data, it obtains the operating status of the AGV transport robot and the production line environment information, and sets the initial starting point of the AGV intelligent transport robot.
[0056] Specifically, before step S100, it includes presetting a first preset threshold, a second preset threshold, a third preset threshold, a preset number, a first preset ratio, a first preset round, and a second preset round. It can be understood that the first preset threshold, the second preset threshold, the third preset threshold, the preset number, the first preset ratio, the first preset round, and the second preset round can be specifically set according to the actual needs of the user of the present invention. The present invention does not limit the specific values of the above parameters, as long as it is applicable to the path planning method based on the ant colony algorithm and the dynamic window proposed in the present invention. Preferably, the second preset threshold is greater than the width of the AGV transport robot, and the third preset threshold is greater than the height of the AGV transport robot, so as to ensure that the AGV intelligent transport robot can pass through the passable channel. Preferably, the first preset threshold is 1.5 meters. Setting the first preset threshold to 1.5 meters is the result of a large number of experiments conducted by the technicians of the present invention. Since the difference between the distance from the end of the passable channel to the AGV intelligent transport robot and the distance from the obstacle to the AGV intelligent transport robot is usually greater than 1.5 meters, setting the first preset threshold to 1.5 meters can be used to analyze whether a passable channel is found. The extremely complex channel judgment problem is simplified through clever design without the need for complex algorithm modeling, which greatly improves the intelligence level of the present invention, realizes real-time and efficient channel judgment when encountering complex terrain such as obstacles, and realizes the ability to avoid irregular and even dynamic obstacles, which greatly expands the application scenarios of the present invention.
[0057] Preferably, the present invention sets the preset number to 1000, the present invention sets the first preset ratio to 8:2, the present invention sets the first preset round to 30,000 times, and the present invention sets the second preset round to 200. The above settings can further improve the performance of the model and the efficiency of model training, and greatly improve the accuracy and reliability of the path automatic tuning model prediction of the present invention.
[0058] It should be noted that the preset environment map contains the location data and number data of each production equipment. The MES system stores the number of each production equipment and the real-time production task of each production equipment.
[0059] Specifically, the processing of the collected data includes:
[0060] First, we obtain the set of depth arrays {Ad1, Ad2, …, Adn} and the corresponding angles and distances {d1, d2, …, dn} in the depth image data, where 125° of the laser radar corresponds to 0° of the depth camera's viewing angle. We count the points in the image within the range of d1±dσ and store the coordinates in array Ad1. We obtain the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in array Ad1. We establish a target search box M1 based on the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in Ad1. We count the points in the image within the range of d2±dσ and store the coordinates in array Ad2, …, and so on. The depth image is divided into a series of target search boxes Mn.
[0061] Specifically, the processing of the depth camera data to determine the passable window according to the preset determination rules, and formulating the travel rules based on the determination results, include:
[0062] Calculate the distance difference of adjacent target search boxes respectively, and determine whether the maximum distance difference is greater than or equal to the first preset threshold. If so, determine whether the width of the target search box with a larger distance between the two target search boxes that produce the maximum distance difference is greater than or equal to the second preset threshold, and at the same time determine whether the height of the target search box is greater than or equal to the third preset threshold. If so, the area indicated by the target search box is a passable window, then calculate the deviation angle between the center of the target search box and the driving direction of the AGV transport robot, and calculate the distance that the AGV transport robot needs to move left or right based on the distance and the deviation angle. The AGV transport robot moves this distance left or right so that the forward direction of the AGV transport robot and the center of the target search box are located in the same vertical plane, and then the AGV transport robot enters the passable window along the intersection of the vertical plane and the horizon.
[0063] S200: Use the collected training data set to train the path automatic tuning model, use the verification data set to optimize the path automatic tuning model, optimize the model parameters, and complete the path automatic tuning model training.
[0064] It is understandable that different production tasks often have different stacked static obstacles, but the same production tasks often have related stacked static obstacles, and the impact on the passing AGV transport robot is also similar. That is, after completing the transport task, there is a certain coupling relationship between the first moving path, the actual moving path and the production task list of the AGV transport robot. This coupling relationship can provide information for subsequent robot path planning. The present invention designs a path automatic tuning model based on this.
[0065] Specifically, the method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the automatic path tuning model training includes:
[0066] The training data set is input into the preset network layer in batches for training, and the preset network layer includes a Transformer network layer, and the Transformer network layer is used to predict the next path coupling data set based on the forward propagation of the current path coupling data set, and then obtain the predicted loss value; the loss value of the preset network layer is calculated and input into the optimizer for optimization, and the direction in which the parameter gradient of the path automatic tuning model decreases fastest is determined; the path automatic tuning model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the path automatic tuning model.
[0067] It can be understood that Transformer is a deep learning model based on the self-attention mechanism, which consists of a multi-head attention mechanism and a feedforward neural network. It can process sequence data and capture long-distance dependencies. The Transformer model does not contain traditional convolutional layers, but processes each element in the input sequence through an attention layer. The typical structure of Transformer includes an encoder and a decoder, wherein the encoder is composed of multiple identical layers stacked together, and the decoder adds a self-attention layer on the basis of the encoder to process sequence generation tasks. The present invention uses Transformer to supplement global context information, enhances the model's capabilities in feature extraction and global understanding, greatly improves the performance of the model, and greatly reduces the computational cost.
[0068] Specifically, the preset network layer also includes a ResNet network layer, and the ResNet network layer is used to predict the output result according to the collected path coupling data set.
[0069] It should be noted here that ResNet is a deep convolutional neural network that solves the gradient vanishing problem in deep network training by introducing residual connections. The core component of ResNet is the residual block, which usually contains two or three convolutional layers and a jump connection, which allows the gradient to bypass these convolutional layers directly. The network structure of ResNet can be very deep. These networks extract the features of the first moving path, the actual moving path of the AGV handling robot, and the production task list during the cargo handling process by stacking multiple residual blocks, and predict the output results through global average pooling and fully connected layers.
[0070] See also Figure 3 The present invention combines the ResNet network layer and the Transformer network layer. ResNet is good at extracting the local features of the first moving path, the actual moving path of the AGV handling robot and the production task list during the cargo handling process, while Transformer can supplement the global context information. This combination can enhance the model's capabilities in feature extraction and global understanding, greatly improve the performance of the model, and greatly reduce the computational cost.
[0071] It can be understood that the ResNet network layer is used to predict the output result through the path coupling data set collected in the training data set and the verification data set. The specific steps are:
[0072] (1) First, put the training data set into the Backbones network layer of the model. Backbone refers to a series of convolutional layers that constitute the skeleton of the neural network. The main function of these layers is to extract the features of the input data. The Backbone network is usually composed of multiple convolutional layers, pooling layers, and activation functions. It can extract meaningful feature representations from the original data. Backbones is composed of multiple Backbones, and the core network layer in Backbone is the Resnet network layer. After the data set is input into the model, the path coupling data set will be input into Backbones for training;
[0073] (2) When building Backbone, a Resnet network layer was added. After the training data set was input, Resnet began to train layer by layer. The training extracted features from the path coupling data set and assisted Transformer in predicting the optimal path.
[0074] Specifically, the method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the automatic path tuning model training also includes:
[0075] After each training, the verification data set is input into the preset network layer of the previous training in batches for model parameter verification, and cyclic training is performed, with the total number of training rounds set to the first preset round; the loss value of the preset network layer is recorded, and it is determined whether the loss value meets the first preset condition, and whether to end the training and output the model parameters based on the judgment result.
[0076] Specifically, the determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes:
[0077] If the loss value meets the first preset condition, the training is terminated and the parameters of the current path automatic tuning model are output; if the loss value does not meet the first preset condition, the training continues.
[0078] Specifically, the first preset condition includes:
[0079] After the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
[0080] Specifically, after each training, the verification data set is input into the preset network layer of the previous training in batches to verify the model parameters, and the cyclic training is performed, including the following methods:
[0081] When the number of training times is not enough and the model needs to be optimized, the training can only be performed from the beginning. Therefore, the present invention develops a method for continuing the following training based on the previously trained model parameter file;
[0082] (1) Provide custom parameters, which can be set according to user needs to continue training based on any training parameters;
[0083] (2) Load the parameters of the custom model file;
[0084] (3) Put the validation data set into the custom parameter network layer for validation, obtain the loss value and record the model parameters of the model corresponding to the minimum loss value during the training process;
[0085] (4) Based on this set of model parameters, forward propagation training and back propagation are performed, and the optimizer optimizes the parameters to obtain a new set of data;
[0086] (5) Put the verification data into the new data network layer for inference to obtain the loss value;
[0087] (6) Perform cyclic training to obtain the best model and complete model optimization.
[0088] It is understandable that the training method adopted by the present invention is batch training, which means that each time the model parameters are updated, only a part of the samples in the validation data set is used, which is called a batch. The advantages of batch training are that it can reduce memory consumption, speed up training, increase randomness, and facilitate the generalization of the model.
[0089] It should be noted here that, in the present invention, batch_size=2, and the batch_size is the batch size. For example, when batch_size=2, it means that two path coupling data sets are selected from the verification data set each time and put into the model for verification.
[0090] Specifically, the determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes:
[0091] If the loss value meets the first preset condition, the training is terminated and the parameters of the automatic tuning model of the current path are output; if the loss value does not meet the first preset condition, the training is continued;
[0092] The first preset condition is that after the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
[0093] It can be understood that the present invention preferably sets the maximum round of cyclic training to 30,000 times, which can effectively ensure the accuracy of the model prediction of the present invention and record the loss value of the model training. The present invention sets the second preset round to 200, that is, when the loss value of the training no longer decreases within 200 rounds of training, the round with the smallest loss value in the 200 rounds of training is saved as the best verification round parameter to generate the best model file. The above setting makes the training rounds no longer rely on manual judgment, but uses the deep learning model for automatic training, which improves the accuracy of the model prediction, and automatically ends the training when the accuracy meets the requirements, which greatly saves the training time, and can also effectively prevent overfitting, which greatly improves the intelligence level of the present invention and the efficiency of model training.
[0094] Furthermore, the specific process of the training path automatic tuning model of the present invention is as follows:
[0095] (1) Obtain the potential vector mean mu and logarithmic variance logvar during the forward propagation process of the path automatic tuning model;
[0096] (2) Calculate a reasonable loss value representing the training effect:
[0097] Calculate the divergence: k1=-0.5*(1+logvar-mu^2-(e^logvar));
[0098] Calculate the loss between the path coupling data set and the predicted value in the validation data set:
[0099] loss=L1+k1*k1_weight;
[0100] Among them, loss is the loss value, k1 is the divergence, k1_weight is the proportion of k1, the value is 10, L1 is the absolute difference between the predicted value and the true value, and the calculation formula of L1 is as follows: ;
[0101] Among them, A is the L1 loss in pytorch, which calculates the average or sum of the absolute differences between two tensors; the shape of A is N*C*H*W, which indicates that it is a four-dimensional tensor, N represents the number of samples (Batch Size), indicating that there are N data points, C represents the number of channels (Channels), H and W represent the height and width respectively, which are usually the two-dimensional spatial dimensions of the input features; P represents the padding value, which is a Boolean type, and the shape of P is c*h*w*1. The dimensions of P are the same as those of A in terms of channel, height, and width, but there is no sample number N, which means that P is a mask or padding information for a feature map of each sample, and the Boolean value of P may be used to mark whether the elements in A are filled (True) or valid (False).
[0102] (3) The loss value when using the validation data set to validate the current model network;
[0103] (4) If the validation loss of this round is less than that of the previous round, the best model parameters are replaced with the training model of this round;
[0104] (5) Put the rounds and loss values into the dictionary one by one;
[0105] (6) Compare the loss value of the current round with the loss values of the 200 rounds before this round (parameters are provided and can be set according to actual needs, the default is 200), that is, traverse the loss values from epoch-200 to epoch-1 (epoch is the training round, and the comparison is performed when the epoch is greater than 200). If the loss values of the current round of epoch are all greater than the loss values from (epoch-200) to (epoch-1), stop training.
[0106] (7) Save the best model parameters in the cyclic validation as a ckpt model file.
[0107] Specifically, the ant colony algorithm is used for global path planning, and the extension tree random optimization method is used to optimize the ant colony algorithm, including:
[0108] Assume that the total number of ants is M, the pheromone between nodes is represented by the matrix Pheromone, the optimal path length is BestLength, the optimal path is BestTour, each ant has its own memory to store the nodes that the ant has visited, thereby avoiding the ant from searching the node for the second time; in addition, a node table allowed to be visited is established to represent the nodes visited by the ant, and a matrix is used to store the pheromone information released by the path passed by the ant in one iteration; assume that the algorithm runs Maxgen times in total, and the current number of iterations is t;
[0109] The steps are as follows:
[0110] Step a, parameter initialization setting;
[0111] The number of ants is k, the pheromone inspiration factor is α, the expected inspiration factor is β, the pheromone volatility factor is ρ, and the pheromone intensity is Q;
[0112] Step b, number of cycles t=t+1;
[0113] Step c, the ant's taboo table index number k=1;
[0114] Step d, the number of ants k = k + 1;
[0115] Step e: The ant individual selects an element and moves forward according to the probability calculated by the state transition probability formula. The probability distribution of the starting point is calculated according to the following formula:
[0116]
[0117] where t ij is the pheromone volatilization between node i and node j, η ij is a heuristic function;
[0118] Step f, modify the taboo table pointer, that is, after selecting, move the ant to a new node, and move the node to the taboo table of the ant individual;
[0119] Step g, update pheromone, the pheromone update formula is as follows:
[0120]
[0121] Where Δt ij represents the sum of pheromones released by all ants on the path;
[0122] Step h: If the maximum number of iterations Maxgen is reached, the algorithm terminates and outputs the first path; otherwise, go to step b.
[0123] Step 2a: Input the path to be optimized, and set the input sequence number of the meta-expansion node to 1;
[0124] Step 2b, the meta-expansion node position expands outward; if the expansion node touches the boundary or obstacle, the expansion in that direction stops and the value of that direction is set to INF, and the expansion stops; if the expansion node belongs to the path to be optimized and the meta-expansion node and the expansion node are reachable in a straight line, the straight line path between the meta-expansion node and the expansion node replaces the path between the meta-expansion node and the expansion node in the path to be optimized, generates a path to be selected, sets the value to the path length, and stops expanding;
[0125] Step 2c: When all directions of the meta-nodes reach the stop condition, the path to be selected with the smallest value is selected to update the path to be optimized;
[0126] Step 2d, the meta-expansion node number is automatically increased, and steps 2b and 2c are repeated until the meta-expansion node number reaches the maximum, and the optimized path is output;
[0127] Step 3: Dynamic obstacle avoidance: The AGV transport robot adopts a trajectory prediction scheme that integrates the social force model and Kalman filter to predict the trajectory of moving obstacles, thereby achieving obstacle avoidance and path planning for dynamic obstacles in local path planning.
[0128] S300. When the model training is completed, the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path are obtained, the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path.
[0129] It can be understood that the present invention first performs global path planning based on the ant colony algorithm, optimizes the ant colony algorithm using an extended tree random optimization method, and obtains a first moving path. In the process of the robot moving along the first moving path, a depth camera arranged on the AGV transport robot is used to collect depth image data in front, the collected data is processed, and the processed depth camera data is used to judge the passable window according to preset judgment rules, and travel rules are formulated based on the judgment results. After the AGV transport robot moves according to the first moving path and the formulated travel rules and completes the transport task, the first moving path, actual moving path and production task list of the AGV transport robot are obtained, which are recorded as a path coupling data set, and then the path automatic tuning model is trained. After the model training is completed, the first path of the AGV transport robot for the next transport task and the production task list corresponding to the first path are obtained, the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path. It realizes reasonable map updating, path planning, and dynamic obstacle avoidance without collision and meeting customer needs, and further optimizes the AGV's transportation path in real time according to the production task of the production line. It solves the problem that different production tasks often have different static obstacles stacked, and the robot cannot predict them in advance, which will cause the original path planning to fail, the robot cannot pass, and the path needs to be replanned, which may cause the robot to take a long detour and waste a lot of time. It further improves the reliability of path planning and the transportation efficiency of AGV.
[0130] See also Figure 2 The present invention provides another embodiment, which provides a path planning system based on an ant colony algorithm and a dynamic window. The path planning system based on an ant colony algorithm and a dynamic window includes:
[0131] The acquisition module 100 is used to obtain the serial number of each production equipment near the first moving path by using the preset environment map of the production line, and then obtain the current production tasks of each production equipment that the AGV handling robot will pass in sequence during the movement along the first path in the MES system to form a production task list; and is used to obtain the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path after the model training is completed;
[0132] The control module 200 is used to construct a preset environment map of the production line, divide the preset environment map into several grid areas by adopting a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV handling robot and obtaining a first moving path; and is used to collect the depth image data of the front by using a depth camera arranged on the AGV handling robot during the process of the AGV handling robot moving according to the preset handling route, process the collected data, use the processed depth camera data to judge the passable window according to the preset judgment rule, formulate a travel rule based on the judgment result, and when the AGV handling robot moves according to the first moving path and the preset judgment rule, the AGV handling robot can move forward. The robot moves according to a certain travel rule, and after completing the handling task, obtains the first moving path, the actual moving path and the production task list of the AGV handling robot, which are recorded as a path coupling data set, obtains a preset number of path coupling data sets, and divides the collected path coupling data sets into a training data set and a verification data set according to a first preset ratio; the method is used to train the path automatic tuning model using the collected training data set, and optimize the path automatic tuning model using the verification data set, optimize the model parameters, and complete the path automatic tuning model training; and when the model training is completed, inputs the first path corresponding to the next handling task and the production task list corresponding to the first path into the path automatic tuning model, and uses the path output by the model as the optimal path.
[0133] It should be noted here that the present invention first performs global path planning based on the ant colony algorithm, optimizes the ant colony algorithm using an extended tree random optimization method, and obtains a first moving path. In the process of the robot moving along the first moving path, a depth camera arranged on the AGV transport robot is used to collect depth image data in front, and the collected data is processed. The processed depth camera data is used to judge the passable window according to preset judgment rules, and a travel rule is formulated based on the judgment result. After the AGV transport robot moves according to the first moving path and the formulated travel rules and completes the transport task, the first moving path, actual moving path and production task list of the AGV transport robot are obtained, which are recorded as a path coupling data set, and then the path automatic tuning model is trained. When the model training is completed, the first path of the AGV transport robot for the next transport task and the production task list corresponding to the first path are obtained, and the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path. It realizes reasonable map updating, path planning, and dynamic obstacle avoidance without collision and meeting customer needs, and further optimizes the AGV's transportation path in real time according to the production task of the production line. It solves the problem that different production tasks often have different static obstacles stacked, and the robot cannot predict them in advance, which will cause the original path planning to fail, the robot cannot pass, and the path needs to be replanned, which may cause the robot to take a long detour and waste a lot of time. It further improves the reliability of path planning and the transportation efficiency of AGV.
[0134] In a preferred embodiment, the present application further provides an electronic device, the electronic device comprising:
[0135] A memory; and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the path planning method based on the ant colony algorithm and the dynamic window is implemented. The computer device can be broadly a server, a terminal, or any other electronic device with necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc. connected through a system bus. The processor of the computer device can be used to provide necessary computing, processing and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory can provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect and communicate with external devices through a network. When the computer program is executed by the processor, the steps of the method of the present invention are performed.
[0136] The present invention may be implemented as a computer-readable storage medium having a computer program stored thereon, which causes the steps of the method of an embodiment of the present invention to be executed when executed by a processor. In one embodiment, the computer program is distributed on a plurality of computer devices or processors coupled to a network so that the computer program is stored, accessed and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be performed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be performed by one or more computer devices or processors, and one or more other method steps / operations may be performed by one or more other computer devices or processors. One or more computer devices or processors may perform a single method step / operation, or perform two or more method steps / operations.
[0137] It will be appreciated by a person skilled in the art that the method steps of the present invention may be performed by instructing related hardware such as a computer device or a processor through a computer program, and the computer program may be stored in a non-temporary computer-readable storage medium, which causes the steps of the present invention to be performed when the computer program is executed. Depending on the circumstances, any reference to memory, storage, database, or other media herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0138] It can be understood that the present invention first performs global path planning based on the ant colony algorithm, optimizes the ant colony algorithm using an extended tree random optimization method, and obtains a first moving path. In the process of the robot moving along the first moving path, a depth camera arranged on the AGV transport robot is used to collect depth image data in front, the collected data is processed, and the processed depth camera data is used to judge the passable window according to preset judgment rules, and travel rules are formulated based on the judgment results. After the AGV transport robot moves according to the first moving path and the formulated travel rules and completes the transport task, the first moving path, actual moving path and production task list of the AGV transport robot are obtained, which are recorded as a path coupling data set, and then the path automatic tuning model is trained. After the model training is completed, the first path of the AGV transport robot for the next transport task and the production task list corresponding to the first path are obtained, the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path. It realizes reasonable map updating, path planning, and dynamic obstacle avoidance without collision and meeting customer needs, and further optimizes the AGV's transportation path in real time according to the production task of the production line. It solves the problem that different production tasks often have different static obstacles stacked, and the robot cannot predict them in advance, which will cause the original path planning to fail, the robot cannot pass, and the path needs to be replanned, which may cause the robot to take a long detour and waste a lot of time. It further improves the reliability of path planning and the transportation efficiency of AGV.
[0139] The various technical features described above can be combined arbitrarily. Although all possible combinations of these technical features are not described, any combination of these technical features should be considered to be covered by this specification as long as there is no contradiction in such combination.
[0140] The specific implementation of the present invention described above does not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A path planning method based on ant colony algorithm and dynamic window, characterized in that: The method comprises: S100, construct a preset environment map of the production line, divide the preset environment map into several grid areas using a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV transport robot and obtaining a first moving path; using the preset environment map of the production line, obtain the serial number of each production equipment near the first moving path, and then obtain the current production tasks of each production equipment that the AGV transport robot will pass through in sequence during the movement along the first path in the MES system, form a production task list, and when the AGV transport robot moves along the preset transport route In the process, a depth camera arranged on the AGV transport robot is used to collect the depth image data in front, the collected data is processed, the processed depth camera data is used to judge the passable window according to the preset judgment rule, and the travel rule is formulated based on the judgment result. After the AGV transport robot moves according to the first moving path and the formulated travel rule and completes the transport task, the first moving path, the actual moving path and the production task list of the AGV transport robot are obtained, which are recorded as the path coupling data set, and a preset number of path coupling data sets are obtained, and the collected path coupling data set is divided into a training data set and a verification data set according to a first preset ratio; S200, using the collected training data set to train the path automatic tuning model, using the verification data set to optimize the path automatic tuning model, optimizing the model parameters, and completing the path automatic tuning model training; S300, when the model training is completed, the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path are obtained, the first path and the production task list corresponding to the first path are input into the path automatic tuning model, and the path output by the model is used as the optimal path; The method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the training of the automatic path tuning model includes: The training data set is input into the preset network layer in batches for training, and the preset network layer includes a Transformer network layer, and the Transformer network layer is used to predict the next path coupling data set based on the forward propagation of the current path coupling data set, and then obtain the predicted loss value; the loss value of the preset network layer is calculated and input into the optimizer for optimization, and the direction in which the parameter gradient of the path automatic tuning model decreases fastest is determined; the path automatic tuning model performs back propagation according to the loss value and the parameter gradient of the model to optimize the parameters of the path automatic tuning model.
2. The path planning method based on ant colony algorithm and dynamic window according to claim 1, characterized in that: The construction of the preset environment map of the production line includes: Construct a preset environmental map of the production line, control the AGV transport robot to enter the production line, use the depth camera installed on the AGV transport robot to collect the surrounding image data of the AGV transport robot, and use the surrounding image data and position data collected by the depth camera and positioning device installed on the AGV transport robot to update the preset environmental map of the production line.
3. The path planning method based on ant colony algorithm and dynamic window according to claim 1, characterized in that: The processing of the collected data comprises: First, we obtain the set of depth arrays {Ad1, Ad2, …, Adn} and the corresponding angles and distances {d1, d2, …, dn} in the depth image data, where 125° of the laser radar corresponds to 0° of the depth camera's viewing angle. We count the points in the image within the range of d1±dσ and store the coordinates in array Ad1. We obtain the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in array Ad1. We establish a target search box M1 based on the maximum and minimum values of the horizontal coordinate and the maximum and minimum values of the vertical coordinate in Ad1. We count the points in the image within the range of d2±dσ and store the coordinates in array Ad2, …, and so on. The depth image is divided into a series of target search boxes Mn.
4. The path planning method based on ant colony algorithm and dynamic window according to claim 3, characterized in that: The method of using the processed depth camera data to determine the passable window according to a preset determination rule and formulating a travel rule based on the determination result includes: Calculate the distance difference of adjacent target search boxes respectively, and determine whether the maximum distance difference is greater than or equal to the first preset threshold. If so, determine whether the width of the target search box with a larger distance between the two target search boxes that produce the maximum distance difference is greater than or equal to the second preset threshold, and at the same time determine whether the height of the target search box is greater than or equal to the third preset threshold. If so, the area indicated by the target search box is a passable window, then calculate the deviation angle between the center of the target search box and the driving direction of the AGV transport robot, and calculate the distance that the AGV transport robot needs to move left or right based on the distance and the deviation angle. The AGV transport robot moves this distance left or right so that the forward direction of the AGV transport robot and the center of the target search box are located in the same vertical plane, and then the AGV transport robot enters the passable window along the intersection of the vertical plane and the horizon.
5. The path planning method based on ant colony algorithm and dynamic window according to claim 1, characterized in that: The method of using the collected training data set to train the automatic path tuning model, using the verification data set to optimize the automatic path tuning model, optimizing the model parameters, and completing the automatic path tuning model training also includes: After each training, the verification data set is input into the preset network layer of the previous training in batches for model parameter verification, and cyclic training is performed, with the total number of training rounds set to the first preset round; the loss value of the preset network layer is recorded, and it is determined whether the loss value meets the first preset condition, and whether to end the training and output the model parameters based on the judgment result.
6. The path planning method based on ant colony algorithm and dynamic window according to claim 5, characterized in that: The determining whether the loss value satisfies the first preset condition, and determining whether to end the training and output the model parameters according to the determination result, includes: If the loss value meets the first preset condition, the training is terminated and the parameters of the current path automatic tuning model are output; if the loss value does not meet the first preset condition, the training continues.
7. The path planning method based on ant colony algorithm and dynamic window according to claim 5, characterized in that: The first preset condition includes: After the second preset round of training, the loss values obtained in the next round of training are greater than or equal to the loss values that occurred during the second preset round of training.
8. The path planning method based on ant colony algorithm and dynamic window according to claim 1, characterized in that: The method of using the ant colony algorithm for global path planning and using the extension tree random optimization method to optimize the ant colony algorithm includes: Assume that the total number of ants is M, the pheromone between nodes is represented by the matrix Pheromone, the optimal path length is BestLength, the optimal path is BestTour, each ant has its own memory to store the nodes that the ant has visited, thereby avoiding the ant from searching the node for the second time; in addition, a node table allowed to be visited is established to represent the nodes visited by the ant, and a matrix is used to store the pheromone information released by the path passed by the ant in one iteration; assume that the algorithm runs Maxgen times in total, and the current number of iterations is t; The steps are as follows: Step a, parameter initialization setting; The number of ants is k, the pheromone inspiration factor is α, the expected inspiration factor is β, the pheromone volatility factor is ρ, and the pheromone intensity is Q; Step b, number of cycles t=t+1; Step c, the ant's taboo table index number k=1; Step d, the number of ants k = k + 1; Step e: The ant individual selects an element and moves forward according to the probability calculated by the state transition probability formula. The probability distribution of the starting point is calculated according to the following formula: where t ij is the pheromone volatilization between node i and node j, η ij is a heuristic function; Step f, modify the taboo table pointer, that is, after selecting, move the ant to a new node, and move the node to the taboo table of the ant individual; Step g, update pheromone, the pheromone update formula is as follows: Where Δt ij represents the sum of pheromones released by all ants on the path; Step h: If the maximum number of iterations Maxgen is reached, the algorithm terminates and outputs the first path; otherwise, go to step b.
9. A path planning system based on ant colony algorithm and dynamic window, characterized in that: The path planning method based on ant colony algorithm and dynamic window according to any one of claims 1 to 8 is adopted, and the path planning system based on ant colony algorithm and dynamic window comprises: An acquisition module is used to obtain the serial number of each production equipment near the first moving path by using the preset environment map of the production line, and then obtain the current production tasks of each production equipment that the AGV handling robot will pass in sequence during the movement along the first path in the MES system to form a production task list; and is used to obtain the first path of the AGV handling robot for the next handling task and the production task list corresponding to the first path after the model training is completed; The control module is used to construct a preset environment map of the production line, divide the preset environment map into several grid areas by adopting a grid modeling strategy, use an ant colony algorithm for global path planning, and use an extended tree random optimization method to optimize the ant colony algorithm, thereby realizing the global static path planning of the AGV handling robot and obtaining a first moving path; and is used to collect the depth image data of the front by using a depth camera arranged on the AGV handling robot during the movement of the AGV handling robot according to the preset handling route, process the collected data, use the processed depth camera data to judge the passable window according to the preset judgment rule, formulate a travel rule based on the judgment result, and when the AGV handling robot follows the first moving path and the formulated The robot moves according to the travel rules, and after completing the handling task, obtains the first moving path, the actual moving path and the production task list of the AGV handling robot, which are recorded as a path coupling data set, obtains a preset number of path coupling data sets, and divides the collected path coupling data sets into a training data set and a verification data set according to a first preset ratio; it is used to train the path automatic tuning model using the collected training data set, and optimize the path automatic tuning model using the verification data set, optimize the model parameters, and complete the path automatic tuning model training; it is used to input the first path corresponding to the next handling task and the production task list corresponding to the first path into the path automatic tuning model when the model training is completed, and use the path output by the model as the optimal path.
Citation Information
Patent Citations
Household robot path planning system and method based on Internet of Things technology
CN114740870A
Vehicle dynamic path planning method and system based on improved RRT
CN115373384A