Obstacle Avoidance for Automated Guided Vehicles in Real-World Workshops Using the Grid Method and Deep Learning

: An automated guided vehicle (AGV) obstacle avoidance system based on the grid method and deep learning algorithm is proposed, aiming at the complex and dynamic environment in the industrial workshop of a tobacco company. The deep learning object detection is used to detect obstacles in real-time for the AGV, and feasible paths are generated by the grid method, which ultimately ﬁnds an AGV obstacle avoidance solution in complex dynamic environments. The experimental results showed that the proposed system can effectively identify and avoid obstacles in a simulated tobacco production workshop environment, resulting in the average obstacle avoidance success rate of 98.67%. The transportation efﬁciency of cigarette factories is signiﬁcantly improved with the proposed system, reducing the average execution time of handing tasks by 27.29%. This paper expects to provide a reliable and efﬁcient solution for AGV obstacle avoidance in real-world industrial workshops.


Introduction
With the rapid development of modern manufacturing, automation technology is used widely in more and more scenarios.Due to the complex and dynamic environmental conditions inside cigarette factories, mechanical transportation and manual operation are no longer sufficient to meet production needs.AGVs can be used in cigarette factories in order to improve efficiency and quality, as they can run autonomously according to the program and transfer items back and forth during cigarette production.However, there are often many obstacles that hinder the movement of AGVs within cigarette factories, such as pillars, packaging boxes, or other production equipment.The operation of AGVs may be prevented by these obstacles, as they may collide with other equipment or employees in severe cases, leading to serious accidents and even the delay of production.Therefore, it is necessary to study an efficient AGV obstacle avoidance system based on complex and dynamic background conditions in the tobacco industry.
AGV obstacle avoidance technologies have been explored and developed in different ways.Gonzalez et al. [1] introduced the obstacle avoidance techniques implemented in the intelligent vehicle literature and discussed their contributions to provide comprehensive references for studies in relevant fields.At present, obstacle avoidance based on sensors is the most commonly used technique.The objects around AGVs can be detected by sensors, which determine whether to avoid them.Information such as object position, shape, and distance is detected by the sensors, like laser rangefinder, ultrasonic sensor, the shortest transportation time as the objective function is established, and an improved particle swarm optimization (IPSO) algorithm is proposed to obtain the optimal path.In order to solve path planning problems, the researchers proposed an encoding method based on this algorithm, designed a crossover operation to update particle positions, and adopted a mutation mechanism to avoid the algorithm falling into local optimal positions.Huang et al. [11] used a novel motion planning and tracking framework for automated vehicles, which relied on the artificial potential field elaborated resistance network approach.They provided several case studies to show the effectiveness of the proposed framework.
With the development of artificial intelligence technology, more researchers have applied it to the motion plan of automated vehicles [12,13].For example, Akopov et al. proposed a novel parallel real-coded genetic algorithm and combined it with fuzzy clustering to approximate the optimal parameters of the multiagent fuzzy transportation system in the reference [14,15].They demonstrated that the proposed method effectively improves the maneuverability of automated vehicles.Deep learning uses its feature-learning ability and accelerated training technique to recognize and analyze objects in the environment, which helps AGVs avoid obstacles [16].Target detection algorithms are widely used in AGV obstacle avoidance systems, such as YOLO, Faster R-CNN, and SSD.The objects can be detected and recognized by these algorithms in real-time, providing efficient and accurate obstacle avoidance solutions for AGVs.The sonar detection of image targets based on deep learning technology was studied by Yu [17], and corresponding algorithms for improvement and functional implementation were designed in response to the current shortcomings and needs in this field.Various methods for acoustic image denoising based on multi resolution tools was proposed firstly, the natural image was divided into blocks at an appropriate rate according to the changes in the sampling matrix, and underwater natural images were measured finally.The neural networks and convolutional neural network algorithms in deep learning were studied by Su et al. [18], and an object detection system based on these two algorithms was constructed to test the treated sewage.On the basis of YOLOv3 detection network, the improved network retaining the original basic features of the detection network was optimized and validated by Xiao et al. [19] in the context of intestinal endoscopy.By comparing the hash values of the images, the redundant images are filtered out, and the final concise detection results are presented to the doctors.A smart city object detection algorithm combining deep learning and feature extraction for the phenomenon of occlusion in smart cities was proposed by Wang et al. [20].An adaptive strategy is proposed, which optimizes the search window of the algorithm based on the traditional SSD algorithm.The weighted correlation feature fusion method was combined with the algorithm according to the changes of the target working conditions which improves the accuracy of the objective function.A deep learning-based human track and field object detection and tracking method was proposed by Zhang et al. [21].The background subtraction based on an adaptive mixed Gaussian background model was used to detect targets.The video image was denoised and smoothed, and the holes in the foreground area were removed by morphological filtering.The connected areas of the binary image were analyzed to obtain the number and location of the connected areas.The area ratio and length-width ratio of the human body were used to classify and identify human bodies, so as to complete the detection of human track and field sport targets.Based on the structure of deep learning, the method was combined with the detection results of deep learning and LK tracking.PN learning was used to modify the parameters of the superimposed automatic coding machine, which avoids detection errors in deep learning, and finally realized the track and field tracking of humans.The deep learning object detection algorithm is widely used in underwater image detection, medical image detection, smart city object detection, and other fields, and has significant advantages in universality and applicability.
To sum up, to address the complex and dynamic environment problem inside the cigarette factory, an AGV obstacle avoidance system combining the grid method and deep learning algorithm is proposed in this paper.Deep learning is used as an object detection algorithm to detect obstacles in real time for AGVs.The grid method is suitable for many irregular and discontinuous working areas, as it can deal with the scene containing many obstacles and many restrictions properly.
The structure of this article is as follows: the background and research status of this article is introduced in Section 1; the proposed AGV obstacle avoidance system is introduced in Section 2; the on-site test results are described in Section 3; and the conclusion is drawn in Section 4.

