Disclosure of Invention
In view of the above, it is desirable to provide a method, an apparatus, a device and a storage medium for planning a partitioned full coverage path, so as to solve the problems of more partitioned sub-regions and poor planning effect caused by using a cell decomposition method in the prior art.
In order to achieve the technical purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for planning a sub-area full coverage path, which is applied to an intelligent tracking device, and includes:
constructing a grid cost map according to the environmental information and the positioning information of the intelligent tracing equipment;
converting the grid cost map into a common pixel map;
dividing the normal pixel map into a plurality of sub-regions;
and determining a first path of each sub-area in the respective area and a second path between the sub-areas, and determining the optimal path of the intelligent tracking device according to the first path and the second path.
Preferably, converting the grid cost map into a normal pixel map comprises:
and converting point to point into a common pixel map according to the occupation state of the internal space of the grid in the grid cost map.
Preferably, determining the first path of each sub-region within the respective region comprises:
determining the range of the sub-region as the range of the region with the specific shape according to a preset rule;
and acquiring a full-coverage minimum round-trip path of the intelligent tracing device in the range of the specific shape area, wherein the full-coverage minimum round-trip path is a first path.
Preferably, the specific shape is a polygon, and acquiring a full-coverage minimum round-trip path of the intelligent tracking device in the specific shape area range specifically includes:
selecting the longest edge of the polygon as a reference edge, and selecting the vertex farthest from the reference edge as a target point;
and the analog intelligent tracking device reciprocates along the direction parallel to the reference edge until the intelligent tracking device reaches the target point.
Preferably, the simulating the intelligent tracking device performs a back-and-forth movement along a direction parallel to the reference edge until the intelligent tracking device reaches the target point, and specifically includes:
setting intelligent tracing equipment to move from any vertex of the reference edge to a polygonal first abutting edge along a first direction according to a preset step pitch;
after moving a preset distance along the first abutting edge, setting the intelligent tracking equipment to move to a polygonal second abutting edge along a second direction according to a preset step pitch;
and repeating the process until the intelligent tracking device reaches the target point.
Preferably, determining a second path connecting the sub-regions comprises:
and determining two end points of the first path in all the sub-areas, moving the simulated intelligent tracking equipment from the starting position to one end point of the first path in any sub-area, and moving the simulated intelligent tracking equipment from the other end point to one end point of the first path in the next sub-area until all the sub-areas are connected, wherein the path connecting all the sub-areas is the second path.
Preferably, determining the optimal path of the intelligent tracking device comprises:
and determining the shortest second path, wherein the shortest second path and the first path are the optimal paths of the intelligent tracking equipment.
In a second aspect, the present invention further provides a path planning apparatus, including:
the construction module is used for constructing a grid cost map according to the environment information and the positioning information of the intelligent tracing equipment;
the conversion module is used for converting the grid cost map into a common pixel map;
a segmentation module for dividing the common pixel map into a plurality of sub-regions;
and the planning module is used for determining a first path of each sub-area in the respective area and a second path between the sub-areas, and determining the optimal path of the intelligent tracking equipment according to the first path and the second path.
In a third aspect, the present invention also provides an electronic device comprising a memory and a processor, wherein,
a memory for storing a program;
and the processor is coupled with the memory and used for executing the program stored in the memory so as to realize the steps in the partition area full coverage path planning method in any one of the implementation modes.
In a fourth aspect, the present invention further provides a computer-readable storage medium, configured to store a computer-readable program or instruction, where the program or instruction, when executed by a processor, can implement the steps in the partition area full coverage path planning method in any one of the above implementations.
The beneficial effects of adopting the above embodiment are: the method for planning the full-coverage path of the subareas converts the grid cost map into the pixel map, divides the subareas by selecting the pixel points on the pixel map, is simple and convenient to operate, improves the dividing precision, can accurately divide the subareas, freely controls the sizes of the subareas, can generate the subareas in any number and any positions, plans the path by a unit dividing method, reduces the data processing amount, can reduce unnecessary round trip even facing complex terrain, has less information stored in each subarea, and is convenient to calculate and process.
Detailed Description
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate preferred embodiments of the invention and together with the description, serve to explain the principles of the invention and not to limit the scope of the invention.
In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention provides a method, a device, equipment and a storage medium for planning a sub-area full-coverage path, which are respectively explained below.
Referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of a method for planning a full coverage path of a partitioned area according to the present invention, the method including:
s101, constructing a grid cost map according to the environment information and the positioning information of the intelligent tracing equipment;
s102, converting the grid cost map into a common pixel map;
s103, dividing the common pixel map into a plurality of sub-regions;
s104, determining a first path of each sub-area in the respective area and a second path between the sub-areas, and determining the optimal path of the intelligent tracking device according to the first path and the second path.
In step S101, the intelligent tracking device may be an intelligent tracking robot, an intelligent tracking car, or the like. In one embodiment, the intelligent tracking device is a sweeping robot that approximates a spherical structure. A grid cost map refers to the partitioning of an environment into a series of grids, where each grid is given a possible value, representing the probability that the grid is occupied. In a specific embodiment, the environmental information of the sweeping robot is obtained through the laser radar, the positioning information of the sweeping robot is obtained through the odometer, and the position of the obstacle is marked when the grid cost map is constructed according to the environmental information and the positioning information of the sweeping robot. Specifically, the obstacle refers to an obstacle that is permanently added to the map when the map is created. The construction method of the grid cost map is the prior art, the specific construction process is not described again, and the construction method of the grid cost map is not limited in this embodiment.
Further, a grid cost map of the environment where the sweeping robot is located is constructed through a mapping method of a Robot Operating System (ROS), which is the prior art and is not described herein again.
In step S102, the present invention provides a specific embodiment, the grid cost map is reassembled by an OpenCV algorithm, where OpenCV is a cross-platform computer vision library issued based on BSD license (open source), and each grid in the grid cost map is converted point to point into a common pixel map according to the occupied condition of each grid in the grid cost map, so as to facilitate the division of subsequent sub-regions and path planning.
In step S103, please refer to fig. 2, fig. 2 is a dividing effect diagram of an embodiment of dividing a general pixel map into a plurality of sub-areas according to the present invention, not all areas of a field need to be cleaned, but only an area to be cleaned needs to be divided, so as to meet the cleaning requirement, and the cleaning area is clear, and the clear area is more convenient to clean.
In step S104, a first path inside each barrier-free sub-area is planned by a unit segmentation method, after the planning of the first path inside each barrier-free sub-area is completed, an end point of the path inside each barrier-free sub-area is connected with a start point of a path inside a subsequent barrier-free sub-area, a path connecting all sub-areas is a second path, and a shortest total path is calculated, which is an optimal path plan of the sweeping robot.
Compared with the prior art, the method for planning the full-coverage path by the sub-regions converts the grid cost map into the pixel map, divides the sub-regions by selecting the pixel points on the pixel map, is simple and convenient to operate, improves the dividing precision, can accurately divide the sub-regions, freely controls the sizes of the sub-regions, plans the path by the unit division method, reduces the data processing amount, can reduce unnecessary round trip even facing complex terrains, has less information stored in each sub-region, and is convenient to calculate and process.
In some embodiments of the invention, converting the grid cost map into a normal pixel map comprises:
and converting point to point into a common pixel map according to the occupation state of the internal space of the grid in the grid cost map.
In the above embodiment, the grid cost map is a costmap grid cost map, one grid in the costmap grid cost map represents a part of area of actual terrain, and the probability of existence of an obstacle is represented by using gray-scale values, wherein occupied space of the grid in the costmap grid cost map is represented by 1, and unoccupied space is represented by 0, and the costmap grid cost map is converted into a common pixel map by point points according to the occupied state of the grid in the costmap grid cost map. And performing graying processing on the ordinary pixel map to obtain an ordinary pixel grayscale map, wherein the area represented by the grid marked as 1 is converted into black, and the area represented by the grid marked as 0 is converted into white. The pixel map simply and directly shows the occupation state of the located grid, each grid only stores the position and the occupation information, and the cleaning area is more conveniently divided.
Specifically, in an embodiment provided by the present invention, based on a Robot Operating System (ROS), the costmap grid cost map is recombined into a common pixel map according to a possible value of each grid in the costmap grid cost map by an OpenCV algorithm, and graying is performed on the common pixel map, where graying of the pixel map belongs to the prior art and is not described herein.
Referring to fig. 3, fig. 3 is a schematic flow chart of an embodiment of determining a first path of each sub-region in a respective region according to the present invention, where in some embodiments of the present invention, determining the first path of each sub-region in the respective region includes:
s301, determining the range of the sub-region as a specific shape region range according to a preset rule;
s302, acquiring a full-coverage minimum round-trip path of the intelligent tracking device in a specific shape area range, wherein the full-coverage minimum round-trip path is a first path.
In step S301, the preset rule is that a user freely selects a pixel point by using a Robot Operating System (ROS) according to the actual situation of the site to be cleaned and through an initialization function of OpenCV, and an area to be cleaned is marked out. The regions directly composed of the pixels are various and not beneficial to the planning of the path, and in a specific embodiment provided by the invention, the cleaning region needs to be approximated into a polygonal region.
In step S302, a full-coverage cleaning of the polygonal area is required, that is, a full-coverage path plan of the sweeping robot in the polygonal area is determined, and in order to reduce unnecessary cleaning, a minimum full-coverage round-trip path of the sweeping robot, that is, a first path in the polygonal area, is required to be determined.
Referring to fig. 4, fig. 4 is a schematic flowchart of an embodiment of the step S302 in fig. 3 according to the present invention, in some embodiments of the present invention, the specific shape is a polygon, and the step S302 specifically includes:
s401, selecting the longest edge of a polygon as a reference edge, and selecting the vertex farthest from the reference edge as a target point;
s402, simulating the intelligent tracking device to move back and forth along the direction parallel to the reference edge until the intelligent tracking device reaches a target point.
In step S401, a coordinate system is established on the ordinary pixel map, and the vertex of the polygon area is determined clockwise, i.e. the range of the polygon area can be determined, because the sweeping robot has a certain volume, the radius of the sweeping robot needs to be expanded on the polygon boundary to form a new polygon area, and a line segment function of the new polygon area boundary is calculated through a Robot Operating System (ROS), so that the longest side of the polygon area is determined, and the longest side is set as a reference side, and can be intersected with other boundaries inevitably when moving parallel to the longest side, thereby facilitating the simulation of the intersection point with the side in the polygon area boundary. And calculating the vertex farthest from the reference edge, wherein the point is the end point of the path in the polygonal area, and the number of times of the sweeping robot to make a round trip in the polygonal area can be determined according to the point and the size of the sweeping robot.
In step S402, the starting point of the sweeping robot may be a boundary connecting the left end point of the reference edge or a boundary connecting the right end point of the reference edge, which is not further limited in the embodiment provided by the present invention, and the sweeping robot moves parallel to the reference edge until reaching the target point, so that the shortest path planning of the full coverage in the polygonal area can be implemented.
In an embodiment of the present invention, the polygon area is mainly a quadrilateral area, because the quadrilateral can complete coverage of most terrains, and the planning calculation amount is small.
Referring to fig. 5, fig. 5 is a schematic flowchart of an embodiment of the step S402 in fig. 4 according to the present invention, where in some embodiments of the present invention, the step S402 specifically includes:
s501, setting intelligent tracking equipment to move from any vertex of a reference edge to a polygonal first abutting edge along a first direction according to a preset step pitch;
s502, after moving a preset distance along the first abutting edge, setting the intelligent tracing device to move to a polygonal second abutting edge along a second direction according to a preset step pitch;
and S503, repeating the process until the intelligent tracking device reaches the target point.
In step S501, the sweeping robot of an embodiment of the present invention is a sphere structure, and the radius of the sweeping robot is used as a preset step pitch, please refer to fig. 6, where fig. 6 is a schematic diagram of an embodiment of a first path plan in a sub-area provided by the present invention, a distance from the sweeping robot to a reference edge by one step pitch may be a left vertex or a right vertex starting from any vertex of the reference edge, the left vertex or the right vertex is selected as the starting point of the embodiment of the present invention, the first direction is a direction moving from the left vertex to an abutting edge a, the sweeping robot moves in parallel to the reference edge along the first direction, the distance of one step pitch is moved each time until the first abutting edge a is reached, the first abutting edge a is a boundary of the sub-area connecting the right endpoint of the reference edge, one step pitch may determine a navigation point, and the sweeping robot moves along the navigation point, so that the parallel motion can be accurately carried out according to the planned path.
In step S502, referring to fig. 6, to implement the planning of the full coverage path in the area, when the sweeping robot reaches the first abutting edge a, the sweeping robot needs to translate a preset distance equidistantly along the first abutting edge a, in this embodiment, the preset distance is set to be a distance of one step pitch, so as to avoid repeatedly cleaning a certain area when the sweeping robot moves back and forth, in the embodiment, the second direction is a direction moving from the abutting edge a to the abutting edge c, and then the sweeping robot still translates equidistantly to the second abutting edge c in a direction parallel to the second direction along the reference edge by using the preset step pitch as a unit until the sweeping robot reaches the second abutting edge c. Specifically, the first direction and the second direction are two completely opposite directions.
In step S503, each time the sweeping robot reaches a butting edge, the sweeping robot translates along the butting edge at equal intervals by a step distance, then moves parallel to the reference edge to the opposite butting edge, and repeats the process until the sweeping robot finally reaches a target point in the area, that is, the sweeping robot realizes the full coverage path planning in the area parallel to the reference edge.
In some embodiments of the invention, determining the second path between the sub-regions comprises:
and determining two end points of the first path in all the sub-areas, moving the simulated intelligent tracking equipment from the starting position to one end point of the first path in any sub-area, and moving the simulated intelligent tracking equipment from the other end point to one end point of the first path in the next sub-area until all the sub-areas are connected, wherein the path connecting all the sub-areas is the second path.
In the above embodiment, the Robot Operating System (ROS) determines two end points of the first path of each sub-region in each sub-region according to the first path in each sub-region, where an initial position of the sweeping robot is a start position, the sweeping robot starts from the start position, moves to one end point of the first path of any sub-region, then moves to another end point of the first path according to the planned first path, and then moves to one end point of the first path of the next sub-region, and the movement is repeated until all sub-regions are connected, so as to obtain multiple second path plans connecting the sub-regions. The order of the end points connecting the first paths in the respective sub-regions is not further limited, but all sub-regions must be covered, and each sub-region can only be included once except in the case where the sub-regions need to be repeatedly divided.
In some embodiments of the invention, determining the optimal path for the intelligent tracking device comprises:
and determining the shortest second path, wherein the shortest second path and the first path are the optimal paths of the intelligent tracking equipment.
Specifically, the optimal path is actually a path in which the first path and the second path are connected to form a shortest curve, and after the optimal path is determined, the intelligent tracking device (such as a sweeping robot) can sweep the to-be-swept area in a full coverage manner within a shortest time without touching an obstacle.
Referring to fig. 7, fig. 7 is a planning effect diagram of an embodiment of optimal path planning provided by the present invention, a Robot Operating System (ROS) simulates and plans a second path, has multiple planning schemes for the second path, calculates all lengths of the second path, and finds a shortest path planning scheme, which is the optimal second path planning scheme, where the optimal second path and the first paths in all sub-regions together form the optimal path planning scheme for the sweeping robot.
In order to better implement the method for planning a full coverage path of a sub-area in the embodiment of the present invention, on the basis of the method for planning a full coverage path of a sub-area, please refer to fig. 8, where fig. 8 is a schematic structural diagram of an embodiment of a path planning apparatus provided in the present invention, an embodiment of the present invention provides apath planning apparatus 800, including:
theconstruction module 801 is used for constructing a grid cost map according to the environment information and the positioning information of the intelligent tracing equipment;
aconversion module 802, configured to convert the grid cost map into a common pixel map;
asegmentation module 803, configured to divide the normal pixel map into a plurality of sub-regions;
theplanning module 804 is configured to determine a first path of each sub-area in the respective area and a second path between the sub-areas, and determine an optimal path of the intelligent tracking device according to the first path and the second path.
Here, it should be noted that: thepath planning apparatus 800 provided in the foregoing embodiment may implement the technical solutions described in the foregoing method embodiments, and the specific implementation principles of the modules or units may refer to the corresponding contents in the foregoing method embodiments, which are not described herein again.
Specifically, referring to fig. 9, fig. 9 is a schematic diagram of hardware connection of a sweeping robot according to an embodiment of the present invention, and the sweeping robot according to the embodiment of the present invention is a sweeping robot, and the sweeping robot includes acentral information processor 901, a bottomlayer motion controller 902, a bottomlayer motion driver 903, alaser radar 904, and aodometer 905.
Further, the robot for sweeping provided in the embodiment of the present invention obtains surrounding environment information through thelaser radar 904, records positioning information through theodometer 905, sends the environment information and the positioning information to thecentral information processor 901, constructs a grid cost map through a Robot Operating System (ROS), converts the grid cost map into a common pixel map through thecentral information processor 901, divides a plurality of initialized sub-areas by selecting pixel points through a user, determines a first path of each sub-area and a second path between each sub-area according to a unit division method through thecentral information processor 901 after the division is completed, determines an optimal path of the robot for sweeping according to the first path and the second path, screens out point locations in the path as target points, converts the point locations into a starting grid location map, and converts the optimal path into a data structure format which can be issued by the ROS system, corresponding topics are issued in the ROS system, then a motion control command is sent to the bottomlayer motion controller 902, then the bottomlayer motion controller 902 sends a PWM speed signal to the bottomlayer motion driver 903, and the sweeping robot moves to a target point and cleans according to a planned path.
It should be noted that thecentral information processor 901 may be a computer, a microcomputer, or the like, and only needs to be a MCU capable of installing a Linux system and having a certain calculation power, and in this embodiment, thecentral information processor 901 is a microcomputer, and has a Robot Operating System (ROS) inside, which can perform information fusion. The bottomlayer motion controller 902 can be a 51-chip microcomputer or a 32-chip microcomputer, and only needs to meet the control requirement, and the selection of the bottomlayer motion controller 902 is not further limited by the invention. The bottomlayer motion driver 903 comprises a storage battery, a motor and the like, wherein the used storage battery only needs to drive the motor to normally operate, the specific model of the storage battery is not further limited, the used motor only needs to meet the power requirement of the sweeping robot, and the specific model of the motor is not further limited. Thelaser radar 904 is a radar system that detects a characteristic amount, such as a position, a speed, and the like, of a target by emitting a laser beam, and obtains information about the target, such as environmental information around the target, by emitting a detection signal to the target, comparing a received signal reflected from the target with the emission signal, and appropriately processing the signal. Thelidar 904 has various models, for example, sixteen-line mechanical lidar and four-line solid-state lidar, and the embodiment only requires thelidar 904 to be capable of detecting the environment around the sweeping robot in 360 degrees in an all-around manner, and the specific model is not further limited. Theodometer 905 is a device that is mounted on the sweeping robot and measures the travel and the speed, and the specific model of theodometer 905 is not further limited as long as theodometer 905 of the embodiment can record the positioning information of the sweeping robot.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the invention. Based on the method for planning the full-coverage path by the subareas, the invention also correspondingly provides a path planning device which can be a mobile terminal, a desktop computer, a notebook computer, a palm computer, a server and other computing devices. The path planning device includes aprocessor 1010, amemory 1020, and adisplay 1030. Fig. 10 shows only some of the components of the electronic device, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Thememory 1020 may in some embodiments be an internal storage unit of the path planning device, such as a hard disk or a memory of the path planning device. Thememory 1020 may also be an external storage device of the path planning apparatus in other embodiments, such as a plug-in hard disk provided on the path planning apparatus, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on. Further, thememory 1020 may also include both an internal storage unit of the path planning device and an external storage device. Thememory 1020 is used for storing application software installed in the path planning apparatus and various data, such as program codes for installing the path planning apparatus. Thememory 1020 may also be used to temporarily store data that has been output or is to be output. In an embodiment, thememory 1020 stores apath planning program 1040, and thepath planning program 1040 can be executed by theprocessor 1010, so as to implement the method for planning a full coverage path in a partitioned area according to the embodiments of the present application.
Processor 1010, which in some embodiments may be a Central Processing Unit (CPU), microprocessor or other data Processing chip, is configured to run program code stored inmemory 1020 or process data, such as executing a partition-based full-coverage path planning method.
Thedisplay 1030 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, and the like in some embodiments. Thedisplay 1030 is used to display information at the path planning apparatus and to display a visual user interface. Thecomponents 1010 and 1030 of the path planning apparatus communicate with each other via a system bus.
In one embodiment, the steps in the partitioned area full coverage path planning method described above are implemented when theprocessor 1010 executes thepath planning program 1040 in thememory 1020.
Those skilled in the art will appreciate that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware, and the program may be stored in a computer-readable storage medium. The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are also included in the scope of the present invention.