Disclosure of Invention
The embodiment of the invention aims to provide a map creating method and device, electronic equipment and a storage medium, which can be used for performing auxiliary map creation by using an ultrasonic sensor, reduce the requirement on the number of laser radars installed on the electronic equipment, reduce the map creating cost and provide a foundation for realizing obstacle avoidance and navigation of a robot.
In order to solve the above technical problem, an embodiment of the present invention provides a map creating method, including: acquiring ultrasonic data transmitted by at least one ultrasonic sensor of the robot and laser radar data transmitted by at least one laser radar of the robot; for each grid of the blank obstacle map, respectively performing the following operations: judging whether an obstacle exists at the position indicated by the grid or not according to the laser radar data; if yes, determining that the grid is occupied; if not, determining whether the grid is occupied or not according to at least ultrasonic data; and obtaining the barrier grid map according to the occupation condition of each grid.
An embodiment of the present invention further provides a map creating apparatus, including: the device comprises an acquisition module, a determination module and a generation module; the acquisition module is used for: acquiring ultrasonic data transmitted by at least one ultrasonic sensor of the robot and laser radar data transmitted by at least one laser radar of the robot; the determination module is to: for each grid of the blank obstacle map, respectively performing the following operations: judging whether an obstacle exists at the position indicated by the grid or not according to the laser radar data; if yes, determining that the grid is occupied; if not, determining whether the grid is occupied or not according to at least ultrasonic data; the generation module is to: and obtaining the barrier grid map according to the occupation condition of each grid of the blank barrier map.
An embodiment of the present invention also provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the map creation method as mentioned in the above embodiments.
Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the map creation method mentioned in the above embodiments.
Compared with the prior art, the robot is provided with the ultrasonic sensor to assist the laser radar sensor of the robot to construct the image. Due to the fact that the ultrasonic sensor is low in cost and small in size, the ultrasonic sensor is used for assisting in drawing construction, requirements for the number of laser radars installed on electronic equipment can be lowered, drawing construction cost of the robot is lowered, and a foundation is provided for achieving obstacle avoidance and navigation of the robot.
Additionally, determining whether the grid is occupied based at least on the ultrasound data includes: judging whether the ultrasonic data indicate that the grid is occupied; if so, judging whether the coincidence degree of the ultrasonic data corresponding to the grid and the laser radar data corresponding to the grid is greater than a threshold value; if the grid is determined to be larger than the threshold value, determining that the grid is not occupied, and if the grid is determined to be not larger than the threshold value, determining that the grid is occupied; if not, determining that the grid is occupied.
In addition, before determining whether the ultrasonic data indicates that the grid is occupied, the method further includes: determining an effective ultrasonic sensor for detecting an effective distance according to ultrasonic data transmitted by each ultrasonic sensor; generating ultrasonic point cloud data according to the detection angle of the effective ultrasonic sensor and the distance value detected by the effective ultrasonic sensor; judging whether the ultrasonic data indicate that the grid is occupied or not, including: and judging whether the ultrasonic data indicate that the grids are occupied or not according to the ultrasonic point cloud data.
In addition, according to the detection angle of the effective ultrasonic sensor and the distance value detected by the effective ultrasonic sensor, the ultrasonic point cloud data is generated, which comprises: aiming at an effective ultrasonic sensor with an effective ultrasonic sensor in adjacent ultrasonic sensors, generating first point cloud data according to the detection angle and the distance value of the adjacent effective ultrasonic sensor and the detection angle and the distance value of the effective ultrasonic sensor; generating second point cloud data according to the detection angle and the distance value of the effective ultrasonic sensor aiming at the effective ultrasonic sensor without the effective ultrasonic sensor in the adjacent ultrasonic sensors; and obtaining ultrasonic point cloud data according to the first point cloud data and the second point cloud data.
In addition, generating first point cloud data according to the detection angle and the distance value of the adjacent effective ultrasonic sensor and the detection angle and the distance value of the effective ultrasonic sensor comprises: determining a first sector detection area of the effective ultrasonic sensor according to the detection angle and the distance value of the effective ultrasonic sensor; determining a second sector detection area of the adjacent effective ultrasonic sensor according to the detection angle and the distance value of the adjacent effective ultrasonic sensor; generating first point cloud data according to a connecting line of arc central points of the first fan-shaped detection area and the second fan-shaped detection area and a half-chord long line of the second fan-shaped detection area; or generating first point cloud data according to a connecting line of arc central points of the first fan-shaped detection area and the second fan-shaped detection area, a half-chord length line of the second fan-shaped detection area and a half-chord length line of the first fan-shaped detection area; generating second point cloud data according to the detection angle and the distance value of the effective ultrasonic sensor, wherein the second point cloud data comprises: determining a third sector detection area of the effective ultrasonic sensor according to the detection angle and the distance value of the effective ultrasonic sensor; and generating second point cloud data according to the chord length line of the third sector detection area.
In addition, after the obstacle grid map is drawn according to the occupation situation of each grid, the method further comprises the following steps: and carrying out corrosion operation and expansion operation on the barrier grid map.
In addition, after the obstacle grid map is drawn according to the occupation situation of each grid, the method further comprises the following steps: and executing an obstacle avoidance algorithm according to the obstacle grid map so as to control the robot to move.
In addition, the blank obstacle map is generated according to the obstacle avoidance area and the map resolution.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
A first embodiment of the present invention relates to a map creation method applied to an electronic device, such as a robot itself or a server connected to the robot. As shown in fig. 1, the map creation method includes:
step 101: ultrasonic data transmitted by at least one ultrasonic sensor of the robot and lidar data transmitted by at least one lidar of the robot are acquired.
In particular, the lidar data may be depth continuous point cloud data scanned by the lidar. The lidar may be a single line radar or a multi-line radar, generally with a 180 degree range, and the detection depth is relatively far, and the scanning area thereof covers as shown by the left semi-circle dashed area T in fig. 2.
In one embodiment, the lidar is mounted in front of the robot. The laser radar data describe a depth value data set scanned by taking the laser radar as a coordinate origin in one or more planes in front of a visual field of the robot and stepping a preset angle in a clockwise direction, and the detailed environmental depth information in front of the robot is recorded.
In one embodiment, the ultrasonic data is data generated from discrete obstacle distances detected by the ultrasonic sensor.
It should be noted that, as will be understood by those skilled in the art, in practical applications, the number and the installation positions of the ultrasonic sensors installed on the robot may be determined as needed, for example, at least one ultrasonic sensor is installed on each side of the robot, and the number and the installation positions of the ultrasonic sensors are not limited in this embodiment.
Step 102: for each grid of the blank obstacle map, respectively performing the following operations: judging whether an obstacle exists at the position indicated by the grid or not according to the laser radar data; if yes, determining that the grid is occupied; if not, then a determination is made as to whether the grid is occupied based at least on the ultrasound data.
Specifically, a blank obstacle map may be generated based on the obstacle area and the map resolution. The obstacle area refers to the area currently scanned by the robot, and the map resolution can be set according to the requirement.
In one embodiment, the electronic device generates a lidar data layer based on the lidar data and an ultrasonic data layer based on the ultrasonic data. And the electronic equipment respectively calculates the coordinates of each grid in the laser radar data layer and the ultrasonic data layer so as to determine the laser radar data and the ultrasonic data corresponding to each grid.
In one embodiment, the electronic device, in determining whether the grid is occupied based at least on the ultrasound data, comprises the sub-steps of:
step 1021: it is determined whether the ultrasound data indicates that the grid is occupied.
Specifically, if it is determined that the ultrasonic data indicates that the grid is occupied, step 1022 is performed, and if it is determined that the ultrasonic data indicates that the grid is not occupied, step 1023 is performed.
In one embodiment, the electronic device performs characterization simulation based on the ultrasonic data to obtain ultrasonic point cloud data. And in the process of judging whether the ultrasonic data indicate that the grid is occupied or not, the electronic equipment judges whether the ultrasonic data indicate that the grid is occupied or not according to the ultrasonic point cloud data. Specifically, the electronic equipment determines an effective ultrasonic sensor which detects an effective distance according to ultrasonic data transmitted by each ultrasonic sensor; and generating ultrasonic point cloud data according to the detection angle of the effective ultrasonic sensor and the distance value detected by the effective ultrasonic sensor.
In one embodiment, the process of generating, by the electronic device, the ultrasonic point cloud data according to the detection angle of the effective ultrasonic sensor and the distance value detected by the effective ultrasonic sensor includes: aiming at an effective ultrasonic sensor with an effective ultrasonic sensor in adjacent ultrasonic sensors, generating first point cloud data according to the detection angle and the distance value of the adjacent effective ultrasonic sensor and the detection angle and the distance value of the effective ultrasonic sensor; generating second point cloud data according to the detection angle and the distance value of the effective ultrasonic sensor aiming at the effective ultrasonic sensor without the effective ultrasonic sensor in the adjacent ultrasonic sensors; and obtaining ultrasonic point cloud data according to the first point cloud data and the second point cloud data.
In one embodiment, the electronic device generates first point cloud data from the probe angle and distance values of neighboring active ultrasonic sensors and the probe angle and distance values of active ultrasonic sensors, including: determining a first sector detection area of the effective ultrasonic sensor according to the detection angle and the distance value of the effective ultrasonic sensor; determining a second sector detection area of the adjacent effective ultrasonic sensor according to the detection angle and the distance value of the adjacent effective ultrasonic sensor; generating first point cloud data according to a connecting line of arc central points of the first fan-shaped detection area and the second fan-shaped detection area and a half-chord long line of the second fan-shaped detection area; or generating the first point cloud data according to a connecting line of the arc central points of the first fan-shaped detection area and the second fan-shaped detection area, a half-chord length line of the second fan-shaped detection area and a half-chord length line of the first fan-shaped detection area.
In one embodiment, the electronic device generates second point cloud data from the detection angle and distance values of the active ultrasonic sensor, including: determining a third sector detection area of the effective ultrasonic sensor according to the detection angle and the distance value of the effective ultrasonic sensor; and generating second point cloud data according to the chord length line of the third sector detection area.
For example, the robot is a rectangular parallelepiped robot, and 1 or more ultrasonic sensors are attached to each of four side surfaces of the robot. The ultrasonic sensors can be uniformly installed around the robot. The electronic device determines an effective ultrasonic sensor which detects an effective distance according to ultrasonic data transmitted by each ultrasonic sensor, judges whether the ultrasonic sensor adjacent to the effective ultrasonic sensor is the effective ultrasonic sensor from any effective ultrasonic sensor, determines a sector detection area according to a distance value detected by the effective ultrasonic sensor and a detection angle of the effective ultrasonic sensor if the adjacent ultrasonic sensors are not the effective ultrasonic sensors, generates point cloud data of the side surface by simulating chord length lines (line segment a and line segment b) of the sector detection area, and a schematic diagram of the point cloud data is shown in fig. 3. If it is determined that one or both of the ultrasonic sensors adjacent to the effective ultrasonic sensor are effective ultrasonic sensors, as shown in fig. 4, the ultrasonic sensors O, P and Q of the robot detect effective distances, so that the ultrasonic sensors O, P and Q are effective ultrasonic sensors, point a is the arc center of the sector detection area of the ultrasonic sensor O, point B is the arc center of the sector detection area of the ultrasonic sensor P, point C is the arc center of the sector detection area of the ultrasonic sensor Q, AD is the half-chord length line of the sector detection area of the effective ultrasonic sensor O, and CE is the half-chord length line of the sector detection area of the effective ultrasonic sensor Q. Therefore, the point cloud data of the side is determined from the link obtained by the sequential connection of the points E, C, B, A and D. If the ultrasonic sensor O and the ultrasonic sensor P are effective ultrasonic sensors and the ultrasonic sensor Q is not an effective ultrasonic sensor, point cloud data is determined based on a connecting line AB of the half-chord length lines DA, a, and B of the ultrasonic sensor O and a half-chord length line BF (line segment not shown) of the ultrasonic sensor P.
For clarity of explanation, in this embodiment, the sector detection regions of the effective sensors are determined before the number of effective ultrasonic sensors is determined, and in practical applications, the sector detection regions of the effective ultrasonic sensors may be determined after the number of effective ultrasonic sensors is determined.
It should be noted that, as will be understood by those skilled in the art, in practical applications, the ultrasonic point cloud data may also be generated in other manners, and this embodiment is merely an example.
It is worth mentioning that the ultrasonic data are converted into ultrasonic point cloud data compatible with the laser radar data, so that the electronic equipment can conveniently obtain the barrier grid map by referring to the ultrasonic data and the laser radar data.
Step 1022: judging whether the coincidence degree of the ultrasonic data corresponding to the grid and the laser radar data corresponding to the grid is greater than a threshold value; if the grid is determined to be larger than the threshold, determining that the grid is not occupied, and if the grid is determined to be not larger than the threshold, determining that the grid is occupied.
Specifically, the threshold may be set as needed, and when the grid occupation situation obtained based on the lidar data is different from the grid occupation situation obtained based on the ultrasonic data, if the local lidar data near the grid is close to the local ultrasonic data near the grid, the ultrasonic data is corrected based on the determination result of the lidar data. If the difference between the two is large, the ultrasonic data is taken as the standard.
Step 1023: it is determined that the grid is unoccupied.
Specifically, if both the ultrasonic data and the lidar data indicate that the grid is not occupied, it may be determined that the grid is not occupied.
In one embodiment, the electronic device generates a lidar data layer based on the lidar data and an ultrasonic data layer based on the ultrasonic data. After combining step 1021 to step 1023, a flowchart for determining the occupancy of each grid is shown in fig. 5, and includes the following steps:
step 201: and respectively calculating the coordinates of the grid in the laser radar data layer and the ultrasonic data layer. And determining the laser radar data and the ultrasonic data corresponding to each grid by calculating the coordinates of the grids in the laser radar data layer and the ultrasonic data layer.
Step 202: and judging whether the position indicated by the grid has an obstacle or not according to the laser radar data.
Specifically, it is determined whether there is an obstacle in the position indicated by the coordinates of the laser radar data layer corresponding to the grid, if yes, step 203 is executed, otherwise, step 204 is executed.
Step 203: it is determined that the grid is occupied. And then the grid judgment process is ended.
Step 204: from the ultrasonic data, it is determined whether an obstacle exists at the position indicated by the grid.
Specifically, it is determined whether there is an obstacle at the position indicated by the coordinates of the ultrasound data layer corresponding to the grid, and if yes, step 206 is executed, otherwise, step 205 is executed.
Step 205: it is determined that the grid is unoccupied. And then the grid judgment process is ended.
Step 206: and carrying out local window matting on the ultrasonic data layer corresponding to the grid and the laser radar data layer corresponding to the grid.
Step 207: and judging whether the coincidence degree of the matting obtained based on the ultrasonic data image layer and the matting obtained based on the laser radar data image layer is greater than a threshold value.
Specifically, if the contact ratio is greater than the threshold value, step 205 is executed, otherwise, step 203 is executed.
Step 208: it is determined that the grid is unoccupied. And then the grid judgment process is ended.
Step 209: it is determined that the grid is occupied. And then the grid judgment process is ended.
It should be noted that, in practical applications, the grid occupation may also be determined in other manners, for example, when it is determined that the grid is occupied based on the ultrasonic data, it may be determined that the grid is occupied, and the step of determining the grid occupation according to the size of the degree of overlap is not performed, which is merely an example.
Step 103: and obtaining the barrier grid map according to the occupation condition of each grid.
Specifically, the electronic device may generate an obstacle grid map to indicate obstacle conditions around the robot according to the occupancy of each grid.
The above description is only for illustrative purposes and does not limit the technical aspects of the present invention.
Compared with the prior art, in the map creating method provided by the embodiment, the robot is provided with the ultrasonic sensor to assist the laser radar sensor of the robot in creating the map. Due to the fact that the ultrasonic sensor is low in cost and small in size, the ultrasonic sensor is used for assisting in drawing construction, requirements for the number of laser radars installed on electronic equipment can be lowered, drawing construction cost of the robot is lowered, and a foundation is provided for achieving obstacle avoidance and navigation of the robot.
A second embodiment of the present invention relates to a map creation method. The embodiment is further improved on the basis of the first embodiment, and the specific improvements are as follows: after obtaining the barrier grid map according to the occupation condition of each grid, adding other related steps such as corrosion operation, expansion operation and the like on the barrier grid map.
Specifically, as shown in fig. 6, the present embodiment includes steps 301 to 304, wherein steps 301 to 303 are substantially the same as steps 101 to 103 in the first embodiment, and are not repeated herein. The following mainly introduces the differences:
step 301 to step 303 are executed.
Step 304: and carrying out corrosion operation and expansion operation on the barrier grid map.
Specifically, the electronic device performs erosion operation and expansion operation on the barrier grid map, and filters fine noise on the barrier grid map.
It should be noted that, as will be understood by those skilled in the art, in practical applications, the obstacle-removed grid map may also be optimized through other operations, which are not listed here.
Step 305: and executing an obstacle avoidance algorithm according to the obstacle grid map so as to control the robot to move.
Specifically, after obtaining the obstacle grid map, the electronic device may execute an obstacle avoidance algorithm such as DWA (dynamic window approach), and calculate a robot control execution output to control the robot to move.
It should be noted that, as can be understood by those skilled in the art, in practical applications, step 304 or step 305 may be selectively performed, and the present embodiment does not limit the optimization manner and the usage scenario of the obstacle grid map.
The above description is only for illustrative purposes and does not limit the technical aspects of the present invention.
Compared with the prior art, in the map creating method provided by the embodiment, the robot is provided with the ultrasonic sensor to assist the laser radar sensor of the robot in creating the map. Due to the fact that the ultrasonic sensor is low in cost and small in size, the ultrasonic sensor is used for assisting in drawing construction, requirements for the number of laser radars installed on electronic equipment can be lowered, drawing construction cost of the robot is lowered, and a foundation is provided for achieving obstacle avoidance and navigation of the robot. In addition, fine noise on the barrier grid map is filtered through corrosion operation and expansion operation, and the quality of the barrier grid map is improved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A third embodiment of the present invention relates to a map yellow key device, as shown in fig. 7, including: an acquisition module 401, a determination module 402 and a generation module 403. The obtaining module 401 is configured to: ultrasonic data transmitted by at least one ultrasonic sensor of the robot and lidar data transmitted by at least one lidar of the robot are acquired. The determining module 402 is configured to: for each grid of the blank obstacle map, respectively performing the following operations: judging whether an obstacle exists at the position indicated by the grid or not according to the laser radar data; if yes, determining that the grid is occupied; if not, then a determination is made as to whether the grid is occupied based at least on the ultrasound data. The generating module 403 is configured to: and obtaining the barrier grid map according to the occupation condition of each grid of the blank barrier map.
It should be understood that this embodiment is a system example corresponding to the first embodiment, and may be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the first embodiment.
It should be noted that each module referred to in this embodiment is a logical module, and in practical applications, one logical unit may be one physical unit, may be a part of one physical unit, and may be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, elements that are not so closely related to solving the technical problems proposed by the present invention are not introduced in the present embodiment, but this does not indicate that other elements are not present in the present embodiment.
A fourth embodiment of the present invention relates to an electronic apparatus, as shown in fig. 8, including: at least one processor 501; and a memory 502 communicatively coupled to the at least one processor 501; wherein the memory 502 stores instructions executable by the at least one processor 501, the instructions being executable by the at least one processor 501 to enable the at least one processor 501 to perform the map creation method as mentioned in the above embodiments.
The electronic device includes: one or more processors 501 and a memory 502, with one processor 501 being an example in fig. 8. The processor 501 and the memory 502 may be connected by a bus or other means, and fig. 8 illustrates the connection by the bus as an example. Memory 502, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 501 executes various functional applications of the device and data processing by running nonvolatile software programs, instructions, and modules stored in the memory 502, that is, implements the above-described map creation method.
The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store a list of options, etc. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 502 may optionally include memory located remotely from processor 501, which may be connected to an external device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 502, and when executed by the one or more processors 501, perform the map creation method of any of the method embodiments described above.
The product can execute the method provided by the embodiment of the application, has corresponding functional modules and beneficial effects of the execution method, and can refer to the method provided by the embodiment of the application without detailed technical details in the embodiment.
A fifth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.