Working Principle of AGV Obstacle Avoidance System
The AGV obstacle avoidance system in this paper is mainly composed of a camera, a visual AI platform, a demonstration system, an AGV scheduling system, and an AGV car controller.The deep learning object detection algorithm was used by the system to detect obstacles.At the same time, a grid-based path planning method was used to generate a feasible path suitable for the AGV, and the car movement was controlled by dispatching system to avoid obstacles.The AGV obstacle avoidance application architecture and data flow are shown in Figure 1.The detailed flow is as follows: (1) Video images of the AGV passage in the tobacco production workshop are obtained through cameras.(2) The object detection algorithm is used to analyze whether there are obstacles in the image after the image is obtained on the visual AI basic platform, and the obstacles are pushed to the AGV scheduling system.(3) The grid method is used to plan the route after obtaining obstacle information, and the optimal route is pushed to the AGV.(4) The real-time position information of the AGV is pushed to the control module on the AGV through the RS232 interface.The corresponding operation according to the control instructions is performed by the AGV; the information is sent to the basic platform through the 5G network for real-time position and video display of the AGV.To sum up, to address the complex and dynamic environment problem inside the cigare e factory, an AGV obstacle avoidance system combining the grid method and deep learning algorithm is proposed in this paper.Deep learning is used as an object detection algorithm to detect obstacles in real time for AGVs.The grid method is suitable for many irregular and discontinuous working areas, as it can deal with the scene containing many obstacles and many restrictions properly.
The structure of this article is as follows: the background and research status of this article is introduced in Section 1; the proposed AGV obstacle avoidance system is introduced in Section 2; the on-site test results are described in Section 3; and the conclusion is drawn in Section 4.

