Method and device for generating virtual laser data, storage medium and electronic device
By generating virtual laser data and using the parameters of the raster map and virtual scan lines to determine the location of virtual obstacles, the problem that the laser sensor cannot detect virtual obstacles is solved, and the robot's ability to avoid virtual boundaries is realized.
Patent Information
- Application Number
- CN202111632126.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-28
AI Technical Summary
Existing technology cannot use laser sensors to detect the location of virtual obstacles, resulting in the robot being unable to avoid virtual boundaries in the environment.
By obtaining a raster map of the real environment, determining the candidate endpoint position based on the scanning parameters of the virtual scan line, and using the raster values in the raster map to generate virtual laser data, combining pose data and scan distance data to generate virtual laser data, thereby determining the location of virtual obstacles.
It enables the robot to detect the location of virtual obstacles, solves the problem of being unable to avoid virtual boundaries, and enhances the robot's navigation ability in the environment.
Smart Images

Figure CN114419288B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a method and device for generating virtual laser data, a storage medium and an electronic device. Background Art
[0002] In the prior art, the laser sensors used along the edges of the robot can detect real obstacles in the current environment, so that the real obstacles can be avoided according to the detection results of the laser sensors.
[0003] However, in actual robot applications, in order to achieve some specified functions such as not entering a specified area or exploring within a limited range, it is usually necessary to add virtual boundary information to the environment. However, since the virtual boundary information does not really exist, it is impossible to use laser sensors to detect the existence of the virtual boundary information and avoid it.
[0004] With regard to the technical problem in the related art that the position of a virtual obstacle cannot be detected using a laser sensor, no effective solution has yet been proposed. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for generating virtual laser data, a storage medium and an electronic device, so as to at least solve the technical problem in the related art that the position of a virtual obstacle cannot be detected by a laser sensor.
[0006] According to an embodiment of the present invention, a method for generating virtual laser data is provided, comprising: obtaining a grid map corresponding to a real environment in which a target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied status of the grids; determining a candidate terminal position corresponding to a virtual scan line to be generated based on scanning parameters of a virtual scan line configured for the target object; using the grid values of the grids passed by the virtual scan line before reaching the candidate terminal position, taking the target grid determined from the grid map as the target terminal position of the virtual scan line; and combining the currently detected posture data of the target object and the scanning distance data obtained based on the target terminal position to generate current virtual laser data.
[0007] In an exemplary embodiment, based on the scanning parameters of the virtual scanning line configured for the target object, the candidate end point position corresponding to the virtual scanning line to be generated is determined, including: obtaining the scanning parameters of the virtual scanning line, wherein the scanning parameters include the maximum scanning detection distance, the scanning detection angle range and the interval angle between the virtual scanning lines; and determining the position coordinates of the candidate end point position in the grid map according to the scanning parameters and the resolution of the grid map.
[0008] In an exemplary embodiment, the target grid determined from the grid map is used as the target end position of the virtual scan line by using the grid value of the grid passed by the virtual scan line before reaching the candidate end position, including: performing the following operations for each of the virtual scan lines: taking the current position of the target object in the grid map as the starting point, extending in the direction of the candidate end position of the virtual scan line, and traversing each grid passed by the virtual scan line in turn as the current grid; when the grid value of the current grid indicates that the current grid is occupied, taking the previous grid of the current grid as the target end position of the virtual scan line, wherein when the grid value is a first value, it indicates that the grid corresponding to the grid value is occupied by a real obstacle, when the grid value is a second value, it indicates that the grid corresponding to the grid value is occupied by a virtual obstacle, and when the grid value is a third value, it indicates that the grid corresponding to the grid value is not occupied.
[0009] In an exemplary embodiment, when the grid value of the current grid indicates that the current grid is not occupied, but the current grid is located on the boundary of the grid map, the previous grid of the current grid is used as the target end position of the virtual scan line.
[0010] In an exemplary embodiment, after the target grid determined from the grid map is used as the target end position of the virtual scan line, the method includes: obtaining a virtual ray distance between the starting position and the target end position; and using the virtual ray distance as the scanning distance data of the virtual scan line.
[0011] In an exemplary embodiment, the currently detected posture data of the target object and the scanning distance data acquired based on the target end position are combined to generate the current virtual laser data, including: combining the currently detected posture data of the target object, the angle data and the scanning distance data corresponding to each virtual scanning line to generate the current virtual laser data.
[0012] According to another embodiment of the embodiments of the present invention, a device for generating virtual laser data is also provided, including: an acquisition module, used to acquire a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the above-mentioned grid map are respectively configured with grid values, and the above-mentioned grid values are used to indicate the occupied state of the above-mentioned grids; a first determination module, used to determine the candidate end point position corresponding to the virtual scan line to be generated based on the scanning parameters of the virtual scan line configured for the above-mentioned target object; a second determination module, used to use the grid values of the grids passed by the above-mentioned virtual scan line before reaching the above-mentioned candidate end point position, and use the target grid determined from the above-mentioned grid map as the target end point position of the above-mentioned virtual scan line; a generation module, used to combine the currently detected posture data of the above-mentioned target object and the scanning distance data acquired based on the above-mentioned target end point position to generate the current virtual laser data.
[0013] In an exemplary embodiment, the first determination module includes: an acquisition unit for acquiring scanning parameters of the virtual scanning line, wherein the scanning parameters include a maximum scanning detection distance, a scanning detection angle range, and an interval angle between virtual scanning lines; a determination unit for determining the position coordinates of the candidate end point position in the grid map based on the scanning parameters and the resolution of the grid map.
[0014] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for generating virtual laser data when running.
[0015] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for generating virtual laser data through the computer program.
[0016] In an embodiment of the present invention, a grid map corresponding to the real environment where the target object is currently located is obtained, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids; based on the scanning parameters of the virtual scan line configured for the target object, the candidate terminal position corresponding to the virtual scan line to be generated is determined; using the grid values of the grids passed by the virtual scan line before reaching the candidate terminal position, the target grid determined from the grid map is used as the target terminal position of the virtual scan line; the currently detected posture data of the target object and the scanning distance data obtained based on the target terminal position are combined to generate the current virtual laser data; using the above technical scheme, by configuring the virtual scan line and determining the target terminal position of the virtual scan line from the grid map, the position information of the virtual obstacle is obtained, thereby solving the technical problem that the position of the virtual obstacle cannot be detected by the laser sensor. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0018] Figure 1 is a schematic diagram of an application scenario of an optional method for generating virtual laser data according to an embodiment of the present invention;
[0019] Figure 2 is a flow chart of an optional method for generating virtual laser data according to an embodiment of the present invention;
[0020] Figure 3 is a schematic diagram of an optional method for generating virtual laser data according to an embodiment of the present invention;
[0021] Figure 4 is a schematic diagram of another optional method for generating virtual laser data according to an embodiment of the present invention;
[0022] Figure 5 is a schematic diagram of another optional method for generating virtual laser data according to an embodiment of the present invention;
[0023] Figure 6 is a structural block diagram of an optional device for generating virtual laser data according to an embodiment of the present invention;
[0024] Figure 7 It is a structural block diagram of another optional device for generating virtual laser data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] In an embodiment of the present invention, an embodiment of the method for generating virtual laser data is provided. As an optional implementation, the method for generating virtual laser data can be applied to, but is not limited to, Figure 1 In the application environment shown.
[0028] Optionally, in this embodiment, area 101 represents the activity area of target object 100. Assume that area 101 is a parking lot, car 102 represents a real obstacle, and parking space 103 represents a virtual boundary that is artificially designated and cannot be entered by target object 100. Dotted line 105 represents the motion trajectory of target object 100, that is, during the motion, the target object can neither touch car 102 nor enter the area where parking space 103 is located. After obtaining virtual laser data of any posture of the target object in area 101, the virtual laser data is sent to server 104 for storage.
[0029] In this embodiment, a method for generating virtual laser data is provided, which is applied to Figure 1 In the application environment shown, Figure 2 is a flow chart of a method for generating virtual laser data according to an embodiment of the present invention, the flow chart comprising the following steps:
[0030] Step S202, obtaining a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids;
[0031] Step S204, determining a candidate end point position corresponding to the virtual scan line to be generated based on the scan parameters of the virtual scan line configured for the target object;
[0032] Step S206, using the grid values of the grids that the virtual scan line passes through before reaching the candidate end position, and using the target grid determined from the grid map as the target end position of the virtual scan line;
[0033] Step S208, combining the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate current virtual laser data.
[0034] Optionally, in this embodiment, the target object may include but is not limited to industrial robots, service robots, and special robots. The grid map may be obtained by scanning the real environment in advance with a laser sensor, and setting the grid value of the virtual boundary position as the virtual obstacle value. The grid value may include but is not limited to numerical values, letters, and combinations thereof; different numerical values, letters, etc. indicate whether the grid is occupied or whether there is an obstacle at the location of the grid; wherein, the same numerical values, letters, etc. may be used to represent real obstacles and virtual obstacles, or different numerical values, letters, etc. may be used to represent real obstacles and virtual obstacles.
[0035] Optionally, in this embodiment, the scanning parameters of the virtual scanning line may include but are not limited to the maximum detection distance r, the starting angle minAngle, the ending angle maxAngle and the interval angle angleIncrement. The size of the sector can be determined by the starting angle and the ending angle, and the density of the virtual scanning line can be determined by the interval angle.
[0036] For example, Figure 3 As shown, 301 represents a grid map, 302 represents a real obstacle, 303 represents a virtual obstacle, 304 represents a target object, and point O is the location of the target object 304. 305 represents a virtual scan line of a starting angle, and 306 represents a virtual scan line of an ending angle. The grid value corresponding to the real obstacle 302 is 100, the grid value corresponding to the virtual obstacle 303 is 50, and the grid value of other areas is 0. The interval angle between two adjacent virtual scan lines 305 and 307 is 10 degrees. Points A, B, and C are the target end points of virtual scan lines 305, 306, and 307, respectively.
[0037] Optionally, in this embodiment, the calculation method for determining the grids that the virtual scan line passes through before reaching the candidate end position may include but is not limited to iteratively determining the grids (x1, y1) that the virtual scan line passes through in sequence according to the final point coordinates (x1, y1) of each virtual scan line and the current position (x0, y0) of the target object through the Bresenham algorithm. i ,y i ). Each time you select the x or y direction, one grid is added toward the end point. In the other direction, one grid is added or remains unchanged.
[0038] Optionally, in this embodiment, the current virtual laser data may include but is not limited to combining the current time, the current posture of the target object, virtual scan lines at all angles and the corresponding maximum feedback distance to generate virtual scan line data at the current posture of the target object.
[0039] Through the scheme provided in the embodiment of the present application, a grid map corresponding to the real environment where the target object is currently located is obtained, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied status of the grids; based on the scanning parameters of the virtual scan line configured for the target object, the candidate terminal position corresponding to the virtual scan line to be generated is determined; using the grid values of the grids passed by the virtual scan line before reaching the candidate terminal position, the target grid determined from the grid map is used as the target terminal position of the virtual scan line; the currently detected posture data of the target object and the scanning distance data obtained based on the target terminal position are combined to generate the current virtual laser data; by adopting the above technical scheme, by configuring the virtual scan line and determining the target terminal position of the virtual scan line from the grid map, the position information of the virtual obstacle is obtained, thereby solving the technical problem that the position of the virtual obstacle cannot be detected by the laser sensor.
[0040] In an exemplary embodiment, based on the scanning parameters of the virtual scan line configured for the target object, the candidate end point position corresponding to the virtual scan line to be generated is determined, including: obtaining the scanning parameters of the virtual scan line, wherein the scanning parameters include the maximum scanning detection distance, the scanning detection angle range and the interval angle between the virtual scan lines; and determining the position coordinates of the candidate end point position in the grid map according to the scanning parameters and the resolution of the grid map.
[0041] Optionally, the maximum detection distance r, the starting angle minAngle, the ending angle maxAngle and the interval angle angleIncrement of the virtual scan line are set. The size of the sector can be determined by the starting angle and the ending angle, and the density of the virtual scan line can be determined by the interval angle.
[0042] The end position of each virtual scan line is generated according to the angle range of the virtual scan line, the maximum detection distance and the current position (x0, y0, theta) of the target object, and combined into an end position group. The end coordinates are converted from the polar coordinates at the maximum detection distance of the virtual scan line to Cartesian coordinates through trigonometric functions, x = r * cos (theta + minAngle + i * angleIncrement) + x0, y = r * sin (theta + minAngle + i * angleIncrement) + y0, i ~ (0, (maxAngle-minAngle) / angleIncrement). The current position coordinates of the target object and the end coordinates of the virtual scan line can be, but are not limited to, coordinates of the ground coordinate system. The current position coordinates of the target object and the end coordinates of the virtual scan line are converted to corresponding grid coordinates according to the grid resolution. The conversion to corresponding grid coordinates may include but is not limited to dividing the horizontal and vertical coordinates of the current position coordinates of the target object and the end coordinates of the virtual scan line by the resolution of the grid map, and taking the integer part of the result as the grid coordinates.
[0043] For example, assuming that the current position coordinates of the target object and the end point coordinates of the virtual scan line are (5, 6) and (9, 10) respectively, and the resolution of the grid map is 2, then the grid coordinates corresponding to the current position coordinates of the target object and the end point coordinates of the virtual scan line are (2, 3) and (4, 5) respectively.
[0044] Through the solution provided in the embodiment of the present application, by converting the current position coordinates of the target object and the end point position coordinates of the virtual scan line into corresponding grid coordinates, it is convenient to determine the connection line between the current position of the target object and the end point position of the virtual scan line.
[0045] In an exemplary embodiment, the target grid determined from the grid map is used as the target end position of the virtual scan line by using the grid value of the grid passed by the virtual scan line before reaching the candidate end position, including: performing the following operations for each virtual scan line: taking the current position of the target object in the grid map as the starting position, extending in the direction of the candidate end position of the virtual scan line, and traversing each grid passed by the virtual scan line in turn as the current grid; when the grid value of the current grid indicates that the current grid is occupied, using the previous grid of the current grid as the target end position of the virtual scan line, wherein when the grid value is a first value, it indicates that the grid corresponding to the grid value is in a state occupied by a real obstacle, when the grid value is a second value, it indicates that the grid corresponding to the grid value is in a state occupied by a virtual obstacle, and when the grid value is a third value, it indicates that the grid corresponding to the grid value is in an unoccupied state.
[0046] Optionally, virtual scan lines at all angles are traversed in sequence starting from the starting angle direction. According to the final point coordinates (x1, y1) of each virtual scan line and the current position (x0, y0) of the above target object, the grids (x i , y i ) passed through in sequence are determined iteratively by the Bresenham algorithm. Each time, one grid is added to the end point in either the x or y direction, and one grid or unchanged is added in the other direction. Specifically, taking the case where the slope k of the scan line is between 0 and 1 and one grid is added in the x direction, and it is determined whether one grid needs to be added in the y direction as an example. Assume the straight line is y = kx + b, the current point is (x i , y i ), and the next point may be (x i+1 , y i ) or (x i+1 , y i+1 ). Let d1 = y - y i = k(x i+1 ) + b - y i , d2 = (y i+1 ) - y = y i+1 - k(x i+1 ) - b. If d1 < d2, the y direction of the next point remains unchanged; if d1 ≥ d2, one grid is added in the y direction of the next point. The traditional bresenham algorithm takes the end point as the termination condition, while in this embodiment, when the grid value of the current grid indicates that the current grid is occupied, the virtual scan line will terminate in advance.
[0047] For example, the first value is 100, the second value is 50, and the third value is 0. When the grid value of the current grid is 100, it means there is a real obstacle at this grid, then the previous grid of the current grid is used as the target end position of the virtual scan line; when the grid value of the current grid is 50, it means there is a virtual obstacle at this grid, then the previous grid of the current grid is used as the target end position of the virtual scan line; when the grid value of the current grid is 0, it means there is no obstacle at this grid, and then the next grid is continued to be traversed. As Figure 4As shown, 401 represents a grid map, 402 represents a real obstacle, 403 represents a virtual obstacle, 404 represents a target object, and point O is the location of the target object 404. 405 represents a virtual scan line of a starting angle, and 406 represents a virtual scan line of an ending angle. The grid value corresponding to the real obstacle 402 is 100, the grid value corresponding to the virtual obstacle 403 is 50, and the grid values of other areas are 0. The interval angle between two adjacent virtual scan lines 405 and 407 is 10 degrees. Points A, B, C, and D are the target endpoints of virtual scan lines 405, 406, 407, and 408, respectively. When the grids that the virtual scan line 408 passes through are determined sequentially through the Bresenham algorithm iteration, the grid value corresponding to the grid at point D is 50, indicating that there is a virtual obstacle at the grid, and the previous grid of the current grid is used as the target endpoint position of the virtual scan line.
[0048] Through the solution provided in the embodiment of the present application, by judging the grid value of the current grid and determining whether there is an obstacle at the grid, it is convenient to determine the end point position of the virtual scan line.
[0049] In an exemplary embodiment, when the grid value of the current grid indicates that the current grid is not occupied, but the current grid is located on the boundary of the grid map, the previous grid of the current grid is used as the target end position of the virtual scan line.
[0050] It should be noted that the grid map is not infinite, but has a certain size, that is, the grid map has a boundary. In the process of determining the grid coordinates in sequence, this embodiment needs to determine whether the coordinates of the current grid exceed the maximum boundary range of the grid map. If so, the previous grid of the current grid is used as the target end position of the virtual scan line. Otherwise, continue to traverse until the candidate end position of the virtual scan line is traversed, and the candidate end position is used as the target end position of the virtual scan line.
[0051] For example, Figure 4 As shown, when the grids that the virtual scan line 406 passes through in sequence are determined by iteratively using the Bresenham algorithm, although the grid value corresponding to the grid at point B is 0, indicating that the grid at point B is not occupied, the grid at point B is located at the boundary of the grid map, and the previous grid of the current grid is used as the target end position of the virtual scan line.
[0052] Through the solution provided in the embodiment of the present application, in the process of sequentially determining grid coordinates, by determining whether the coordinates of the current grid exceed the maximum boundary range of the grid map, the target end point position of the virtual scan line can be accurately determined.
[0053] In an exemplary embodiment, after the target grid determined from the grid map is used as the target end position of the virtual scan line, the method includes: obtaining a virtual ray distance between the start position and the target end position; and using the virtual ray distance as the scan distance data of the virtual scan line.
[0054] It should be noted that the virtual scan line will terminate early when it encounters a real obstacle or a virtual obstacle or exceeds the maximum boundary range of the grid map. Therefore, the virtual ray distance between the starting position and the target end position is used as the virtual laser distance of the virtual scan line.
[0055] Through the solution provided in the embodiments of the present application, when the virtual scan line may terminate prematurely, the virtual ray distance between the starting position and the target end position is used as the virtual laser distance of the virtual scan line, so as to accurately determine the distance between the target object and the obstacle in the current posture.
[0056] In an exemplary embodiment, the currently detected posture data of the target object and the scanning distance data acquired based on the target end position are combined to generate the current virtual laser data, including: the currently detected posture data of the target object, the angle data and the scanning distance data corresponding to each virtual scanning line are combined to generate the current virtual laser data.
[0057] Optionally, in this embodiment, the current virtual laser data may include but is not limited to combining the current time, the current posture of the target object, virtual scan lines at all angles and corresponding virtual laser distances to generate virtual laser data at the current posture of the target object.
[0058] Through the solution provided in the embodiment of the present application, by acquiring virtual laser data of virtual scan lines at all angles in the current posture of the target object, it is possible to facilitate the target object to avoid obstacles.
[0059] In order to better understand the process of the method for generating the above virtual laser data, the implementation method flow of the generation of the above virtual laser data is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present invention.
[0060] In this embodiment, a method for generating virtual laser data is provided. Figure 5 is a schematic diagram of a method for generating virtual laser data according to an embodiment of the present invention. Figure 5 As shown, the specific steps include:
[0061] Step S501: Obtain the global position and grid map of the target object. The grid map can be obtained by scanning the real environment in advance with a laser sensor, and the grid value of the virtual boundary position is set as the virtual obstacle value. Figure 3 As shown, the grid value corresponding to the real obstacle 302 is 100, the grid value corresponding to the virtual obstacle 303 is 50, and the grid values of other areas are 0. The global pose can be accumulated through the odometer or IMU or obtained through SLAM positioning.
[0062] Step S502: Set the maximum detection distance r, the starting angle minAngle, the ending angle maxAngle and the interval angle angleIncrement of the virtual scan line. The size of the sector is determined by the starting angle and the ending angle, and the density of the virtual scan line is determined by the interval angle;
[0063] Step S503: Generate the end point position of each virtual scan line according to the angle range of the virtual scan line, the maximum detection distance and the current posture of the target object (x0, y0, theta), and combine them into an end point position group. The end point coordinates are converted into Cartesian coordinates by trigonometric functions from the polar coordinates at the maximum detection distance of the laser, x=r*cos(theta+minAngle+i*angleIncrement)+x0, y=r*sin(theta+minAngle+i*angleIncrement)+y0, i~(0, (maxAngle-minAngle) / angleIncrement). The current position coordinates of the target object and the end point coordinates of the virtual scan line are converted into corresponding grid coordinates according to the grid resolution. Divide the horizontal and vertical coordinates of the current position coordinates of the target object and the end point coordinates of the virtual scan line by the resolution of the grid map, and take the integer part of the result as the grid coordinates;
[0064] Step S504: starting from the starting angle direction, traverse the virtual scan lines of all angles in sequence;
[0065] Step S505: According to the end point coordinates (x1, y1) of the virtual scan line of the corresponding angle and the current position coordinates (x0, y0) of the target object, the grids (x1, y1) that are passed through are determined by iterative Bresenham algorithm. i ,y i ). Each time you select the x or y direction, add one grid to the end point, and add one grid in the other direction or keep it unchanged. Specifically, take the scan line slope k between 0 and 1, and add one grid in the x direction to determine whether to add one grid in the y direction. Assume that the line is y=kx+b, and the current point is (x i ,y i ), the next point may be (x i+1 ,y i ) or (x i+1 ,y i+1 ). Let d1 = yy i = k(xi+1 ) + b - y i , d2 = (y i+1 ) - y = y i+1 -k(x i+1 ) - b. If d1 < d2, the y - direction of the next point remains unchanged; if d1 ≥ d2, the y - direction of the next point increases by one grid.
[0066] Step S506: Judging in turn whether the grid coordinates are occupied, that is, whether the grid value corresponds to a non - zero value. If so, go to step S507; if not, go to step S508;
[0067] Step S507: Return the distance from the previous grid to the starting point as the virtual laser distance of the virtual scan line at this angle;
[0068] Step S508: Judging in turn whether the grid coordinates exceed the maximum boundary range of the grid map. If so, go to step S507; if not, go to step S509;
[0069] Step S509: Judging in turn whether the grid reaches the candidate end position. If so, go to step S510; if not, go to step S505;
[0070] Step S510: Return the distance from the target end point to the starting point as the virtual laser distance of this virtual scan line;
[0071] Step S511: Judging whether all the virtual scan lines at all angles have been traversed. If so, go to step S512; if not, go to step S504;
[0072] Step S512: Combine the current time, the current pose of the target object, all the virtual scan lines at all angles and the corresponding virtual laser distances to generate the virtual laser data of the target object at the current pose.
[0073] Through the scheme provided in the embodiment of the present application, a grid map corresponding to the real environment where the target object is currently located is obtained, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied status of the grids; based on the scanning parameters of the virtual scan line configured for the target object, the candidate terminal position corresponding to the virtual scan line to be generated is determined; using the grid values of the grids passed by the virtual scan line before reaching the candidate terminal position, the target grid determined from the grid map is used as the target terminal position of the virtual scan line; the currently detected posture data of the target object and the scanning distance data obtained based on the target terminal position are combined to generate the current virtual laser data; by adopting the above technical scheme, by configuring the virtual scan line and determining the target terminal position of the virtual scan line from the grid map, the position information of the virtual obstacle is obtained, thereby solving the technical problem that the position of the virtual obstacle cannot be detected by the laser sensor.
[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.
[0075] Figure 6 is a structural block diagram of a device for generating virtual laser data according to an embodiment of the present invention; Figure 6 As shown, the device comprises:
[0076] An acquisition module 601 is used to acquire a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids;
[0077] A first determination module 602 is used to determine a candidate end point position corresponding to the virtual scan line to be generated based on the scan parameters of the virtual scan line configured for the target object;
[0078] The second determination module 603 is used to use the grid values of the grids that the virtual scan line passes through before reaching the candidate end position, and use the target grid determined from the grid map as the target end position of the virtual scan line;
[0079] The generation module 604 is used to combine the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate the current virtual laser data.
[0080] Through the scheme provided in the embodiment of the present application, a grid map corresponding to the real environment where the target object is currently located is obtained, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied status of the grids; based on the scanning parameters of the virtual scan line configured for the target object, the candidate terminal position corresponding to the virtual scan line to be generated is determined; using the grid values of the grids passed by the virtual scan line before reaching the candidate terminal position, the target grid determined from the grid map is used as the target terminal position of the virtual scan line; the currently detected posture data of the target object and the scanning distance data obtained based on the target terminal position are combined to generate the current virtual laser data; by adopting the above technical scheme, by configuring the virtual scan line and determining the target terminal position of the virtual scan line from the grid map, the position information of the virtual obstacle is obtained, thereby solving the technical problem that the position of the virtual obstacle cannot be detected by the laser sensor.
[0081] Figure 7 is a structural block diagram of another device for generating virtual laser data according to an embodiment of the present invention; Figure 7 As shown, the first determination module 602 includes:
[0082] An acquisition unit 701 is used to acquire scanning parameters of a virtual scanning line, wherein the scanning parameters include a maximum scanning detection distance, a scanning detection angle range, and an interval angle between virtual scanning lines;
[0083] The determination unit 702 is used to determine the position coordinates of the candidate end point position in the grid map according to the scanning parameters and the resolution of the grid map.
[0084] An embodiment of the present invention further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0085] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0086] S1, obtaining a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids;
[0087] S2, determining a candidate end point position corresponding to the virtual scan line to be generated based on the scan parameters of the virtual scan line configured for the target object;
[0088] S3, using the grid values of the grids that the virtual scan line passes through before reaching the candidate end position, and taking the target grid determined from the grid map as the target end position of the virtual scan line;
[0089] S4, combining the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate current virtual laser data.
[0090] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0091] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0092] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0093] S1, obtaining a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids;
[0094] S2, determining a candidate end point position corresponding to the virtual scan line to be generated based on the scan parameters of the virtual scan line configured for the target object;
[0095] S3, using the grid values of the grids that the virtual scan line passes through before reaching the candidate end position, and taking the target grid determined from the grid map as the target end position of the virtual scan line;
[0096] S4, combining the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate current virtual laser data.
[0097] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0098] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0099] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0100] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating virtual laser data, characterized in that: include: Obtaining a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids; Determining a candidate end point position corresponding to the virtual scan line to be generated based on a scan parameter of the virtual scan line configured for the target object; The following operations are performed for each of the virtual scan lines: taking the current position of the target object in the grid map as the starting position, extending in the direction of the candidate end position of the virtual scan line, and traversing each grid passed by the virtual scan line in turn as the current grid; when the grid value of the current grid indicates that the current grid is occupied, taking the previous grid of the current grid as the target end position of the virtual scan line, wherein when the grid value is a first value, it indicates that the grid corresponding to the grid value is in a state occupied by a real obstacle, when the grid value is a second value, it indicates that the grid corresponding to the grid value is in a state occupied by a virtual obstacle, and when the grid value is a third value, it indicates that the grid corresponding to the grid value is in an unoccupied state; The currently detected posture data of the target object and the scanning distance data acquired based on the target end position are combined to generate current virtual laser data.
2. The method for generating virtual laser data according to claim 1, characterized in that: Determining a candidate end point position corresponding to the virtual scan line to be generated based on a scan parameter of the virtual scan line configured for the target object includes: Acquiring scanning parameters of the virtual scanning line, wherein the scanning parameters include a maximum scanning detection distance, a scanning detection angle range, and an interval angle between virtual scanning lines; The position coordinates of the candidate endpoint position in the grid map are determined according to the scanning parameters and the resolution of the grid map.
3. The method for generating virtual laser data according to claim 1, characterized in that: Also includes: When the grid value of the current grid indicates that the current grid is not occupied, but the current grid is located on the boundary of the grid map, the previous grid of the current grid is used as the target end position of the virtual scan line.
4. The method for generating virtual laser data according to claim 1, characterized in that: After the target grid determined from the grid map is used as the target end position of the virtual scan line, the method includes: Obtaining a virtual ray distance between the starting point position and the target end point position; The virtual ray distance is used as the scanning distance data of the virtual scanning line.
5. The method for generating virtual laser data according to claim 1, characterized in that: Combining the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate current virtual laser data includes: The currently detected posture data of the target object, the angle data and the scanning distance data corresponding to each virtual scanning line are combined to generate the current virtual laser data.
6. A device for generating virtual laser data, characterized in that: include: An acquisition module, used to acquire a grid map corresponding to the real environment where the target object is currently located, wherein different grids contained in the grid map are respectively configured with grid values, and the grid values are used to indicate the occupied state of the grids; A first determination module, configured to determine a candidate end point position corresponding to a virtual scan line to be generated based on a scan parameter of the virtual scan line configured for the target object; The second determination module is used to perform the following operations on each of the virtual scan lines: taking the current position of the target object in the grid map as the starting point, extending in the direction of the candidate end position of the virtual scan line, and sequentially traversing each grid passed by the virtual scan line as the current grid; when the grid value of the current grid indicates that the current grid is occupied, taking the previous grid of the current grid as the target end position of the virtual scan line, wherein when the grid value is a first value, it indicates that the grid corresponding to the grid value is in a state occupied by a real obstacle, when the grid value is a second value, it indicates that the grid corresponding to the grid value is in a state occupied by a virtual obstacle, and when the grid value is a third value, it indicates that the grid corresponding to the grid value is in an unoccupied state; A generation module is used to combine the currently detected posture data of the target object and the scanning distance data acquired based on the target end position to generate current virtual laser data.
7. The device for generating virtual laser data according to claim 6, characterized in that: The first determining module comprises: An acquisition unit, configured to acquire scanning parameters of the virtual scanning line, wherein the scanning parameters include a maximum scanning detection distance, a scanning detection angle range, and an interval angle between virtual scanning lines; A determination unit is used to determine the position coordinates of the candidate terminal position in the grid map according to the scanning parameters and the resolution of the grid map.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 5 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.
