Lidar-based mapping method and related apparatus
By scanning and matching the current laser frame of the lidar and correcting the odometry pose, the longitudinal error problem of 2D lidar mapping in long corridor environments was solved, ensuring the positioning accuracy of the robot in long corridor environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN PUDU TECH CO LTD
- Filing Date
- 2021-12-14
- Publication Date
- 2026-06-02
Smart Images

Figure CN116263505B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of robot localization technology, and in particular to a mapping method based on lidar; it also relates to a lidar-based mapping device, a robot, and a computer-readable storage medium. Background Technology
[0002] Currently, indoor mobile robots mostly use 2D LiDAR as the primary positioning sensor for localization. Localization using 2D LiDAR requires first establishing a localization map using SLAM (Simultaneous Localization and Mapping). However, in long corridors, the 2D LiDAR-based mapping suffers from reduced observation constraints, resulting in a shorter corridor length in the constructed grid map compared to the actual corridor length. This is because in long corridors, the LiDAR can only scan the side walls, not objects at the end of the corridor. Consequently, the longitudinal direction of the corridor lacks proper constraint during scanning and matching. The current LiDAR frame moves longitudinally to match the previous frame, causing the output pose to deviate from the correct pose, ultimately resulting in a shorter corridor length in the constructed grid map than the actual corridor length. An incorrect map can cause localization errors or loss of localization during subsequent tasks. Therefore, providing a mapping scheme that can create an accurate map to ensure effective localization of the mobile robot has become a pressing technical problem for those skilled in the art. Summary of the Invention
[0003] The purpose of this application is to provide a LiDAR-based mapping method that can create accurate maps in long corridor environments, ensuring the localization effect of subsequent mobile robots. Another purpose of this application is to provide a LiDAR-based mapping device, robot, and computer-readable storage medium, all of which achieve the aforementioned technical effects.
[0004] To address the aforementioned technical problems, this application provides a mapping method based on lidar, comprising:
[0005] Perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose;
[0006] Determine if the robot is in a long corridor;
[0007] If the robot is in a long corridor, the previous updated pose is corrected based on the scan-matched pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose.
[0008] The corrected pose is used as the current updated pose, and the map is updated according to the current updated pose.
[0009] Optionally, the step of correcting the previous updated pose based on the scan-matched pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose, includes:
[0010] The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame;
[0011] The matching increment is obtained based on the scan matching pose and the previous updated pose;
[0012] The longitudinal change of the matching increment is replaced with the longitudinal change of the mileage increment to obtain the corrected increment;
[0013] The corrected pose is obtained based on the correction increment and the previous updated pose.
[0014] Optionally, the mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame, including:
[0015] The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
[0016] Optionally, obtaining the matching increment based on the scan matching pose and the previous updated pose includes:
[0017] The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
[0018] Optionally, obtaining the corrected pose based on the corrected increment and the previous updated pose includes:
[0019] The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
[0020] Optionally, determining whether the robot is in a long corridor includes:
[0021] Extract the line segments from the current laser frame;
[0022] When the number of extracted line segments is two, determine whether the two line segments are parallel;
[0023] If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range;
[0024] If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold.
[0025] If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
[0026] To address the aforementioned technical problems, this application also provides a mapping device based on lidar, comprising:
[0027] The scanning matching module is used to perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose;
[0028] The judgment module is used to determine whether the robot is in a long corridor;
[0029] The correction module is used to correct the previous updated pose and obtain the corrected pose if the robot is in the long corridor, based on the scan matching pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame.
[0030] The update module is used to use the corrected pose as the current update pose and update the map according to the current update pose.
[0031] To address the aforementioned technical problems, this application also provides a robot, comprising:
[0032] Memory, used to store computer programs;
[0033] A processor, when executing the computer program, performs the following steps:
[0034] Perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose;
[0035] Determine if the robot is in a long corridor;
[0036] If the robot is in a long corridor, the previous updated pose is corrected based on the scan-matched pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose.
[0037] The corrected pose is used as the current updated pose, and the map is updated according to the current updated pose.
[0038] Optionally, when the processor executes the computer program, it specifically implements the following steps:
[0039] The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame;
[0040] The matching increment is obtained based on the scan matching pose and the previous updated pose;
[0041] The longitudinal change of the matching increment is replaced with the longitudinal change of the mileage increment to obtain the corrected increment;
[0042] The corrected pose is obtained based on the correction increment and the previous updated pose.
[0043] Optionally, when the processor executes the computer program, it specifically implements the following steps:
[0044] The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
[0045] Optionally, when the processor executes the computer program, it specifically implements the following steps:
[0046] The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
[0047] Optionally, when the processor executes the computer program, it specifically implements the following steps:
[0048] The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
[0049] Optionally, when the processor executes the computer program, it specifically implements the following steps:
[0050] Extract the line segments from the current laser frame;
[0051] When the number of extracted line segments is two, determine whether the two line segments are parallel;
[0052] If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range;
[0053] If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold.
[0054] If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
[0055] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the lidar-based mapping method described in any of the preceding claims.
[0056] The mapping method based on LiDAR provided in this application includes: performing scanning matching on the current laser frame of the LiDAR to obtain a scanning matching pose; determining whether the robot is in a long corridor; if the robot is in the long corridor, correcting the previous updated pose according to the scanning matching pose, the odometer pose corresponding to the current laser frame output by the odometry and the odometer pose corresponding to the previous laser frame to obtain a corrected pose; using the corrected pose as the current updated pose, and updating the map according to the current updated pose.
[0057] As can be seen, the LiDAR-based mapping method provided in this application determines whether the robot is in a long corridor during the mapping process. When the robot is in a long corridor, it corrects the previous updated pose based on the scan-matched pose obtained by scanning the current laser frame, the odometry pose corresponding to the current laser frame output by the odometry, and the odometry pose corresponding to the previous laser frame. The corrected pose is then used as the current updated pose to correct the longitudinal error of the scan-match in the long corridor, thereby establishing a correct map in the long corridor environment and ensuring the localization effect when the robot performs subsequent tasks.
[0058] The lidar-based mapping device, robot, and computer-readable storage medium provided in this application all have the aforementioned technical effects. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a schematic flowchart of a mapping method based on LiDAR provided in an embodiment of this application;
[0061] Figure 2 This is a schematic diagram of the X-axis and Y-axis of a robot provided in an embodiment of this application;
[0062] Figure 3 A schematic diagram of a lidar-based mapping device provided in an embodiment of this application;
[0063] Figure 4 This is a schematic diagram of a robot provided in an embodiment of this application. Detailed Implementation
[0064] The core of this application is to provide a mapping method based on LiDAR, which can create accurate maps in long corridor environments, ensuring the localization effect of subsequent mobile robots. Another core aspect of this application is to provide a LiDAR-based mapping device, robot, and computer-readable storage medium, all of which possess the aforementioned technical advantages.
[0065] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0066] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a lidar-based mapping method provided in an embodiment of this application. (Refer to...) Figure 1 As shown, the method includes:
[0067] S101: Perform scan matching on the current laser frame of the lidar to obtain the scan matching pose;
[0068] Specifically, based on the robot's odometer to predict the robot's pose, and using the predicted pose as an initial value, the current laser frame of the LiDAR is scan-matched with the map or the previous laser frame to obtain the scan-matched pose. The specific implementation process of scanning and matching the current laser frame of the LiDAR with the map or the previous laser frame to obtain the scan-matched pose is not detailed here; the scanning and matching process can be found in existing mapping schemes.
[0069] S102: Determine if the robot is in a long corridor;
[0070] Specifically, before updating the map, this application first determines whether the robot is in a long corridor, so as to perform pose correction when the robot is in a long corridor.
[0071] In one specific implementation, the method for determining whether a robot is in a long corridor is as follows:
[0072] Extract line segments from the current laser frame;
[0073] When the number of extracted line segments is two, determine whether the two line segments are parallel;
[0074] If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range;
[0075] If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold.
[0076] If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
[0077] Specifically, refer to Figure 2 As shown ( Figure 2 The X and Y axes in the image refer to the robot's X and Y axes, respectively. Line segments in the current laser frame can be extracted using a laser line segment feature extraction method based on seed region growth. If two line segments are extracted from the current laser frame, it is further determined whether these two line segments are parallel. If the two line segments are parallel, it is determined whether the angle between each line segment and the robot's X-axis is within a target angle range. If the angle between each line segment and the robot's X-axis is within the target angle range, it is further determined whether the number of laser points between the two line segments is less than a preset threshold. If the number of laser points between the two line segments is less than the preset threshold, the robot is considered to be in a long corridor.
[0078] Conversely, if the angle between each line segment and the robot's X-axis is not within the target angle range, or if the angle between each line segment and the robot's X-axis is within the target angle range, but the number of laser points between two line segments is not less than a preset threshold, then the robot is considered not to be in the long corridor.
[0079] The target angle range may include -70° to 70°, 110° to 180°, and -110° to -180°. That is, if the angle between each line segment and the robot's X-axis falls within any of these ranges, then it is further determined whether the number of laser points between two line segments is less than a preset threshold.
[0080] Determining whether a location is within a long corridor by judging line segments offers faster processing speed and more accurate results.
[0081] It is clear that, in addition to the methods mentioned above for determining whether a robot is in a long corridor, other methods such as image recognition and deep learning can also be used. This application does not limit this to a single method and allows for different approaches.
[0082] In addition to the above method of first extracting line segments from the current laser frame and then determining whether the extracted line segments are parallel to obtain two parallel line segments, a random sampling and calculation method can also be used to directly extract parallel line segments from the laser point cloud.
[0083] Furthermore, the step of determining whether the robot is in a long corridor can be performed before or after scanning and matching the current laser frame of the LiDAR.
[0084] S103: If the robot is in the long corridor, then the previous updated pose is corrected according to the scan matching pose, the odometer pose corresponding to the current laser frame output by the odometer and the odometer pose corresponding to the previous laser frame, so as to obtain the corrected pose.
[0085] S104: Use the corrected pose as the current updated pose, and update the map according to the current updated pose;
[0086] S105: If the robot is not in the long corridor, update the map according to the scan-matched pose.
[0087] Specifically, if the robot is not in a long corridor, the scan-matched pose obtained by scanning and matching the current laser frame is used as the current updated pose to update the map. If the robot is in a long corridor, the previous updated pose is first corrected based on the scan-matched pose obtained by scanning and matching the current laser frame, the odometry pose of the current laser frame output by the odometry, and the odometry pose corresponding to the previous laser frame, to obtain the corrected pose. The obtained corrected pose is then used as the current updated pose to update the map.
[0088] Similarly, this application will not elaborate on the specific implementation process of updating the map based on pose; existing map updating processes can be referenced.
[0089] Among them, the scanning matching pose, the mileage pose corresponding to the current laser frame output by the odometer, and the mileage pose corresponding to the previous laser frame are all matrices composed of x-coordinate values, y-coordinate values, and rotation angle values.
[0090] In one specific implementation, the previous updated pose is corrected based on the scan matching pose, the mileage pose corresponding to the current laser frame output by the odometer, and the mileage pose corresponding to the previous laser frame. The corrected pose is obtained by: obtaining the mileage increment based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame; obtaining the matching increment based on the scan matching pose and the previous updated pose; replacing the vertical change of the matching increment with the vertical change of the mileage increment to obtain the corrected increment; and obtaining the corrected pose based on the corrected increment and the previous updated pose.
[0091] The method for obtaining the mileage increment based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame can be as follows:
[0092] The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
[0093] The method for obtaining the matching increment based on the scanned matching pose and the previous updated pose can be as follows:
[0094] The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
[0095] The corrected pose can be obtained by combining the correction increment with the previous updated pose in the following way:
[0096] The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
[0097] Specifically, based on Receive mileage increments. o T lc Indicates mileage increment. o T l This indicates the mileage pose corresponding to the previous laser frame. o T c This indicates the odometer pose corresponding to the current laser frame. Based on... Obtain the matching increment. m T lc Indicates matching increment, m T l This indicates the updated pose used for map updating corresponding to the previous laser frame. m T c This represents the scan-matched pose obtained by scanning and matching the current laser frame. The odometer increment and the matching increment are also matrices composed of X-coordinate values, Y-coordinate values, and rotation angle values. The odometer increment can be equivalently represented as... o x lc , o y lc , o θ lc The matching increment can be equivalently represented as: m x lc , m y lc , m θ lc Furthermore, the longitudinal change of the mileage increment, i.e., the X-axis change, is used to replace the longitudinal change of the matching increment to obtain the corrected increment. x T lc Correcting the increment x T lc It can be equivalently represented as o x lc , m y lc ,m θ lc Furthermore, based on The previous updated pose is corrected to obtain the corrected pose, which is then used as the current updated pose to update the map. This current updated pose is the previous updated pose when the next laser frame arrives.
[0098] The robot's X-axis is the direction of its forward movement. In a long corridor environment, the robot's scenario is similar. Since the robot determines its displacement by comparing the corresponding laser frames at different positions, in a long corridor environment, the laser frames taken at different positions may be the same or extremely similar. Therefore, when the laser frames taken at different positions are the same, it will lead to inaccurate displacement calculation, that is, the X-axis will be inaccurate. Therefore, this embodiment uses the longitudinal change of the mileage increment to replace the longitudinal change of the matching increment to correct the longitudinal error.
[0099] In addition to the above-mentioned scheme of correcting the pose based on the scan matching pose, the odometer output of the current laser frame corresponding to the odometer pose, and the odometer pose corresponding to the previous laser frame, for simplicity, the predicted pose can also be directly used to replace the scan matching pose.
[0100] In summary, the LiDAR-based mapping method provided in this application determines whether the robot is in a long corridor during the mapping process. When the robot is in a long corridor, it corrects the previous updated pose based on the scan-matched pose obtained by scanning the current laser frame, the odometry pose corresponding to the current laser frame output by the odometry, and the odometry pose corresponding to the previous laser frame. The corrected pose is then used as the current updated pose to correct the longitudinal error of the scan-match in the long corridor, thereby establishing a correct map in the long corridor environment and ensuring the localization effect when the robot performs subsequent tasks.
[0101] This application also provides a mapping device based on lidar, which can be referred to in conjunction with the method described above. Please refer to... Figure 3 , Figure 3 This is a schematic diagram of a lidar-based mapping device provided in an embodiment of this application, combined with... Figure 3 As shown, the device includes:
[0102] The scanning matching module 10 is used to perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose;
[0103] Module 20 is used to determine whether the robot is in a long corridor;
[0104] The correction module 30 is used to correct the previous updated pose and obtain the corrected pose if the robot is in the long corridor, based on the scan matching pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame.
[0105] The update module 40 is used to use the corrected pose as the current update pose and update the map according to the current update pose.
[0106] Optionally, based on the above embodiments, the correction module 30 includes:
[0107] The mileage increment calculation unit is used to obtain the mileage increment based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame.
[0108] The matching increment calculation unit is used to obtain the matching increment based on the scan matching pose and the previous updated pose;
[0109] The correction increment calculation unit is used to replace the longitudinal change of the matching increment with the longitudinal change of the mileage increment to obtain the correction increment;
[0110] The pose correction calculation unit is used to obtain the corrected pose based on the correction increment and the previous updated pose.
[0111] Based on the above embodiments, the mileage increment calculation unit is specifically used for:
[0112] The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
[0113] Based on the above embodiments, optionally, the matching incremental calculation unit is specifically used for:
[0114] The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
[0115] Based on the above embodiments, optionally, the pose correction calculation unit is specifically used for:
[0116] The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
[0117] Based on the above embodiments, optionally, the determination module 20 is specifically used for:
[0118] Extract the line segments from the current laser frame;
[0119] When the number of extracted line segments is two, determine whether the two line segments are parallel;
[0120] If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range;
[0121] If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold.
[0122] If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
[0123] Based on the above embodiments, optionally, the target angle range includes -70° to 70°, 110° to 180°, and -110° to -180°.
[0124] The LiDAR-based mapping device provided in this application determines whether the robot is in a long corridor during the mapping process. When the robot is in a long corridor, it corrects the previous updated pose based on the scan-matched pose obtained by scanning and matching the current laser frame, the odometer pose corresponding to the current laser frame, and the odometer pose corresponding to the previous laser frame. The corrected pose is then used as the current updated pose to correct the longitudinal error of the scan-matching in the long corridor, thereby establishing a correct map in the long corridor environment and ensuring the positioning effect when the robot performs subsequent tasks.
[0125] This application also provides a robot, as shown in the reference. Figure 4 As shown, the robot includes a memory 1 and a processor 2, and also includes a lidar and an odometer.
[0126] Memory 1 is used to store computer programs;
[0127] Processor 2 is used to execute computer programs to perform the following steps:
[0128] The current laser frame of the LiDAR is scanned and matched to obtain the scan-matched pose; it is determined whether the robot is in the long corridor; if the robot is in the long corridor, the previous updated pose is corrected according to the scan-matched pose, the odometer pose corresponding to the current laser frame, and the odometer pose corresponding to the previous laser frame to obtain the corrected pose; the corrected pose is used as the current updated pose, and the map is updated according to the current updated pose.
[0129] Based on the above embodiments, as a specific implementation method, the processor 2 executes the computer program to specifically implement the following steps:
[0130] The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame;
[0131] The matching increment is obtained based on the scan matching pose and the previous updated pose;
[0132] The longitudinal change of the matching increment is replaced with the longitudinal change of the mileage increment to obtain the corrected increment;
[0133] The corrected pose is obtained based on the correction increment and the previous updated pose.
[0134] Based on the above embodiments, as a specific implementation method, the processor 2 executes the computer program to specifically implement the following steps:
[0135] The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
[0136] Based on the above embodiments, as a specific implementation method, the processor 2 executes the computer program to specifically implement the following steps:
[0137] The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
[0138] Based on the above embodiments, as a specific implementation method, the processor 2 executes the computer program to specifically implement the following steps:
[0139] The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
[0140] Based on the above embodiments, as a specific implementation method, the processor 2 executes the computer program to specifically implement the following steps:
[0141] Extract the line segments from the current laser frame;
[0142] When the number of extracted line segments is two, determine whether the two line segments are parallel;
[0143] If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range;
[0144] If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold.
[0145] If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
[0146] Based on the above embodiments, as a specific implementation method, the target angle range includes -70° to 70°, 110° to 180°, and -110° to -180°.
[0147] Among them, robots can be mobile robots, self-moving platforms, and other types of robots.
[0148] For a description of the robot provided in this application, please refer to the above method embodiments; further details will not be provided here.
[0149] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:
[0150] The current laser frame of the LiDAR is scanned and matched to obtain the scan-matched pose; it is determined whether the robot is in the long corridor; if the robot is in the long corridor, the previous updated pose is corrected according to the scan-matched pose, the odometer pose corresponding to the current laser frame, and the odometer pose corresponding to the previous laser frame to obtain the corrected pose; the corrected pose is used as the current updated pose, and the map is updated according to the current updated pose.
[0151] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0152] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.
[0153] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus, robot, and computer-readable storage medium disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant details can be found in the method section.
[0154] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0155] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0156] The foregoing has provided a detailed description of the lidar-based mapping method, apparatus, robot, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application; the descriptions of these embodiments are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A mapping method based on lidar, characterized in that, include: Perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose; Determine if the robot is in a long corridor; If the robot is in a long corridor, the previous updated pose is corrected based on the scan-matched pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose. The corrected pose is used as the current updated pose, and the map is updated according to the current updated pose; The step of correcting the previous updated pose based on the scan-matched pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose, includes: The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame; The matching increment is obtained based on the scan matching pose and the previous updated pose; The longitudinal change of the matching increment is replaced with the longitudinal change of the mileage increment to obtain the corrected increment; The corrected pose is obtained based on the correction increment and the previous updated pose.
2. The mapping method according to claim 1, characterized in that, The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame, including: The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
3. The mapping method according to claim 2, characterized in that, The step of obtaining the matching increment based on the scanned matching pose and the previous updated pose includes: The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
4. The mapping method according to claim 3, characterized in that, The step of obtaining the corrected pose based on the corrected increment and the previous updated pose includes: The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
5. The mapping method according to claim 1, characterized in that, The determination of whether the robot is in a long corridor includes: Extract the line segments from the current laser frame; When the number of extracted line segments is two, determine whether the two line segments are parallel; If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range; If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold. If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
6. A mapping device based on lidar, characterized in that, include: The scanning matching module is used to perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose; The judgment module is used to determine whether the robot is in a long corridor; The correction module is used to correct the previous updated pose and obtain the corrected pose if the robot is in the long corridor, based on the scan matching pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame. An update module is used to use the corrected pose as the current update pose and update the map according to the current update pose. The correction module includes: The mileage increment calculation unit is used to obtain the mileage increment based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame. The matching increment calculation unit is used to obtain the matching increment based on the scan matching pose and the previous updated pose; The correction increment calculation unit is used to replace the longitudinal change of the matching increment with the longitudinal change of the mileage increment to obtain the correction increment; The pose correction calculation unit is used to obtain the corrected pose based on the correction increment and the previous updated pose.
7. A robot, characterized in that, include: LiDAR, odometer and Memory, used to store computer programs; A processor, when executing the computer program, performs the following steps: Perform scanning matching on the current laser frame of the lidar to obtain the scanning matching pose; Determine if the robot is in a long corridor; If the robot is in a long corridor, the previous updated pose is corrected based on the scan matching pose, the odometer pose corresponding to the current laser frame output by the odometer, and the odometer pose corresponding to the previous laser frame, to obtain the corrected pose. The corrected pose is used as the current updated pose, and the map is updated according to the current updated pose; When the processor executes the computer program, it specifically implements the following steps: The mileage increment is obtained based on the mileage pose corresponding to the current laser frame and the mileage pose corresponding to the previous laser frame; The matching increment is obtained based on the scan matching pose and the previous updated pose; The longitudinal change of the matching increment is replaced with the longitudinal change of the mileage increment to obtain the corrected increment; The corrected pose is obtained based on the correction increment and the previous updated pose.
8. The robot according to claim 7, characterized in that, When the processor executes the computer program, it specifically implements the following steps: The mileage increment is obtained by multiplying the mileage pose corresponding to the current laser frame with the inverse matrix of the mileage pose corresponding to the previous laser frame.
9. The robot according to claim 8, characterized in that, When the processor executes the computer program, it specifically implements the following steps: The matching increment is obtained by multiplying the scan matching pose by the inverse matrix of the previous updated pose.
10. The robot according to claim 9, characterized in that, When the processor executes the computer program, it specifically implements the following steps: The corrected pose is obtained by multiplying the correction increment by the previous updated pose.
11. The robot according to claim 7, characterized in that, When the processor executes the computer program, it specifically implements the following steps: Extract the line segments from the current laser frame; When the number of extracted line segments is two, determine whether the two line segments are parallel; If the two line segments are parallel, then determine whether the angle between each line segment and the robot's X-axis is within the target angle range; If the angle between each line segment and the robot's X-axis is within the target angle range, then determine whether the number of laser points between two line segments is less than a preset threshold. If the number of laser points between two line segments is less than the preset threshold, then the robot is in the long corridor.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the lidar-based mapping method as described in any one of claims 1 to 5.