Working Principle of AGV Obstacle Avoidance System
The AGV obstacle avoidance system in this paper is mainly composed of a camera, a visual AI platform, a demonstration system, an AGV scheduling system, and an AGV car controller.The deep learning object detection algorithm was used by the system to detect obstacles.At the same time, a grid-based path planning method was used to generate a feasible path suitable for the AGV, and the car movement was controlled by dispatching system to avoid obstacles.The AGV obstacle avoidance application architecture and data flow are shown in Figure 1.The detailed flow is as follows: (1) Video images of the AGV passage in the tobacco production workshop are obtained through cameras. (2)The object detection algorithm is used to analyze whether there are obstacles in the image after the image is obtained on the visual AI basic platform, and the obstacles are pushed to the AGV scheduling system. (3)The grid method is used to plan the route after obtaining obstacle information, and the optimal route is pushed to the AGV.(4) The real-time position information of the AGV is pushed to the control module on the AGV through the RS232 interface.The corresponding operation according to the control instructions is performed by the AGV; the information is sent to the basic platform through the 5G network for real-time position and video display of the AGV.Brand: Rocla, Järvenpää, Finland; model: AWT16F S1400; guidance mode: laser; communication mode: 5g/WIFI; transfer mode: fork type; walking speed: 0~2 m/s; minimum turning radius: 1800 mm; repetition accuracy: ±5 mm; safety protection: safe laser obstacle avoidance and safety contact.
The autonomous movement obstacle avoidance of the AGV can be realized through the cooperation of different systems, such as the camera's acquisition of scene information, the visual AI platform algorithm's processing and visual display of the demonstration system, as well as the coordination of the AGV's own scheduling system and controller.

Obstacle Detection
Deep learning object detection algorithms are used by the system to detect obstacles in real-time.With high accuracy, the object detection algorithms, such as YOLO, Faster R-CNN, and SSD, can detect and recognize objects in real-time.The system uses the YOLO algorithm to detect obstacles in the environment, as shown in Figure 2. The YOLO algorithm divides the environment into multiple grids and detects objects in each grid.The YOLO algorithm can detect multiple objects in real-time and provide accurate object information, such as position and size.
The autonomous movement obstacle avoidance of the AGV can be realized throug the cooperation of different systems, such as the camera's acquisition of scene information the visual AI platform algorithm's processing and visual display of the demonstratio system, as well as the coordination of the AGV's own scheduling system and controller.

Obstacle Detection
Deep learning object detection algorithms are used by the system to detect obstacle in real-time.With high accuracy, the object detection algorithms, such as YOLO, Faster R CNN, and SSD, can detect and recognize objects in real-time.The system uses the YOLO algorithm to detect obstacles in the environment, as shown in Figure 2. The YOLO algo rithm divides the environment into multiple grids and detects objects in each grid.Th YOLO algorithm can detect multiple objects in real-time and provide accurate object in formation, such as position and size.The YOLO (You Only Look Once) algorithm is an object detection algorithm based on convolutional neural networks.The YOLO algorithm has advantages such as fast speed, high accuracy, and end-to-end training, compared to traditional object detection algorithms such as R-CNN.
A single neural network is used by the YOLO algorithm to simultaneously predict the category and position information of multiple targets in the image.The prediction workflow is as follows: Step 1. Place images on the network for processing.
Step 2. Two bounding boxes are received by each grid after dividing the environment into 49 grids.
Step 3. Multiply the class information predicted by each grid with the confidence information predicted by the bounding boxes to obtain the probability of each candidate box predicting a specific object and the probability of position overlap PrIOU.The value of the equal sign on the right side in Equation ( 1) is PrIOU.
Step 4. Sort PrIOUs, remove PrIOUs below the threshold, and then perform nonmaximum suppression for each category.
The non-maximum suppression mentioned here refers to selecting the candidate box with the highest confidence; it will be deleted if the overlapping area IOU with the current highest scoring candidate box exceeds a certain threshold.

