Full-coverage path planning method based on wavefront algorithm, spraying method and device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JILIN UNIVERSITY
- Filing Date
- 2022-11-17
- Publication Date
- 2026-06-02
Smart Images

Figure CN116201325B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of wall spraying technology, and in particular to a full-coverage path planning method, spraying method and device based on wavefront algorithm. Background Technology
[0002] Since the introduction of robotics into the painting industry in the 1990s, the industry has primarily employed methods such as teach-in programming and offline programming for painting. However, current methods of controlling robotic painting require manual operation by personnel. The operator's experience directly impacts the painting quality; insufficient experience can lead to issues such as thin or thick coatings. Furthermore, most painting equipment requires manual inspection after completion. The toxicity of the paint used exposes operators to environments containing toxic gases, posing a serious health hazard. Therefore, utilizing path planning methods to achieve automated painting is essential.
[0003] However, existing technologies still need to be improved and enhanced. Summary of the Invention
[0004] The technical problem to be solved by this application is to provide a full-coverage path planning method, spraying method and device based on wavefront algorithm to address the shortcomings of the existing technology.
[0005] To address the aforementioned technical problems, the first aspect of this application provides a full-coverage path planning method based on the wavefront algorithm, the method comprising:
[0006] Acquire a target image of the spraying target, and rasterize the target image to obtain a raster image;
[0007] The initial and final grids in the grid image are obtained, and the wavefront algorithm is used to spread outward from the final grid to assign grid attribute values to each grid.
[0008] The spraying path is determined by heuristic rules, prioritizing the grid attribute values of each grid.
[0009] The full-coverage path planning method based on the wavefront algorithm, wherein the step of using the wavefront algorithm to spread outward from the terminating grid to assign grid attribute values to each grid specifically includes:
[0010] Set the raster attribute value of the terminating raster to 0;
[0011] Obtain the neighboring grids of the termination grid and set the grid attribute value of the neighboring grids to 1;
[0012] Get the adjacent unassigned rasters of each raster with a raster attribute value of 1, and set the raster attribute value of the adjacent unassigned rasters to 2, and so on until the wavefront reaches the initial raster.
[0013] The full-coverage path planning method based on the wavefront algorithm, wherein the method further includes: obtaining the adjacent unassigned graticets of each graticet with a graticet attribute value of 1, and setting the graticet attribute value of the adjacent unassigned graticets to 2, and so on, until the wavefront reaches the initial graticet;
[0014] For each grid cell in the raster image, detect the image region where the grid cell is located;
[0015] When the grid is in the spraying area, the grid attribute value of the grid remains unchanged;
[0016] When the grid is in a non-sprayed area, the grid attribute value of the grid is set to a preset attribute value, wherein the preset attribute value is less than the grid attribute value of any grid in the sprayed area.
[0017] The full-coverage path planning method based on wavefront algorithm, wherein, before obtaining the initial and final grids in the raster image, and assigning raster attribute values to each grid by using the wavefront algorithm to diffuse outward from the final grid as the starting point, the method further includes:
[0018] The target image is segmented to determine the sprayed area and non-sprayed area corresponding to the target image.
[0019] The full-coverage path planning method based on the wavefront algorithm, wherein after rasterizing the target image to obtain a raster image, the method further includes:
[0020] Obtain a target grid in the grid image where some grid areas are in the spraying area and some grid areas are in the non-spraying area;
[0021] The grid areas in the target grid that are in the spraying area are etched so that all grid areas of the target grid are in the non-spraying area.
[0022] The full-coverage path planning method based on the wavefront algorithm, wherein determining the spraying path using heuristic rules with priority based on the grid attribute values of each grid cell specifically includes:
[0023] Use the initial grid as the current path point;
[0024] Obtain the raster attribute value of the target raster corresponding to the current path point, wherein the target raster and the raster corresponding to the current path point are located in the same raster row or the same raster column;
[0025] Based on the obtained grid attribute values of each target grid and the positional relationship between the target grid and the grid corresponding to the current path point, the grid activity corresponding to each target grid is calculated.
[0026] The target grid cell with the highest grid activity is selected as the next path point, and the grid attribute value of the target grid cell with the highest grid activity is adjusted based on the preset value, wherein the adjusted grid attribute value = the grid attribute value before adjustment - the preset value;
[0027] The next path point is taken as the current path point, and the process of obtaining the grid attribute value of the target grid corresponding to the current path point continues until the grid is terminated, so as to obtain the spraying path.
[0028] In the full-coverage path planning method based on the wavefront algorithm, the preset value is greater than or equal to 3.
[0029] A second aspect of this application provides a spraying method, the method comprising:
[0030] The spraying path is determined using the wavefront-based full-coverage path planning method described above.
[0031] Spray the target according to the spraying path.
[0032] A third aspect of this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the wavefront-based full-coverage path planning method described above, and / or the steps in the spraying method described above.
[0033] A fourth aspect of this application provides a terminal device, which includes: a processor, a memory, and a communication bus; the memory stores a computer-readable program that can be executed by the processor;
[0034] The communication bus enables communication between the processor and the memory;
[0035] When the processor executes the computer-readable program, it implements the steps in the full-coverage path planning method based on the wavefront algorithm as described above, and / or the steps in the spraying method described above.
[0036] Beneficial Effects: Compared with existing technologies, this application provides a full-coverage path planning method, spraying method, and apparatus based on wavefront algorithm. The method includes: acquiring a target image of the spraying target and rasterizing the target image to obtain a raster image; acquiring initial and final grids in the raster image, and using the final grid as the starting point to assign grid attribute values to each grid by spreading outward using the wavefront algorithm; and determining the spraying path using heuristic rules with priority based on the grid attribute values of each grid. This application achieves automatic determination of the spraying path for a full-coverage spraying target by using the wavefront algorithm to spread outward to assign grid attribute values to each grid and then determining the spraying path with priority based on the grid attribute values. This allows the robot to automatically complete the spraying of the target, thus reducing reliance on the operator's experience and avoiding the impact of spraying on the operator's health. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 A flowchart of the full-coverage path planning method based on the wavefront algorithm provided in this application.
[0039] Figure 2 A schematic diagram of a raster image used to determine the initial and final raster grids.
[0040] Figure 3 A schematic diagram of a raster image to which raster attribute values are assigned.
[0041] Figure 4 This is a schematic diagram of the spraying path.
[0042] Figure 5 The structural principle diagram of the full-coverage path planning system based on the wavefront algorithm provided in this application.
[0043] Figure 6 A schematic diagram of the terminal device provided in this application. Detailed Implementation
[0044] This application provides a full-coverage path planning method, spraying method, and apparatus based on wavefront algorithm. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.
[0045] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0046] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0047] It should be understood that the sequence number and size of each step in this embodiment do not imply the order of execution. The execution order of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of this application embodiment.
[0048] The inventors discovered through research that since the introduction of robotics into the painting industry in the 1990s, the industry has primarily employed methods such as teach-in programming and offline programming for painting. However, existing methods of controlling robotic painting require manual operation by personnel. The operator's experience directly impacts the painting quality; insufficient experience can lead to issues such as thin or thick coatings. Furthermore, most painting equipment requires manual inspection after completion. The toxicity of the paint used exposes operators to environments containing toxic gases, posing serious health risks. Therefore, utilizing path planning methods to achieve automated painting is essential.
[0049] To address the aforementioned issues, this application embodiment acquires a target image of the target to be sprayed and rasterizes the target image to obtain a raster image. Initial and terminating graticules are acquired from the raster image, and a wavefront algorithm is used to spread outwards from the terminating graticule to assign graticule attribute values to each graticule. The spraying path is determined using heuristic rules, prioritizing the graticule attribute values of each graticule. This application achieves automatic determination of the spraying path for a fully covered target by employing a wavefront algorithm to assign graticule attribute values to each graticule and then prioritizing the graticule attribute values to determine the spraying path. This allows the robot to automatically complete the spraying of the target, reducing reliance on the operator's experience and avoiding the impact of spraying on the operator's health.
[0050] The application content will be further explained below with reference to the accompanying drawings and through the description of the embodiments.
[0051] This embodiment provides a full-coverage path planning method based on the wavefront algorithm, such as... Figure 1 As shown, the method includes:
[0052] S10. Obtain the target image of the spraying target and rasterize the target image to obtain a raster image.
[0053] Specifically, the target image is obtained by capturing the spraying target using an imaging device. The image content of the target image includes the spraying target, which can be a wall or similar surface. For example, the target image can be obtained by capturing the image using a camera carried by a robot performing the spraying task. When the spraying target is a wall, the target image can be obtained by capturing the image of the wall using a camera carried by the robot performing the spraying task.
[0054] The grid in a raster image can be a square grid, where the grid length is determined based on the robot's position in the painting task; for example, the grid length is equal to the robot's position. Of course, in practical applications, the grid can use other shapes. For example, when the robot's horizontal and vertical positions are not equal, the grid can be a rectangle with the horizontal position as its width and the vertical position as its height.
[0055] Furthermore, to ensure the target image can be precisely divided into several grids, meaning the image size of the target image is divisible by the grid size, the resolution of the target image can be set during image capture to ensure it can be divided into several grids. Additionally, if the image size of the target image cannot be divisible by the grid size, the last image region that does not meet the grid size requirement can be removed. The removed grid region can then be used as the next grid region for subsequent operations. The removed region can be repainted after the existing grid image has been painted. In this embodiment, the case where the image size of the target image is divisible by the grid size is explained.
[0056] Furthermore, in practical applications, items that do not require spraying may be located on the target surface. For example, if the target is a wall with doors, windows, and electrical boxes, then these items do not need to be sprayed. Therefore, when acquiring the target image, image segmentation is required to determine the sprayable and non-sprayable areas to avoid accidentally spraying non-sprayable areas. Based on this, the method further includes:
[0057] The target image is segmented to determine the sprayed area and non-sprayed area corresponding to the target image.
[0058] Specifically, the sprayed area and the non-sprayed area constitute the target image. The non-sprayed area is the image region containing items that do not need to be sprayed, and the sprayed area is the image region excluding the items that do not need to be sprayed. Therefore, the sprayed area can be used as the region of interest (ROI) to segment the target image and obtain the ROI. Image segmentation can employ edge detection algorithms or deep learning methods. In a typical implementation, image segmentation is achieved using a trained deep learning model. The input to the deep learning model is the target image, and the output is a segmented image labeled with the ROI. The deep learning model can be constructed using algorithms such as FCN, UNet, and DeepLab.
[0059] In one implementation, during the rasterization of the target image, grids may appear that include both sprayed and non-sprayed areas. Spraying these grids may result in accidental spraying onto non-sprayed areas. Therefore, after obtaining the raster image, grids that include both sprayed and non-sprayed areas can be corrected to avoid accidental spraying onto non-sprayed areas. Based on this, the method further includes:
[0060] Obtain a target grid in the grid image where some grid areas are in the spraying area and some grid areas are in the non-spraying area;
[0061] The grid areas in the target grid that are in the spraying area are etched so that all grid areas of the target grid are in the non-spraying area.
[0062] Specifically, some image regions in the target grid are included in non-sprayed areas, and some image regions are included in sprayed areas. To avoid the problem of accidentally spraying non-sprayed areas when spraying the target grid, the entire image region corresponding to the target grid can be treated as a non-sprayed area. That is, the grid regions in the target grid that are within the sprayed area can be eroded to convert the sprayed area into a non-sprayed area. In this way, when the robot sprays the target, it will not spray the target area corresponding to the target grid, thereby avoiding accidental spraying of items that do not need to be sprayed in the target, thus improving the spraying quality. In one implementation, the erosion of the grid regions in the sprayed area of the target grid can be performed directly using the erosion function erode() in the OpenCV library to operate on the target grid in the grid image, so that the grid regions in the sprayed area of the target grid are eroded. Alternatively, the dilate() function in the OpenCV library can be used directly to dilate the grid regions in the non-sprayed area of the target grid to convert the grid regions in the sprayed area into non-sprayed areas.
[0063] S20. Obtain the initial grid and the termination grid in the grid image, and use the wavefront algorithm to spread outward from the termination grid to assign grid attribute values to each grid.
[0064] Specifically, both the initial grid and the ending grid are grid cells within a raster image, with one located in the first row and the other in the last row. For example, the top row of the raster image can be considered the first row, and the bottom row the last row; the initial grid could be in the first row, and the ending grid the last row, or vice versa. In a typical implementation, since the spraying process generally begins from the top left, thus... Figure 2 As shown, the first non-obstacle area grid in the first row is used as the initial grid, and a non-obstacle area grid in the last row is randomly selected as the ending grid.
[0065] The grid attribute value reflects the distance between a given grid and the terminating grid. This distance refers to the minimum number of grids the terminating grid must traverse to reach a given grid; this minimum number of grids is equal to the grid attribute value. This grid attribute value is used as a priority to determine the order in which grids are traversed along the spraying path. Furthermore, when determining grid attribute values, one method is to obtain the shortest grid path from the terminating grid to each grid, or a wavefront algorithm can be used to determine the grid attribute values by diffusing outwards from the terminating grid.
[0066] In one implementation, the step of using a wavefront algorithm to diffuse outwards from the terminating grid to assign grid attribute values to each grid specifically includes:
[0067] Set the raster attribute value of the terminating raster to 0;
[0068] Obtain the neighboring grids of the termination grid and set the grid attribute value of the neighboring grids to 1;
[0069] Get the adjacent unassigned rasters of each raster with a raster attribute value of 1, and set the raster attribute value of the adjacent unassigned rasters to 2, and so on until the wavefront reaches the initial raster.
[0070] Specifically, starting from the terminating grid, the grid attribute value of the terminating grid is set to 0. Adjacent grids refer to the grids surrounding the terminating grid. You can directly move from the terminating grid to its adjacent grid, and the grid attribute value of the adjacent grid is equal to the terminating grid's grid attribute value + 1. Since the terminating grid's grid attribute value is set to 0, the grid attribute value of the adjacent grids of the terminating grid is 1. After setting the grid attribute value of the adjacent grids of the terminating grid to 1, the grid with a grid attribute value of 1 is used as the target grid. The search is conducted for the target grid's adjacent unassigned grids, and the grid attribute value of the found adjacent unassigned grids is set to 2. That is, the grid attribute value of the target grid's adjacent unassigned grids = the target grid's grid attribute value + 1. This process continues until the wavefront reaches the initial grid, and grid attribute values are assigned to each grid, such as... Figure 3 As stated above.
[0071] From the above calculation process of raster attribute values, we can derive that the formula for calculating raster attribute values can be expressed as:
[0072] sj+1=sj+1
[0073] Among them, s j The raster attribute values for the raster cells that have already been assigned raster attribute values, s j+1 For s j The raster attribute values of the adjacent unassigned raster cells of the corresponding raster.
[0074] In one implementation, since the target image may contain non-sprayed areas, and the spraying path needs to avoid these areas, after assigning grid attribute values to the grid cells in the grid image, the grid attribute values of the cells located in the non-sprayed areas need to be corrected. This ensures that when determining the path based on grid attribute values, the grid cells in the non-sprayed areas are not traversed. Based on this, the method further includes: obtaining the neighboring grid cells of each grid cell with a grid attribute value of 1, setting the grid attribute value of the neighboring grid cells to 2, and so on until the wavefront reaches the initial grid.
[0075] For each grid cell in the raster image, detect the image region where the grid cell is located;
[0076] When the grid is in the spraying area, the grid attribute value of the grid remains unchanged;
[0077] When the grid is in a non-sprayed area, the grid attribute value of the grid is set to a preset attribute value, wherein the preset attribute value is less than the grid attribute value of any grid in the sprayed area.
[0078] Specifically, the sprayed and non-sprayed areas have been labeled through image segmentation, allowing each grid to be identified as either a sprayed or non-sprayed area. After image segmentation and labeling, grids that fall into both sprayed and non-sprayed areas are corrected to fall entirely into the non-sprayed area. Thus, in the overall grid image, each grid is either solely within a sprayed area or solely within a non-sprayed area. Of course, in practical applications, when the target image does not include non-sprayed areas (i.e., all entities corresponding to the target image require spraying), image segmentation and grid attribute correction are unnecessary. Furthermore, preset attribute values can be pre-set and are less than the grid attribute value of any grid within the sprayed area; for example, preset attribute values could be -10, -15, etc.
[0079] S30. Prioritize the grid attribute values of each grid and determine the spraying path using heuristic rules.
[0080] Specifically, the spraying path covers all grid cells in the grid image that are within the spraying area. Based on the spraying path, the spraying area can be fully covered by spraying, for example, as... Figure 4 The painting path is shown. Priority refers to the degree of priority of the grid in the process of determining the painting path; for example, the larger the grid attribute value, the higher the priority for calculating its grid activity value through heuristic rules.
[0081] In one implementation, determining the spraying path using heuristic rules with priority based on the grid attribute values of each grid cell specifically includes:
[0082] Use the initial grid as the current path point;
[0083] Get the raster attribute value of the target raster corresponding to the current path point;
[0084] Based on the obtained grid attribute values of each target grid and the positional relationship between the target grid and the grid corresponding to the current path point, the grid activity corresponding to each target grid is calculated.
[0085] The target grid with the highest grid activity is selected as the next path point, and the grid attribute value of the target grid with the highest grid activity is adjusted based on the preset value, wherein the adjusted grid attribute value = the grid attribute value before adjustment - the preset value;
[0086] The next path point is taken as the current path point, and the process of obtaining the grid attribute value of the target grid corresponding to the current path point continues until the grid is terminated, so as to obtain the spraying path.
[0087] Specifically, the target grid and the grid corresponding to the current path point are located in the same grid row or column. This means the acquired target grid includes the grid to the left, right, top, and bottom of the grid corresponding to the current path point. This selection is based on the fact that when a robot performs painting, it can generally move in four directions around the grid: up, down, left, and right. Therefore, when determining the next path point, it can select from the four adjacent grids (up, down, left, and right), facilitating subsequent painting by the robot according to the painting path. Of course, in practical applications, all adjacent grids surrounding the grid corresponding to the current path point can also be used as target grids. For example, if the current path point is located in the center of a 3x3 grid, all eight adjacent grids can be used as target grids, meaning the robot can move in eight directions.
[0088] The positional relationship can be the angle between the movement direction corresponding to the current path point and the movement direction from the current path point to the target grid. The movement direction corresponding to the current path point is the movement direction from the previous path point to the current path point. Of course, in practical applications, the positional relationship can be the position and direction of the target grid relative to the current path point in the grid image, such as being to the left of the current path point, to the right of the current path point, etc. After obtaining the positional direction, a preset angle corresponding to each target grid can be determined based on the preset correspondence between the positional direction and the preset angle.
[0089] Grid activity value reflects the probability that a grid cell will be used as the next path point. A higher grid activity value indicates a higher probability of being used as the next path point, and vice versa. In one implementation, the heuristic formula for calculating grid activity value can be:
[0090]
[0091] Where, r j f represents the grid activity value. j Represents the raster attribute value, Δθ j This represents the angle value corresponding to the positional relationship, where 'a' is a known parameter, such as 0.5.
[0092] Of course, it is worth noting that in practical applications, the grid activity value can also be calculated in other ways. For example, the grid activity value is equal to the sum of the grid attribute value of the target grid and the angle value corresponding to the positional relationship. In the typical implementation of this embodiment, the above formula is used to calculate the grid activity value.
[0093] Furthermore, adjusting the raster attribute value of the target raster with the highest raster activity based on a preset value means subtracting the preset value from the raster attribute value of the target raster with the highest raster activity, while the raster attribute values of other rasteres remain unchanged. This can be understood as the raster attribute value of a raster used as a path point being corrected to the difference between the raster attribute value and the preset value, while the raster attribute values of rasteres not used as path points remain unchanged. Therefore, the update rule for raster attribute values can be:
[0094]
[0095] Among them, f j Indicates the raster attribute value, s j This represents the raster attribute value before the update, d represents the preset attribute value, and c represents the preset value.
[0096] In one implementation, the preset attribute value d remains the grid attribute value for the non-painted area, and the preset value c is greater than or equal to 3. By using the difference between the grid attribute value and the preset value as the updated grid attribute value, the robot can avoid repeatedly covering the same grid under heuristic rules, thus preventing an infinite loop. Simultaneously, it increases the "attraction" of uncovered grids to the robot, thereby improving the accuracy of the painting path. This is because when other preset values are selected, the painting path cannot be accurately determined. In a typical implementation, the preset value is 3.
[0097] In summary, this embodiment provides a full-coverage path planning method, spraying method, and apparatus based on wavefront algorithm. The method includes: acquiring a target image of the spraying target and rasterizing the target image to obtain a raster image; acquiring initial and final grids in the raster image, and using the final grid as the starting point to assign grid attribute values to each grid by spreading outward using the wavefront algorithm; and determining the spraying path using heuristic rules with priority based on the grid attribute values of each grid. This application achieves automatic determination of the spraying path for a full-coverage spraying target by using the wavefront algorithm to spread outward to assign grid attribute values to each grid and then determining the spraying path with priority based on the grid attribute values. This allows the robot to automatically complete the spraying of the target, thus reducing reliance on the operator's experience and avoiding the impact of spraying on the operator's health.
[0098] Based on the aforementioned full-coverage path planning method based on the wavefront algorithm, this embodiment provides a spraying method, the method comprising:
[0099] The spraying path is determined using the wavefront-based full-coverage path planning method described above.
[0100] Spray the target according to the spraying path.
[0101] Based on the aforementioned wavefront-based full-coverage path planning method, this embodiment provides a wavefront-based full-coverage path planning system, such as... Figure 5 As shown, the system includes:
[0102] An acquisition module is used to acquire a target image of the spraying target and rasterize the target image to obtain a raster image.
[0103] The assignment module is used to obtain the initial grid and the termination grid in the grid image, and to assign grid attribute values to each grid by using the wavefront algorithm to diffuse outward from the termination grid.
[0104] The determination module is used to determine the spraying path based on the grid attribute values of each grid and through heuristic rules.
[0105] Based on the above-described wavefront-based full-coverage path planning method, this embodiment provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the wavefront-based full-coverage path planning method described in the above embodiment.
[0106] Based on the aforementioned wavefront-based full-coverage path planning method, this application also provides a terminal device, such as... Figure 6As shown, it includes at least one processor 20; a display screen 21; and a memory 22, and may also include a communications interface 23 and a bus 24. The processor 20, display screen 21, memory 22, and communications interface 23 can communicate with each other via the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setup mode. The communications interface 23 can transmit information. The processor 20 can invoke logical instructions in the memory 22 to execute the methods described in the above embodiments.
[0107] Furthermore, the logical instructions in the aforementioned memory 22 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0108] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, such as program instructions or modules corresponding to the methods in the embodiments of this disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions, or modules stored in the memory 22, thereby implementing the methods in the above embodiments.
[0109] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 22 may include high-speed random access memory (RAM) and non-volatile memory. Examples include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, as well as transient storage media.
[0110] Furthermore, the specific process of loading and executing multiple instruction processors in the aforementioned storage medium and terminal device has been described in detail in the above method, and will not be repeated here.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A full-coverage path planning method based on wavefront algorithm, characterized in that, The method includes: Acquire a target image of the spraying target, and rasterize the target image to obtain a raster image; The initial and final grids in the grid image are obtained, and the wavefront algorithm is used to spread outward from the final grid to assign grid attribute values to each grid. The spraying path is determined by heuristic rules, prioritizing the grid attribute values of each grid. Specifically, the step of using the wavefront algorithm to diffuse outward from the terminating grid to assign grid attribute values to each grid includes: Set the raster attribute value of the terminating raster to 0; Obtain the neighboring grids of the termination grid and set the grid attribute value of the neighboring grids to 1; Get the adjacent unassigned rasters of each raster with a raster attribute value of 1, and set the raster attribute value of the adjacent unassigned rasters to 2, and so on until the wavefront reaches the initial raster; The method of determining the spraying path using heuristic rules based on the grid attribute values of each grid cell specifically includes: Use the initial grid as the current path point; Obtain the raster attribute value of the target raster corresponding to the current path point, wherein the target raster and the raster corresponding to the current path point are located in the same raster row or the same raster column; Based on the obtained grid attribute values of each target grid and the positional relationship between the target grid and the grid corresponding to the current path point, the grid activity corresponding to each target grid is calculated. The target raster with the highest raster activity is selected as the next path point, and the raster attribute value of the target raster with the highest raster activity is adjusted based on the preset value, wherein the adjusted raster attribute value = the raster attribute value before adjustment - the preset value; The next path point is taken as the current path point, and the process of obtaining the grid attribute value of the target grid corresponding to the current path point continues until the grid is terminated, so as to obtain the spraying path.
2. The full-coverage path planning method based on wavefront algorithm according to claim 1, characterized in that, The method further includes: obtaining the adjacent unassigned graticets of each graticet with a graticet attribute value of 1, and setting the graticet attribute value of the adjacent unassigned graticets to 2, and so on, until the wavefront reaches the initial graticet. For each grid cell in the raster image, detect the image region where the grid cell is located; When the grid is in the spraying area, the grid attribute value of the grid remains unchanged; When the grid is in a non-sprayed area, the grid attribute value of the grid is set to a preset attribute value, wherein the preset attribute value is less than the grid attribute value of any grid in the sprayed area.
3. The full-coverage path planning method based on wavefront algorithm according to any one of claims 1-2, characterized in that, Before acquiring the initial and final grids in the raster image, and assigning raster attribute values to each grid by using a wavefront algorithm to diffuse outward from the final grid, the method further includes: The target image is segmented to determine the sprayed area and non-sprayed area corresponding to the target image.
4. The full-coverage path planning method based on wavefront algorithm according to claim 3, characterized in that, After rasterizing the target image to obtain a raster image, the method further includes: Obtain a target grid in the grid image where some grid areas are in the spraying area and some grid areas are in the non-spraying area; The grid areas in the target grid that are in the spraying area are etched so that all grid areas of the target grid are in the non-spraying area.
5. The full-coverage path planning method based on wavefront algorithm according to claim 1, characterized in that, The preset value is greater than or equal to 3.
6. A spraying method, characterized in that, The method includes: The spraying path is determined using the full-coverage path planning method based on the wavefront algorithm as described in any one of claims 1-5; Spray the target according to the spraying path.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs that can be executed by one or more processors to implement the steps in the full-coverage path planning method based on the wavefront algorithm as described in any one of claims 1-5, and / or the steps in the spraying method as described in claim 6.
8. A terminal device, characterized in that, include: Processor, memory, and communication bus; the memory stores a computer-readable program that can be executed by the processor; The communication bus enables communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the full-coverage path planning method based on the wavefront algorithm as described in any one of claims 1-5, and / or the steps in the spraying method as described in claim 6.