Path Planning
The feasible paths for AGVs can be generated by path planning based on the grid in the system.The layout of the cigarette factory is shown in Figure 3 (left).As shown in Figure 3, the yellow box represents the AGV path, the black box represents the packaging car room, and the red box represents the AGV platform within the packaging unit.The packaging unit is shown in Figure 3 (right).The AGV needs to carry out the transportation task according to the AGV path to the platform of the target site, if the unit is the target site.The entire rolling car room was divided into four areas with a total of 16 grids based on the factory environment in terms of the path planning.The obstacle avoidance area diagram is shown in Figure 4.The A* algorithm was used to generate feasible paths for the AGV at the same time, which is mainly used to generate the shortest path from the current position of the AGV to the target position, while also considering obstacles and constraints in the grid map, as shown in Figure 5.
With good performance and accuracy, the A* (A Star) algorithm is commonly used for path finding and graph traversal.
The priority of each node was calculated by the A* algorithm through the following Formula (2).
where f (n) is the comprehensive priority of node n; the node with the highest comprehensive priority (minimum value) was always chosen when choosing the next node to traverse.g(n) is the cost of the distance between node n and the starting point; h(n) is the estimated cost of the distance from node n to the endpoint, which is the heuristic function of the A* algorithm.
The node with the lowest value of f (n) (the highest priority) from the priority queue was selected as the next node to be traversed each time during the operations by the A* algorithm.
In addition, two sets were used by the A* algorithm to represent the nodes to be traversed, and the nodes that have already been traversed, which are commonly referred to as open_ set and close_ set.With good performance and accuracy, the A* (A Star) algorithm is commonly used for path finding and graph traversal.
The priority of each node was calculated by the A* algorithm through the following Formula (2).
where f(n) is the comprehensive priority of node n; the node with the highest comprehensive priority (minimum value) was always chosen when choosing the next node to traverse.g(n) is the cost of the distance between node n and the starting point; h(n) is the estimated cost of the distance from node n to the endpoint, which is the heuristic function of the A* algorithm.
The node with the lowest value of f(n) (the highest priority) from the priority queue was selected as the next node to be traversed each time during the operations by the A* algorithm.
In addition, two sets were used by the A* algorithm to represent the nodes to be traversed, and the nodes that have already been traversed, which are commonly referred to as open_ set and close_ set.

Obstacle Avoidance Control
The AGV scheduling system was used to adjust the speed and direction of the AGV.By communicating with the control module of the AGV, the scheduling system sends control instructions to the AGV, and controls parameters such as the movement and speed of the AGV.The AGV scheduling system can achieve the following aspects of control: (1) Motion control: the direction of AGV travel, including forward, backward, left turn, right turn, etc., can be controlled by the scheduling system in order to achieve path planning and task scheduling.(2) Speed control: the driving speed of AGVs can be controlled by the scheduling system to adjust according to task requirements, such as acceleration and deceleration.

Obstacle Avoidance Control
The AGV scheduling system was used to adjust the speed and direction of the AGV.By communicating with the control module of the AGV, the scheduling system sends control instructions to the AGV, and controls parameters such as the movement and speed of the AGV.The AGV scheduling system can achieve the following aspects of control: (1) Motion control: the direction of AGV travel, including forward, backward, left turn, right turn, etc., can be controlled by the scheduling system in order to achieve path planning and task scheduling.(2) Speed control: the driving speed of AGVs can be controlled by the scheduling system to adjust according to task requirements, such as acceleration and deceleration.(3) Parking control: the parking and starting of AGVs can be controlled by the scheduling system to achieve tasks such as pausing and resuming.(4) Emergency stop control: emergency stop instructions are sent by the dispatch system to avoid accidents in a timely manner when an emergency situation occurs, such as obstacles, personnel, etc.
The remote and autonomous control of AGVs can be achieved by the scheduling system through the controls listed above in order to achieve logistics automation and intelligence, which improve production and logistics efficiency, and reduce labor and operational costs.

Rules of AGV Obstacle Avoidance System 2.5.1. Obstacle Discrimination Rules
The video obtained from the tobacco production workshop camera in this design is circulated to the visual AI basic platform for obstacle identification.The obstacle identification rules are as follows: (1) Filter out suspicious obstacles detected by deep learning and filter out pedestrian categories; (2) Confirm the type of obstacle and obtain the coordinates O i = {o i1 , o i2 ,. .., o im } of the corresponding obstacle, where i represents the large area monitored by the camera.The rules are as follows: If the obstacle category is AGV, it is directly determined as an obstacle.
If the obstacle category is other, calculate the obstacle's residence time.It is determined as an obstacle if the residence time exceeds the threshold.

Obstacle Positioning Rules
An obstacle needs to be located to facilitate the transmission of the obstacle's location information to the scheduling system for route planning when a suspicious object is identified as an obstacle.The rules for obstacle positioning are as follows: (1) Each camera monitors a large area, and each large area is preset with several small cells.The coordinates of the preset small areas are A i = {a j1 , a j2 ,. .., a jn }, where i represents the large area monitored by the camera and j represents the preset number of small cells for each large area.(2) After confirming the category of obstacles, convert the coordinates O i = {o i1 , o i2 ,. .., o im } of the corresponding obstacles to an area S i = {s i1 , s i2 ,. .., s im }. (3) Convert the coordinates A i = {a j1 , a j2 ,. .., a jn } of several small regions to the region area Q i = {q j1 , q j2 ,. .., q jn }. (4) Calculate the area of obstacles and the area of several small areas to obtain the proportion of obstacles in each small area.The formula is as follows: (5) Position the obstacle at its maximum proportion; the proportion is greater than the threshold α.

Regional Division and Obstacle Avoidance Routes
The AGV obstacle avoidance area of the tobacco production workshop was divided into several large areas with several lines using the grid method.The left and right sides are the main road, which are shared for both the up and down directions of the obstacle avoidance line in the middle.Each region is further subdivided into several small communities as obstacle avoidance areas.The obstacle avoidance route diagram is shown in Figure 6.

Obstacle Avoidance Rules
The corresponding obstacle avoidance rules were formulated by the AGV conditional automatic navigation obstacle avoidance mechanism for 8 actual production environments when encountering obstacles.
Obstacle avoidance rule 1: for the situation where there are obstacles on the main

Obstacle Avoidance Rules
The corresponding obstacle avoidance rules were formulated by the AGV conditional automatic navigation obstacle avoidance mechanism for 8 actual production environments when encountering obstacles.
Obstacle avoidance rule 1: for the situation where there are obstacles on the main road and the target platform for AGV delivery is in the same horizontal area as the obstacles, the AGV continues to move towards the main road until the infrared module of the car triggers a stop and waits for the obstacles to be removed, as shown in Figure 7.

Obstacle Avoidance Rules
The corresponding obstacle avoidance rules were formulated by the AGV conditional automatic navigation obstacle avoidance mechanism for 8 actual production environments when encountering obstacles.
Obstacle avoidance rule 1: for the situation where there are obstacles on the main road and the target platform for AGV delivery is in the same horizontal area as the obstacles, the AGV continues to move towards the main road until the infrared module of the car triggers a stop and waits for the obstacles to be removed, as shown in Figure 7.  Obstacle avoidance rule 2: for situations where there are obstacles on the main road, but the target platform is in the area in front of the obstacle area, the car should follow the main road and deliver goods normally, as shown in Figure 8. Obstacle avoidance rule 2: for situations where there are obstacles on the main road, but the target platform is in the area in front of the obstacle area, the car should follow the main road and deliver goods normally, as shown in Figure 8. Obstacle avoidance rule 3: for the situation where there are obstacles on the main road and the target platform for AGV delivery is in the same area as the obstacles, the car follows the main route until the infrared module of the car triggers a stop and waits for the obstacles to be removed, as shown in Figure 9. Obstacle avoidance rule 3: for the situation where there are obstacles on the main road and the target platform for AGV delivery is in the same as the obstacles, the car follows the main route until the infrared module of the car triggers a stop and waits for the obstacles to be removed, as shown in Figure 9. Obstacle avoidance rule 3: for the situation where there are obstacles on the main road and the target platform for AGV delivery is in the same area as the obstacles, the car follows the main route until the infrared module of the car triggers a stop and waits for the obstacles to be removed, as shown in Figure 9. Obstacle avoidance rule 4: for the situation where there are obstacles on the main road and the target platform is behind the area where the obstacles are located, the car first turns into the obstacle avoidance route and then goes back to the main road, as shown in Figure 10.Obstacle avoidance rule 4: for the situation where there are obstacles on the main road and the target platform is behind the area where the obstacles are located, the car first turns into the obstacle avoidance route and then goes back to the main road, as shown in Figure 10.Obstacle avoidance rule 5: for the situation that there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are in the same horizontal area, the car continues on the main road until the infrared module of the car triggers a stop, and waits for the obstacles on the main road to be removed, as shown in Figure 11.Obstacle avoidance rule 6: for the situation where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car continues to follow the obstacle avoidance route and then returns to the main route, as shown in Figure 12.Obstacle avoidance rule 5: for the situation that there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are in the same horizontal area, the car continues on the main road until the infrared module of the car triggers a stop, and waits for the obstacles on the main road to be removed, as shown in Figure 11.Obstacle avoidance rule 5: for the situation that there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are in the same horizontal area, the car continues on the main road until the infrared module of the car triggers a stop, and waits for the obstacles on the main road to be removed, as shown in Figure 11.Obstacle avoidance rule 6: for the situation where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car continues to follow the obstacle avoidance route and then returns to the main route, as shown in Figure 12.Obstacle avoidance rule 6: for the situation where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car continues to follow the obstacle avoidance route and then returns to the main route, as shown in Figure 12.Obstacle avoidance rule 6: for the situation where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car continues to follow the obstacle avoidance route and then returns to the main route, as shown in Figure 12.Obstacle avoidance rule 7: for situations where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car follows the main route, as shown in Figure 13.Obstacle avoidance rule 7: for situations where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car follows the main route, as shown in Figure 13.Obstacle avoidance rule 8: for situations where there are obstacles on the main road and the platform is not currently in that area (obstacles are in A1 or A4, and the target platform is not in Area A), the car should follow the main route, as shown in Figure 14.Obstacle avoidance rule 8: for situations where there are obstacles on the main road and the platform is not currently in that area (obstacles are in A1 or A4, and the target platform is not in Area A), the car should follow the main route, as shown in Figure 14.Obstacle avoidance rule 7: for situations where there are obstacles on both the main road and the obstacle avoidance path, and the obstacles are not in the same horizontal area, the car follows the main route, as shown in Figure 13.Obstacle avoidance rule 8: for situations where there are obstacles on the main road and the platform is not currently in that area (obstacles are in A1 or A4, and the target platform is not in Area A), the car should follow the main route, as shown in Figure 14.

Introduction of Test Conditions
Experiments were conducted to evaluate the performance of the proposed AGV obstacle avoidance system.A tobacco production workshop environment was used to simulate the movement and obstacle avoidance of AGVs.Various obstacles were included in the environment, such as boxes, machines, and other AGVs.
As shown in Figure 16, in this study, the AGV obstacle avoidance area was divided into four major areas, A, B, C, and D, with a total of three lines.The left and right sides are the main road, which are shared for both the up and down directions of the obstacle avoidance line in the middle.Each major region is further subdivided into six small communities, with a total of 24 obstacle avoidance point areas.The video streams are transmi ed to the AI vision platform by the camera in the corresponding region, and the obstacle information is transmi ed to the AGV dispatching system through the obstacle discrimination rules and positioning rules.The route is naturalized by obstacle avoidance rules and AGV avoidance rules, and the obstacle information is transmi ed to the demonstration screen for display.

Introduction of Test Conditions
Experiments were conducted to evaluate the performance of the proposed AGV obstacle avoidance system.A tobacco production workshop environment was used to simulate the movement and obstacle avoidance of AGVs.Various obstacles were included in the environment, such as boxes, machines, and other AGVs.
As shown in Figure 16, in this study, the AGV obstacle avoidance area was divided into four major areas, A, B, C, and D, with a total of three lines.The left and right sides are the main road, which are shared for both the up and down directions of the obstacle avoidance line in the middle.Each major region is further subdivided into six small communities, with a total of 24 obstacle avoidance point areas.The video streams are transmitted to the AI vision platform by the camera in the corresponding region, and the obstacle information is transmitted to the AGV dispatching system through the obstacle discrimination rules and positioning rules.The route is naturalized by obstacle avoidance rules and AGV avoidance rules, and the obstacle information is transmitted to the demonstration screen for display.

Introduction of Test Conditions
Experiments were conducted to evaluate the performance of the proposed AGV obstacle avoidance system.A tobacco production workshop environment was used to simulate the movement and obstacle avoidance of AGVs.Various obstacles were included in the environment, such as boxes, machines, and other AGVs.
As shown in Figure 16, in this study, the AGV obstacle avoidance area was divided into four major areas, A, B, C, and D, with a total of three lines.The left and right sides are the main road, which are shared for both the up and down directions of the obstacle avoidance line in the middle.Each major region is further subdivided into six small communities, with a total of 24 obstacle avoidance point areas.The video streams are transmi ed to the AI vision platform by the camera in the corresponding region, and the obstacle information is transmi ed to the AGV dispatching system through the obstacle discrimination rules and positioning rules.The route is naturalized by obstacle avoidance rules and AGV avoidance rules, and the obstacle information is transmi ed to the demonstration screen for display.

Comparison of Test Data
The comparison results before and after the transformation are shown in Tables 1-3.The average total number of tasks was 385, and the average execution time of AGV's handling tasks was 10.96 min before the renovation, as shown in Table 1.The average total

Comparison of Test Data
The comparison results before and after the transformation are shown in Tables 1-3.The average total number of tasks was 385, and the average execution time of AGV's handling tasks was 10.96 min before the renovation, as shown in Table 1.The average total number of tasks was 397, the execution time was reduced to 8.61 min, and the efficiency was improved by 27.29% after the renovation.The frequency of the AGV being blocked by obstacles was about 9.69% of the total number of tasks, and the average obstacle avoidance success rate of the AGV reached 98.67%, as shown in Table 2.The results indicate that the handling efficiency of the AGV has been significantly improved.
It should be noted that the average number of tasks after the renovation did not significantly increase due to limitations in the workshop production process, which means that the total number of tasks is basically fixed under the established production task conditions.As can be seen from the 10-day data tables before and after the transformation, there are significant differences between the maximum average number of tasks and the minimum average number of tasks, but the difference before and after the transformation is not large, which means that the process difference was caused by production, rather than the AGV obstacle avoidance system or the ability of the AGV system to improve.

Conclusions
An AGV obstacle avoidance system was proposed based on the grid method and deep learning algorithm for the complex and dynamic environment of tobacco production workshops.The path planning and object detection algorithms were adopted by the system based on the grid method to provide real-time obstacle avoidance solutions for AGVs in complex and dynamic environments.The performance of the proposed system was tested in a simulated tobacco production workshop environment.The final experimental results are as follows: (1) The proposed AGV obstacle avoidance system can improve the handling efficiency of the AGV.The average execution time of the AGV's handling tasks was 10.96 min before the renovation.The average execution time was reduced to 8.61 min after the renovation.By comparison, it can be found that the system improves handling efficiency by 27.29%.(2) The proposed AGV obstacle avoidance system can effectively identify and avoid obstacles.The frequency of the AGV being blocked by obstacles accounted for 9.69% of the total number of tasks, and the average obstacle avoidance success rate of the AGV could reach 98.67%.
In future work, the AGV obstacle avoidance system will be used to execute handling tasks in different tobacco production workshops and explore the sensitivity of performance metrics to values of obstacle parameters.Moreover, automated warehousing systems, automated manufacturing systems, and off-site transportation systems will be integrated to make connections tighter between each system, so as to further improve the work efficiency of cigarette factories.

Figure 3 .
Figure 3. AGV implementation diagram of the cigare e factory (left: the layout of the cigare e factory; right: the unit method diagram).

Figure 4 .
Figure 4. Diagram of the obstacle avoidance area.

Figure 3 . 17 Figure 3 .
Figure 3. AGV implementation diagram of the cigarette factory (left: the layout of the cigarette factory; right: the unit method diagram).

Figure 4 .
Figure 4. Diagram of the obstacle avoidance area.Figure 4. Diagram of the obstacle avoidance area.

Figure 4 .
Figure 4. Diagram of the obstacle avoidance area.Figure 4. Diagram of the obstacle avoidance area.

Figure 5 .
Figure 5. Path planning of the A* algorithm.

Figure 5 .
Figure 5. Path planning of the A* algorithm.

Figure 14 .Figure 13 .
Figure 14.Obstacle avoidance rule 8. 2.5.5.Rules for Avoidance of AGVs The corresponding avoidance rules were established by the AGV conditional automatic navigation obstacle avoidance mechanism for actual production environments when encountering AGVs: If both AGVs in the upper and lower directions of the same area enter the obstacle Electronics 2023, 12, x FOR PEER REVIEW 13 of 17

Figure 16 .
Figure 16.The monitoring diagram of the AGV scheduling equipment in the packaging workshop.

Figure 16 .
Figure 16.The monitoring diagram of the AGV scheduling equipment in the packaging workshop.

Figure 16 .
Figure 16.The monitoring diagram of the AGV scheduling equipment in the packaging workshop.

Table 3 .
Comparison of sample average data before and after renovation.