Point cloud correction value acquisition method, chip and robot
Patent Information
- Application Number
- CN202510473155.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2026-10-30
AI Technical Summary
机器人以与机器人的正前方平行的竖直平面作为参照物,获取激光头的0度角与机器人的正前方的夹角后,自动校准激光头的角度,但是对于直线型障碍物之外的其它形状的障碍物轮廓不能有效地计算出校准角度,也没有校准点云的坐标位置信息,导致校准后的激光头所执行的障碍物检测功能以及障碍物碰撞预防功能,对复杂环境的适应性较低,亟需计算激光点云存在的实时位姿误差以便于后续补偿
Smart Images

Figure CN123010717A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of point cloud data processing technology, and is particularly applicable to methods for obtaining correction values of point clouds, chips, and robots. Background Technology
[0002] Current robotic vacuum cleaners designed for inertial sensor navigation use physical collision barriers to detect and respond to obstacles, thus avoiding dangerous situations. However, the assembly cost of these collision barriers is significant in factory production. In machines without physical collision barriers, not only is precise calculation of collision markers and angles required, but also the establishment of a real-time response mechanism equivalent to a collision structure.
[0003] Chinese invention patent application number 202011236430.5 discloses a method for calibrating the angle of a laser head. The method requires a robot to acquire several frames of laser data and combine them. Then, line segments are obtained from the laser data by fitting straight lines. Line segments with a length greater than a preset length value and a number of data points greater than a preset value are designated as specific line segments. The robot obtains the angle between the positioning line segment and the 0-degree emission direction of the laser head. S5: The robot calibrates the angle of the laser head based on the angle. The robot uses a vertical plane parallel to its front as a reference. After obtaining the angle between the 0-degree angle of the laser head and the front of the robot, it automatically calibrates the angle of the laser head. However, it cannot effectively calculate the calibration angle for obstacle contours other than straight obstacles, and it lacks coordinate position information for the calibration point cloud. This results in low adaptability of the obstacle detection and collision prevention functions performed by the calibrated laser head to complex environments. Therefore, it is urgent to calculate the real-time pose error of the laser point cloud for subsequent compensation. Summary of the Invention
[0004] This application aims to provide a method for obtaining the correction values of point clouds, a chip, and a robot. The specific technical solution is as follows:
[0005] A method for obtaining correction values of point clouds is implemented by a robot equipped with an encoder and a laser sensor. After the robot acquires a frame of point cloud data using the laser sensor, it moves towards the location of the point cloud frame and measures the movement distance using the encoder during the movement. The correction value acquisition method is executed during this movement, and includes: Step A: Sampling the movement distance measured by the encoder according to a preset sampling period, converting the sampled movement distance within each preset sampling period into a periodic sampling distance and a periodic sampling angle, and storing the periodic sampling distance and periodic sampling angle for each preset sampling period; then executing Step B; Step B: Sampling the point cloud data according to the preset sampling period and unit angle. The ratio of sampling time is set to determine the angle index traversal range corresponding to the robot within a preset sampling period. Then, within the corresponding angle index traversal range, the reference distances saved in each preset sampling period are accumulated according to the same angle index value to obtain the point cloud distance correction value corresponding to the same angle index value. The reference angles saved in each preset sampling period are also accumulated according to the same angle index value to obtain the point cloud angle correction value corresponding to the same angle index value. The point cloud distance correction value and the point cloud angle correction value corresponding to the same angle index value are combined to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's movement. Here, one preset sampling period corresponds to one angle index traversal range, and one angle index traversal range can be divided into multiple angle index values.
[0006] Based on this, this application dynamically superimposes periodic sampling distances according to a preset sampling period to obtain point cloud distance correction values, and dynamically superimposes periodic sampling angles according to a preset sampling period to obtain point cloud angle correction values. Thus, by accumulating the periodic sampling distances and angles calculated within each preset sampling period, the allowable movement distance (point cloud distance correction value) and movement angle (point cloud angle correction value) for the corresponding point cloud correction are calculated. This allows each point in the point cloud to be indexed with its corresponding point cloud distance correction value and point cloud angle correction value to compensate for the offset caused by the robot's movement relative to obstacles. This is equivalent to the robot compensating for the maximum offset of a given frame of point cloud. The point cloud distance correction value and point cloud angle correction value accumulated within the motion time (greater than or equal to the multiple preset sampling periods) of the obstacles distributed at the nearest point cloud frame can be used to predict the relative motion position of the point cloud frame within the same time period, thereby improving the real-time correction accuracy. In addition, if the motion time (greater than or equal to the multiple preset sampling periods) of the linear obstacles (e.g., walls) distributed at the nearest point cloud frame meets the code disk measurement accuracy requirements, the contour line formed by the correction of the point cloud frame will be straighter, which can avoid the line segment distortion phenomenon in the laser sensor detection image to a certain extent.
[0007] Further, in step B, the method for setting the angle index traversal range of the robot within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time includes: calculating the ratio of the preset sampling period to the unit angle sampling time to obtain the predicted angle value scanned in a single preset sampling period; controlling the addition of the starting angle index value to the predicted angle value scanned in a single preset sampling period to obtain the ending angle index value; calculating the target upper limit index value based on the ending angle index value, and then configuring the target upper limit index value as the upper limit value of the angle index traversal range; wherein, the point cloud frame is the point cloud collected by the robot during a scan using a laser sensor; wherein, the target upper limit index value is used to represent the maximum number of point clouds that the laser sensor is allowed to collect within a single preset sampling period. This makes the predicted angle value scanned in a single preset sampling period the offset between the starting angle index values of two adjacent preset sampling periods.
[0008] Further, the method for calculating the target upper limit index value based on the end angle index value includes: detecting the size relationship between the point cloud angle start index value and the end angle index value; when the point cloud angle start index value is detected to be less than the end angle index value, controlling the end angle index value to subtract the point cloud angle start index value to obtain the target upper limit index value; when the point cloud angle start index value is detected to be greater than or equal to the end angle index value, controlling 360 to subtract the point cloud angle start index value, and then adding the difference obtained by the subtraction to the end angle index value to obtain the target upper limit index value; wherein, the point cloud angle start index value is used to represent the angle index value of the first point in the point cloud frame acquired by the laser sensor. In summary, this application calculates the target upper limit index value based on the relationship between the starting and ending angle index values of the point cloud and configures it as the upper limit value of the angle index traversal range. Thus, for point cloud scanning crossing the 0-degree / 360-degree boundary, it utilizes the cyclic characteristics of the point cloud in the 360-degree scan to calculate the target upper limit index value, keeping the upper limit value of the angle index traversal range positive and avoiding negative values caused by the cyclic boundary, thereby ensuring the continuity and correctness of the angle index value calculation.
[0009] Further, step B specifically includes: Step B1, starting from the first address of the target memory space, traversing the periodic sampling distance and periodic sampling angle stored in the target memory space in step A, and determining whether the traversal has reached the last address of the target memory space. If yes, proceed to step B8; otherwise, proceed to step B2. Wherein, step A controls the periodic sampling distance and periodic sampling angle to be stored starting from the last address of the target memory space; Step B2, calculating the target upper limit index value by executing the method of setting the robot's corresponding angle index traversal range within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time, and simultaneously setting the current index value within the current preset range. If the current index value is equal to 0 within the sampling period, then proceed to step B3; Step B3: Determine if the current index value mentioned in step B2 is less than the target upper limit index value mentioned in step B2. If yes, proceed to step B4; otherwise, proceed to step B7; Step B4: Determine if the current index value mentioned in step B2 is within the angle index traversal range, and control the sum of the current index value mentioned in step B2 and the point cloud angle starting index value to be modulo 360 to generate the angle index value; then proceed to step B5; Step B5: Control the periodic sampling distance stored in the target memory space within the current preset sampling period to add the distance period correction value corresponding to the same angle index value, and obtain the distance period corresponding to the same angle index value. The correction value is set, and the distance period correction value corresponding to the same angle index value is updated to the preset distance period correction value corresponding to the same angle index value; and the period sampling angle stored in the target memory space within the current preset sampling period is added to the preset angle period correction value corresponding to the same angle index value to obtain the angle period correction value corresponding to the same angle index value, and the angle period correction value corresponding to the same angle index value is updated to the preset angle period correction value corresponding to the same angle index value; then step B6 is executed; step B6: the current index value mentioned in step B2 is automatically incremented by one, and then the automatically incremented current index value is updated to the current index value mentioned in step B2. Then execute step B3; Step B7: Update the end angle index value to the start angle index value, and update the next preset sampling period to the current preset sampling period. Then execute step B1 to traverse the periodic sampling distance and periodic sampling angle stored in the next preset sampling period from the target memory space; Step B8: Determine that all periodic sampling distances and all periodic sampling angles in the target memory space have been accumulated, and set the distance periodic correction value corresponding to the latest updated same angle index value to the point cloud distance correction value corresponding to the same angle index value, and set the angle periodic correction value corresponding to the latest updated same angle index value to the point cloud angle correction value corresponding to the same angle index value.
[0010] In summary, by dynamically updating the distance periodic correction value and the angle periodic correction value through steps B1 to B8, the point cloud distance correction value required for each angle index value is obtained by continuously superimposing the periodic sampling distance stored within different preset sampling periods on the distance periodic correction value. Similarly, the point cloud angle correction value required for each angle index value is obtained by continuously superimposing the periodic sampling angle stored within different preset sampling periods on the angle periodic correction value. These values describe the translation and rotation of each point in the point cloud relative to the moving robot, which is equivalent to predicting the motion of the point cloud and achieving cumulative error compensation. This is superior to fixed parameter correction and facilitates subsequent compensation of the corresponding distance and angle.
[0011] Furthermore, each time step B7 is executed, the updated starting angle index value is increased once. Then, steps B1 and B2 are executed, which increases the target upper limit index value calculated in step B2 once. This leads to an expansion of the traversal range of the corresponding angle index within the current preset sampling period. It also achieves the correction of more point cloud angle regions by adding the latest periodic sampling distance and periodic sampling angle stored in the target memory space every preset sampling period, which is suitable for real-time processing.
[0012] Further, when the number of executions of steps B1 to B7 reaches a preset target number, step B8 is executed, and it is determined that the robot has experienced a preset target number of preset sampling periods. Then, the point cloud distance correction value and point cloud angle correction value corresponding to the same angle index value are used to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's movement. The point cloud distance correction value corresponding to the same angle index value is equal to the cumulative value of the reference distance within the preset target number of preset sampling periods, and the point cloud angle correction value corresponding to the same angle index value is equal to the cumulative value of the reference angle within the preset target number of preset sampling periods. The preset target number is determined by the measurement accuracy of the encoder. Thus, by executing steps B1 to B8, the distance period correction value and angle period correction value are dynamically updated, ensuring that the finally set point cloud distance correction value and point cloud angle correction value have a real-time correction advantage over multiple preset sampling periods.
[0013] Further, in step A, the method for converting the periodic sampling distance and periodic sampling angle includes: calculating the difference between the motion distance measured by the encoder mounted on the robot's left drive wheel at the current moment and the motion distance measured at the reference moment, to obtain the left drive wheel motion distance; calculating the difference between the motion distance measured by the encoder mounted on the robot's right drive wheel at the current moment and the motion distance measured at the reference moment, to obtain the right drive wheel motion distance; calculating half the sum of the left drive wheel motion distance and the right drive wheel motion distance, to obtain the periodic sampling distance; calculating the ratio of the difference between the left drive wheel motion distance and the right drive wheel motion distance to the wheelbase, to obtain the periodic sampling angle; wherein, the start time of the preset sampling period is the reference time, and the end time of the preset sampling period is the current moment; the distance between the robot's left drive wheel and its right drive wheel is equal to the wheelbase; the motion distance sampled within the preset sampling period is divided into the left drive wheel motion distance and the right drive wheel motion distance. Thus, based on kinematic formulas, the left drive wheel motion distance and the right drive wheel motion distance are converted into periodic sampling distance and periodic sampling angle, forming the robot's motion parameters within a single preset sampling period.
[0014] Furthermore, after calculating the periodic sampling distance and periodic sampling angle, the motion distance measured by the encoder mounted on the robot's left drive wheel at the current moment is updated to the motion distance measured by the encoder mounted on the robot's left drive wheel at the reference moment; and the motion distance measured by the encoder mounted on the robot's right drive wheel at the current moment is updated to the motion distance measured by the encoder mounted on the robot's right drive wheel at the reference moment, so as to facilitate the execution of steps A and B from the current preset sampling period to the next preset sampling period. Therefore, when executing step A again, the motion distance measured by the encoder mounted on the robot's left drive wheel at the current moment is directly subtracted from the motion distance measured at the reference moment to obtain the motion distance of the left drive wheel corresponding to the next preset sampling period; and the motion distance measured by the encoder mounted on the robot's right drive wheel at the current moment is directly subtracted from the motion distance measured at the reference moment to obtain the motion distance of the right drive wheel corresponding to the next preset sampling period.
[0015] A chip storing a computer program, which, when executed, implements the steps of the correction value acquisition method. The chip disclosed in this application dynamically superimposes periodic sampling distances according to a preset sampling period to obtain point cloud distance correction values, and dynamically superimposes periodic sampling angles according to a preset sampling period to obtain point cloud angle correction values. This allows for the accumulation of the periodic sampling distances and angles calculated within each preset sampling period to calculate the allowable movement distance (point cloud distance correction value) and movement angle (point cloud angle correction value) for the corresponding point cloud correction. This enables each point in the point cloud to be indexed with its corresponding point cloud distance correction value and point cloud angle correction value to compensate for the offset caused by the robot's movement relative to obstacles. Furthermore, if the movement time (greater than or equal to multiple preset sampling periods) required to reach the linear obstacles (e.g., walls) distributed in the nearest point cloud frame meets the encoder measurement accuracy requirements, then after the chip corrects the point cloud frame using the point cloud distance correction values and point cloud angle correction values corresponding to the angle index values obtained by the correction value acquisition method, the resulting contour lines are straighter, thus avoiding to some extent the line segment distortion phenomenon present in the laser sensor-detected image.
[0016] A robot equipped with the aforementioned chip. By executing the correction value acquisition method, the robot compensates for the point cloud frame by accumulating point cloud distance correction values and point cloud angle correction values within the movement time (greater than or equal to the multiple preset sampling periods) spent moving towards the obstacles distributed in the point cloud frame in the nearest step. This helps predict the relative movement position of the point cloud frame within the same time period, improving real-time correction accuracy. Subsequently, the robot can use the corresponding correction values to directly predict the real-time position of obstacles and avoid them in advance. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating a method for obtaining correction values of point clouds according to an embodiment of this application.
[0018] Figure 2 This is a flowchart illustrating the various sub-steps in step B of another embodiment of this application. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be described in detail below with reference to the accompanying drawings. To further illustrate the embodiments, this application provides accompanying drawings. These drawings are part of the disclosure of this application and are mainly used to illustrate the embodiments, and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of this application.
[0020] A frame of point cloud sampled by a LiDAR or 3D scanning device mounted on the robot can be viewed as a series of discrete points within a 360-degree radius. The points are sampled sequentially, and each point in the frame is physically located relative to the robot within this 360-degree angular coverage area. This frame can be divided into 360 points with 1-degree resolution, each corresponding to a pose angle. Therefore, the pose angle can be incremented from 0 degrees to 1-degree intervals for each point in the frame. It should be noted that the coordinates of each point in the frame can form a two-dimensional matrix. Starting from 0 degrees, an integer angle can be added to each point in the frame at 1-degree intervals as the pose angle. When the robot moves, these points undergo relative motion with respect to the robot, shifting a distance or rotating an angle relative to the original position area (or the original point cloud). The robot can use data sensed by inertial sensors to describe the relative translation and rotation of the first sampled point cloud.
[0021] To predict the compensation relationship required by a robot relative to the same obstacle using the first collected point cloud without waiting for real-time point cloud acquisition, this application discloses a method for obtaining correction values of point clouds. The main body executing the correction value acquisition method is a robot equipped with encoders and laser sensors. Schematically, the robot includes the following structure: a robot body capable of autonomous movement with left and right drive wheels; a laser sensor installed on the top of the robot body; the laser sensor can be a lidar to scan a circle of point clouds; encoders are provided on the left and right drive wheels for detecting the travel distance of the drive wheels; the encoders can measure the robot's movement distance, including the straight-line distance traveled by the robot relative to its original starting position.
[0022] To facilitate the explanation of the environmental characteristics of the correction value acquisition method, this application uses a scenario where a robot is about to collide with an obstacle during its movement as an illustration. The robot starts walking from its original starting position. At the original starting position, the robot uses a laser sensor to scan for obstacles at the target location in its direction of movement (which can be considered as the front of the robot's head) and collects a frame of point cloud data. That is, the robot uses a laser sensor to collect a frame of point cloud data from the obstacle, which serves as the first frame of point cloud data. Then, the robot walks towards the location distributed in the frame of point cloud data and uses an encoder to measure the distance traveled during the movement. That is, the robot walks towards the target location, and the encoder continues to perform measurement work. The location distributed in the frame of point cloud data can form an area, including the target location. Preferably, the target location can be the location of the first point collected in the frame of point cloud data. The robot can plan an effective path from the original starting position to the target location using a heuristic search algorithm, and then walk along the effective path to shorten the distance between the robot and the obstacle. Of course, when the target location is selected as the location of other points in the frame of point cloud data, an effective path to the target location can also be planned. Therefore, the walking direction of the robot is not fixed during the process of walking towards the location distributed in the frame of point cloud data.
[0023] In order to obtain the correction value required to obtain the coordinates of the point cloud frame by combining the motion distance measured by the encoder, the correction value acquisition method disclosed in this application is executed during the process of the robot walking towards the location where the point cloud frame is distributed. That is, the correction value acquisition method is executed during the process of the robot walking towards the location where the point cloud frame is distributed.
[0024] like Figure 1 As shown, the method for obtaining the correction value includes:
[0025] Step A: The robot samples the motion distance measured by the encoder according to the preset sampling period, and then converts the motion distance sampled in each preset sampling period into periodic sampling distance and periodic sampling angle. The periodic sampling distance and periodic sampling angle are saved in the target memory space for each preset sampling period. Then, step B is executed. In step A, the robot subtracts the distance values sampled by the encoder at the start and end times of the same preset sampling period to obtain the motion distance measured within the same preset sampling period. This motion distance is considered as the distance traveled by the robot within the same preset sampling period. If the motion distance is divided according to the left and right drive wheels, it is divided into left drive wheel motion distance and right drive motion distance. These are recorded as the left drive wheel motion distance and right drive motion distance sampled in each preset sampling period. Based on this, the left drive wheel motion distance and right drive motion distance are converted into periodic sampling distance and periodic sampling angle according to kinematic formulas. Thus, a periodic sampling distance and a periodic sampling angle are calculated in each preset sampling period. The periodic sampling distance represents the straight-line distance actually traveled by the robot within a preset sampling period, and the periodic sampling angle represents the angle actually turned by the robot within a preset sampling period.
[0026] To obtain reliable motion compensation by accumulating a sufficient number of periodic sampling distances and angles, step A saves the periodic sampling distances and angles to the target memory space for each preset sampling period. Therefore, the target memory space needs to be configured with a sufficiently large capacity to match the number of preset sampling periods required by the encoder. If the number of preset sampling periods is a preset target number, the target memory space can accommodate a preset target number of periodic sampling distances and angles, and these can be accessed via index values within the target memory space.
[0027] Since the encoder is considered a reliable measurement result for measuring a small distance the drive wheel has rotated within a short period of time, the preset target number of times is determined by the measurement accuracy of the encoder. The distance traveled by the robot's left or right drive wheel within the preset target number of preset sampling periods can be accurately measured by the encoder, eliminating the interference of slippage error.
[0028] Step B: Set the angle index traversal range for the robot within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time. Step B uses the angle as the index value for calling / traversing the aforementioned periodic sampling distance, the aforementioned reference, and the point cloud of a frame. Specifically, one preset sampling period corresponds to one angle index traversal range, and one angle index traversal range is divided into multiple index values, ensuring that each index value indexes the allowed calculated correction value (including distance and angle) within one preset sampling period, matching it to each point in the point cloud corresponding to the index.
[0029] As the sampling time of the encoder increases, the preset sampling period experienced by the sampling movement distance increases, and the upper limit of the corresponding angle index traversal range increases. The corresponding angle index traversal range will expand, so it is necessary to convert it to a circular index within 0 to 359. Correspondingly, the corresponding angle index traversal range is converted into 360 angle index values between 0 and 359 or between 1 and 360. Therefore, an angle index traversal range can be divided into multiple angle index values. Correspondingly, the point cloud of a frame is converted into a point cloud with a resolution of 1 degree, thereby controlling the angle index traversal range to be orderly divided into 360 angle index values within a preset sampling period, so as to divide the point cloud of a frame into 360 groups of point clouds.
[0030] Then, within the corresponding angle index traversal range, the latest saved periodic sampling distances within each preset sampling period are accumulated according to the same angle index value to obtain the point cloud distance correction value corresponding to the same angle index value (generally, this is calculated only after all periodic sampling distances within the target memory space have been accumulated). At this time, the accumulated point cloud distance correction value is the result of accumulating the periodic sampling distances within the last preset sampling period of the encoder operation; and the latest saved periodic sampling angles within each preset sampling period are accumulated according to the same angle index value to obtain the point cloud angle correction value corresponding to the same angle index value (generally, this is calculated only after all periodic sampling angles within the target memory space have been accumulated). At this time, the accumulated point cloud angle correction value is the result of accumulating the periodic sampling angles within the last preset sampling period of the encoder operation; then, the point cloud distance correction value corresponding to the same angle index value and the point cloud angle correction value can be used to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's movement.
[0031] Therefore, based on sampling the motion distance via the encoder and storing the periodic sampling distance in each preset sampling period, the newly stored periodic sampling distance is added to each preset sampling period, which is equivalent to updating the motion distance compensation amount according to the preset sampling period. Similarly, based on sampling the motion angle via the encoder and storing the periodic sampling angle in the target memory space in each preset sampling period, the newly stored periodic sampling angle is added to each preset sampling period, which is equivalent to updating the motion angle compensation amount according to the preset sampling period. Thus, within the corresponding angle index traversal range, the total distance the robot has moved and the total angle the robot has turned are superimposed on the point cloud corresponding to the currently traversed angle index value.
[0032] In step B, each angle index value can be mapped one-to-one with the periodic sampling distance and periodic sampling angle within the same preset sampling period. Simultaneously, within the corresponding angle index traversal range of each preset sampling period, specifically, each point in a frame of point cloud is assigned an integer angle value (between 0 and 359 degrees), and a one-to-one index relationship is established with the correction values (point cloud distance correction value and point cloud angle correction value) calculated in the last preset sampling period. This accelerates the correction value acquisition method's correction of the point cloud corresponding to the angle index value according to the preset sampling period. The larger the motion deviation (corresponding correction value) required for the correction / compensation of the first set of point clouds acquired, the faster the correction value acquisition method can perform corrections on the point cloud corresponding to the angle index value.
[0033] Based on this, this application dynamically superimposes periodic sampling distances according to a preset sampling period to obtain point cloud distance correction values, and dynamically superimposes periodic sampling angles according to a preset sampling period to obtain point cloud angle correction values. Thus, by accumulating the periodic sampling distances and angles calculated within each preset sampling period, the allowable movement distance (point cloud distance correction value) and movement angle (point cloud angle correction value) for the corresponding point cloud correction are calculated. This allows each point in the point cloud to be indexed with its corresponding point cloud distance correction value and point cloud angle correction value to compensate for the offset caused by the robot's movement relative to obstacles. This is equivalent to the robot compensating for the obstacles distributed at the nearest point cloud location for the point cloud frame it moves towards. The point cloud distance correction value and point cloud angle correction value accumulated within the time spent on movement (greater than or equal to the multiple preset sampling periods) can be used to predict the relative movement position of the point cloud in a frame within the same time period, thereby improving the real-time correction accuracy. Subsequently, the robot can use the corresponding correction values to directly predict the real-time position of obstacles and avoid them in advance. In addition, if the time spent on movement (greater than or equal to the multiple preset sampling periods) of the linear obstacles (such as walls) distributed at the point cloud in the nearest row meets the accuracy requirements of the encoder measurement, the contour line formed by the correction of the point cloud in the frame will be straighter, which will avoid the phenomenon of line segment distortion in the image detected by the laser sensor to a certain extent.
[0034] In step B, the method for setting the angle index traversal range of the robot within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time includes:
[0035] The ratio of the preset sampling period to the unit angle sampling time is calculated to obtain the predicted angle value of a single preset sampling period. The span of the angle index value that the robot is allowed to traverse within the current preset sampling period is planned. It should be noted that the robot has already scanned the point cloud frame before executing step A, and then enters the first preset sampling period. The angle of the point cloud that the laser sensor can scan within the first preset sampling period is predicted by calculating the ratio of the preset sampling period to the unit angle sampling time. The predicted angle value of a single preset sampling period is then used in step B. If the point cloud frame is counted with a resolution of 1 degree, the predicted angle value of a single preset sampling period is counted as the number of point cloud samples within a single preset sampling period.
[0036] The preset sampling period and unit angle sampling time are both preset time values. The unit angle sampling time is the time it takes for the robot to collect a point cloud of 1 degree using a laser sensor, denoted as per_angle_times, in milliseconds. A frame of point cloud is the point cloud collected by the robot during a complete scan using the laser sensor. If the frame of point cloud is counted at a resolution of 1 degree, points between 0 and 359 degrees or between 1 and 360 degrees are collected to form a point cloud distributed within a 360-degree range. The number of points in a frame of point cloud is generally greater than or equal to 360. The number of points in each degree of a frame of point cloud is not necessarily fixed. The more points in each degree, the greater the point cloud coordinate offset correction value required for point coordinate compensation, and correspondingly, the greater the required accumulated periodic sampling distance and periodic sampling angle. The number of points in a frame of point cloud is denoted as cloudPointRawCount. The sampling time of a frame of point cloud is considered the time taken for the laser sensor to scan the surrounding environment in one complete scan, denoted as cloudPointDuration, in microseconds. Based on this, the unit angle sampling time per_angle_times equals...
[0037] The starting angle index value is added to the predicted angle value of a single preset sampling period scan to obtain the ending angle index value. This ending angle index value is calculated based on the predicted angle value of a single preset sampling period scan, thus pre-defining the ending index value of the point cloud within a preset sampling period. When using the starting angle index value in the first preset sampling period, it can be configured as the angle index value of the first point in a frame of point cloud acquired by the laser sensor within a preset sampling period, preferably 0 degrees. By adding the starting angle index value to the predicted angle value of a single preset sampling period scan, the point cloud is traversed starting from 0 degrees. Within the current preset sampling period, the periodic sampling distance and periodic sampling angle described in step B are also traversed starting from 0 degrees until the ending angle index value is reached. Then, the ending angle index value can be updated to the first angle index value of the point cloud traversed in the next preset sampling period (360 degrees), i.e., updated to the starting angle index value of the next preset sampling period. This makes the predicted angle value of a single preset sampling period scan the offset between the starting angle index values of two adjacent preset sampling periods.
[0038] Then, the target upper limit index value is calculated based on the end angle index value, and then the target upper limit index value is configured as the upper limit value of the angle index traversal range. The target upper limit index value is used to represent the maximum number of point clouds that the laser sensor is allowed to collect in a single preset sampling period. Since the end angle index value is an index value calculated based on the predicted angle value scanned in a single preset sampling period, the corresponding calculated target upper limit index value can predict the maximum number of point clouds that can be corrected in a single preset sampling period. The maximum number of point clouds that can be corrected in a single preset sampling period is less than or equal to the number of point clouds that the laser sensor can collect in the same preset sampling period. At this time, in step B, the robot does not use the laser sensor to scan the point cloud of the surrounding environment, but calculates the target upper limit index value as the predicted value of the number of point clouds based on the end angle index value.
[0039] Specifically, the method for calculating the target upper limit index value based on the end angle index value includes: detecting the size relationship between the point cloud angle start index value and the end angle index value to determine whether the point cloud angle start index value or the end angle index value crosses the 360-degree angle range.
[0040] When the starting index value of the point cloud angle is detected to be less than the ending index value, the starting index value of the point cloud angle is subtracted from the ending index value to obtain the target upper limit index value, which is greater than 0. This allows the calculation of the maximum number of point clouds that can be collected within a single preset sampling period, and the traversal range of the angle index is limited by 0 and the target upper limit index value. The starting index value and the ending index value of the point cloud angle can be set within the same preset sampling period.
[0041] When the starting index value of the point cloud angle is detected to be greater than or equal to the ending index value, the starting index value of the point cloud angle is subtracted from 360, and then the difference obtained by subtraction is added to the ending index value to obtain the target upper limit index value. Schematic, the starting index value of the point cloud angle is set to 120 within the current preset sampling period. If the traversal reaches the ending angle index value of 119 within the current preset sampling period, then the starting index value of the point cloud angle is greater than the ending angle index value. At this time, the number of points traversed within the current preset sampling period has reached 360, and the maximum angle index value of 359 has also been crossed during the traversal. In order to perform index analysis on the point cloud distributed between the angle of the last point traversed within the current preset sampling period (a point indexed by the ending angle index value) and the starting index value of the point cloud angle within the positive integer angle range, this application controls 360 minus 120 and adds 119 to obtain 359 when the starting index value of the point cloud angle is greater than the ending angle index value of 119. Then, 359 is used as the target upper limit index value; thereby setting the angle index traversal range to 0 to 359.
[0042] In summary, this application calculates the target upper limit index value based on the relationship between the starting and ending angle index values of the point cloud and configures it as the upper limit value of the angle index traversal range. Thus, for point cloud scanning crossing the 0-degree / 360-degree boundary, it utilizes the cyclic characteristics of the point cloud in the 360-degree scan to calculate the target upper limit index value, keeping the upper limit value of the angle index traversal range positive and avoiding negative values caused by the cyclic boundary, thereby ensuring the continuity and correctness of the angle index value calculation.
[0043] Furthermore, the aforementioned point cloud angle starting index value is used to represent the angle index value of the first point in the point cloud frame that is acquired by the laser sensor, and is configured to be equal to the starting angle index value to form the angle index value of the first point that needs to be corrected in the first preset sampling period of the point cloud frame.
[0044] If indexing is performed within the current preset sampling period, the starting angle index value of the point cloud can represent the angle index value of the first point in the point cloud that needs to be corrected within the current preset sampling period; correspondingly, the ending angle index value is used to represent the starting angle index value within the next preset sampling period.
[0045] In the physical environment, the closer a point is to the location indexed by the starting point cloud angle value, the more the point indexed by the starting point cloud angle value receives the cumulative operation of the periodic sampling distance and periodic sampling angle in the preset sampling period. The larger the point cloud distance correction value and point cloud angle correction value required for correction, the more motion deviation is accumulated for the first sampled point as the preset sampling period increases. When the robot approaches the distribution location of the point cloud frame at a certain speed, the more correction value is compensated for for the point indexed by the starting point cloud angle value, and the closer the corrected coordinates of the point cloud frame are to the robot. The accuracy of the corrected coordinates of the point cloud frame is improved, and the possibility of collision with obstacles at the distribution location of the point cloud frame is predicted in advance, thus improving the real-time performance of collision behavior detection.
[0046] As one embodiment, the iterative calculation logic of accumulating the periodic sampling distances stored in each preset sampling period according to the same angle index value and accumulating the periodic sampling angles stored in each preset sampling period according to the same angle index value is described in detail in step B, as follows: Figure 2 As shown, after acquiring the point cloud frame and saving the periodic sampling distance and periodic sampling angle calculated for the current preset sampling period to the target memory space in step A, step B specifically includes:
[0047] Step B1: Starting from the first address of the target memory space, traverse the periodic sampling distance and periodic sampling angle stored in the target memory space in Step A. Specifically, when Step B1 is executed for the first time, the pre-set traversal pointer points to the object at the first address in the target memory space to traverse the periodic sampling distance and periodic sampling angle corresponding to the first preset sampling period stored in the target memory space. Here, one preset sampling period corresponds to one periodic sampling distance and one periodic sampling angle. Step A controls the periodic sampling distance and periodic sampling angle to be stored starting from the end address of the target memory space. It is then determined whether the traversal has reached the end address of the target memory space. In the case of storing the periodic sampling distance and periodic sampling angle from the end of the target memory space for each preset sampling period, it is essentially determining whether the periodic sampling distance and periodic sampling angle corresponding to the last preset sampling period stored in the target memory space have been traversed. If yes, proceed to Step B8; otherwise, proceed to Step B2. Therefore, the closer the address currently being traversed in step B1 is to the end address of the target memory space, the newer the periodic sampling distance and periodic sampling angle will be, that is, the more likely it is to traverse the periodic sampling distance and periodic sampling angle stored in the most recent preset sampling period.
[0048] Step B2: Calculate the target upper limit index value by executing the method described above, which sets the robot's angle index traversal range within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time. Simultaneously, set the current index value to 0 within the current preset sampling period, and then execute step B3. For the current preset sampling period, during step B2's process of setting the robot's angle index traversal range within the current preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time, the upper limit value of the robot's angle index traversal range within the current preset sampling period is set as the target upper limit index value. This target upper limit index value belongs to the current preset sampling period, and one preset sampling period corresponds to one angle index traversal range. In addition, in order to accumulate the periodic sampling distance and periodic sampling angle according to various angle index values, and to index out the distance periodic correction value and angle periodic correction value corresponding to each angle index value, the current index value is set to increment from 0, so that it traverses from 0 to the corresponding target upper limit index value in each preset sampling period. Therefore, the current index value is defined as the index value for traversing each integer angle covered by the angle index traversal range, so as to count the point cloud corresponding to each angle index value that needs to be corrected in the current preset sampling period, and to realize the distance periodic correction value and angle periodic correction value corresponding to each angle index value that needs to be accumulated in the current preset sampling period.
[0049] Step B3: Determine whether the current index value mentioned in step B2 is less than the target upper limit index value mentioned in step B2. If yes, proceed to step B4; otherwise, proceed to step B7. Within the current preset sampling period, determine whether the current index value is less than the target upper limit index value. Here, the target upper limit index value represents the number of points whose corresponding angle index value (or corresponding pose angle) needs to be corrected after determining the periodic sampling distance and periodic sampling angle corresponding to the current preset sampling period. This is counted as the maximum number of point clouds that the laser sensor is allowed to collect within the current preset sampling period. Preferably, the pose angle of the point cloud that needs to be corrected covers 0 to 359 from 0 to the target upper limit index value (the angle index traversal range corresponding to the current preset sampling period).
[0050] Based on the aforementioned embodiments, starting from the point cloud angle starting index value, the distance period correction value and angle period correction value corresponding to each of the target upper limit index values need to be used for accumulation. This is equivalent to controlling all the distance period correction values and angle period correction values corresponding to the first index value (the current index value with a value of 0) in the first preset sampling period and the first index value (the current index value with a value of 0) in the next preset sampling period to participate in the accumulation.
[0051] Step B4: Determine that the current index value mentioned in Step B2 is within the angle index traversal range. Then, control the sum of the current index value mentioned in Step B2 and the starting point cloud angle index value to be modulo 360 (i.e., perform a modulo 360 operation) to generate an angle index value. This angle index value is then identified as the pose angle of a point required to accumulate the point cloud distance correction value and / or the point cloud angle correction value. Finally, execute Step B5. This divides the point cloud frame according to angles between 0 and 360 degrees, and uses the angle index value to limit the cyclic boundary of the 360-degree scan.
[0052] In step B4, the sum of the current index value and the starting index value of the point cloud angle, as described in step B2, is modulo 360. The generated angle index value ensures that the subsequent indexing of the distance period correction value and the angle period correction value cyclically cycles within the angle range of 0 to 359. Although the traversal range of the angle index can be between 0 and 359 or between 1 and 360, or it can expand beyond 360 degrees as the target upper limit index value increases, the angle offset range of the point cloud that needs to be corrected is defined as being between 0 and 359 based on the generated angle index value. This can be understood as the angle index value changing from the starting index value of the point cloud angle to the ending angle index value in the incremental change of the current index value. If the angle index value exceeds 359, the angle index value changes from 0 to the correction value corresponding to the ending angle index value, satisfying the circular index.
[0053] It should be noted that this application sets a starting index value for the point cloud angle in step B, which is applicable to a circular index within a 360-degree range. Within a single preset sampling period, the starting index value can be set to 1 degree, 2 degrees, or a larger integer angle, or it can be equal to the starting angle index value. It is important to note that if the ending angle index value obtained by adding the starting angle index value to the predicted angle value scanned in a single preset sampling period is greater than 359 degrees (i.e., greater than the starting index value), then the ending angle index value cannot be used to index a frame of point cloud (the actually acquired point cloud, not the predicted acquired point cloud) whose pose angle (angle index value) range is between 0 and 359. Therefore, this application needs to calculate a target upper limit index value based on the ending angle index value. Then, when the current index value is less than the target upper limit index value, the sum of the current index value and the starting index value of the point cloud angle is modulo 360 to generate an angle index value for circular indexing between 0 and 359.
[0054] In summary, this method ensures that all point clouds corresponding to index values from 0 to the target upper limit (the angle index traversal range corresponding to the current preset sampling period) fall within the point cloud angle range that needs correction. This allows the target upper limit index value to also define the effective angle coverage range within the current preset sampling period. Specifically, when the angle is smaller than the target upper limit index value, the current index value is combined with the current index value to generate the angle index value. This ensures that all point clouds corresponding to index values traversed within the current preset sampling period can be converted into the corresponding angle index values, avoiding distortion or error accumulation caused by discontinuous scanning.
[0055] Step B5: Add the periodic sampling distance stored in the target memory space within the current preset sampling period to the pre-set distance period correction value corresponding to the same angle index value to obtain the distance period correction value corresponding to the same angle index value. Update the distance period correction value corresponding to the same angle index value to the pre-set distance period correction value corresponding to the same angle index value. This is done so that the periodic sampling distance stored in the next preset sampling period is accumulated when step B5 is executed next time. In addition, when the same angle index value is updated, step B5 is also executed to add the corresponding distance period correction value to the periodic sampling distance stored in the current preset sampling period. This achieves the accumulation of the periodic sampling distance stored in each preset sampling period according to the same angle index value within the corresponding angle index traversal range, and continuously updates the distance period correction value.
[0056] Furthermore, the periodic sampling angles stored in the target memory space within the current preset sampling period are added to the pre-set angle period correction value corresponding to the same angle index value to obtain the angle period correction value corresponding to the same angle index value. This angle period correction value is then updated to the pre-set angle period correction value corresponding to the same angle index value. This is used to accumulate the periodic sampling angles stored in the next preset sampling period when step B5 is executed next time. Additionally, when the same angle index value is updated, step B5 is also executed to add the corresponding angle period correction value to the periodic sampling angles stored in the current preset sampling period. Then, step B6 is executed. This process accumulates the periodic sampling angles stored in each preset sampling period according to the same angle index value within the corresponding angle index traversal range and continuously updates the angle period correction value.
[0057] Preferably, when step B5 is executed for the first time, the distance cycle correction value corresponding to the same angle index value is 0; the angle cycle correction value corresponding to the same angle index value is 0. The distance cycle correction value corresponding to the same angle index value can be stored as an array structure in the target memory space to store the accumulated value of the distance cycle correction value corresponding to each angle index value; the angle cycle correction value corresponding to the same angle index value can be stored as an array structure in the target memory space to store the accumulated value of the angle cycle correction value corresponding to each angle index value; thus, the accumulated motion parameter correction amount corresponding to each angle (0 to 359) is stored through the distance cycle correction value and the angle cycle correction value corresponding to the same angle index value.
[0058] Step B6: Control the current index value mentioned in step B2 to automatically increment by one, then update the automatically incremented current index value to the current index value mentioned in step B2, and then execute step B3 to continue indexing within the range of the target upper limit index value mentioned in step B2, unless it exceeds the angular index traversal range.
[0059] While continuing indexing within the range where the current index value is less than the target upper limit index value described in step B2, each time the current index value described in step B2 is incremented by one, the sum of the incremented current index value and the starting index value of the point cloud angle is modulo 360 in step B4 to generate a new angle index value. Then, by executing step B5, the distance period correction value and angle period correction value corresponding to the new angle index value are calculated. Thus, while indexing within the range where the current index value is less than the target upper limit index value described in step B2, steps B3 to B6 are executed multiple times to accumulate the periodic sampling distance and accumulated the periodic sampling angle for different angle index values, thereby obtaining the distance period correction value and angle period correction value corresponding to different angle index values.
[0060] Step B7: If the distance period correction value and angle period correction value corresponding to each angle index value are accumulated within the current preset sampling period, then the end angle index value is updated to the start angle index value, and the next preset sampling period is updated to the current preset sampling period. Then, step B1 is executed to traverse the period sampling distance and period sampling angle stored in the next preset sampling period from the target memory space, and the next preset sampling period begins.
[0061] Each time the next preset sampling period is updated to the current preset sampling period, the periodic sampling distance and periodic sampling angle stored in the current preset sampling period are read from the target memory space. Then, without traversing to the end address of the target memory space, the method of setting the traversal range of the robot's corresponding angle index in the preset sampling period according to the ratio of the preset sampling period to the unit angle sampling time is executed to update the target upper limit index value, and the current index value is controlled to be restored to 0 in the current preset sampling period.
[0062] In some embodiments, each time step B7 is executed, the updated starting angle index value is increased by one, and then steps B1 and B2 are executed. In step 1, if the periodic sampling distance and periodic sampling angle stored in the current preset sampling period have not been traversed to the end address of the target memory space, step B2 is executed, which increases the target upper limit index value calculated in step B2 by one, thereby expanding the traversal range of the corresponding angle index in the current preset sampling period by one. This also realizes the correction of more point cloud angle regions by adding the latest periodic sampling distance and periodic sampling angle stored in the target memory space every preset sampling period, which is suitable for real-time processing.
[0063] Based on this, in a scenario where the robot approaches a straight wall at a certain speed, the closer the angle index value is to the starting angle index value of the point cloud, the more times the corresponding distance periodic correction value and angle periodic correction value are accumulated. This makes the straight wall at the location of the point corresponding to the starting angle index value of the point cloud straighter, and the point cloud gets closer to the robot. Therefore, the amount of motion (including periodic sampling distance and periodic sampling angle) collected first in the point cloud correction is more, and it is closer to the robot's real-time movement position, thus improving the accuracy of point cloud correction.
[0064] Step B8: Determine that all periodic sampling distances and all periodic sampling angles within the target memory space have been accumulated, i.e., the end address of the target memory space has been reached. Set the distance periodic correction value corresponding to the latest updated angle index value as the point cloud distance correction value corresponding to the same angle index value, and set the angle periodic correction value corresponding to the latest updated angle index value as the point cloud angle correction value corresponding to the same angle index value. At this point, the periodic sampling distances stored in each preset sampling period are accumulated within the corresponding angle index traversal range according to the same angle index value, and all periodic sampling distances within the target memory space have been accumulated, resulting in the point cloud distance correction value corresponding to the same angle index value. Similarly, the periodic sampling angles stored in each preset sampling period are accumulated within the corresponding angle index traversal range according to the same angle index value, and all periodic sampling angles within the target memory space have been accumulated, resulting in the point cloud angle correction value corresponding to the same angle index value.
[0065] In some embodiments, when the number of executions of steps B1 to B7 reaches a preset target number, step B8 is executed, and it is determined that the robot has experienced a preset target number of preset sampling cycles. It is also determined that the point cloud distance correction value corresponding to the same angle index value is equal to the cumulative value of the periodic sampling distances within the preset target number of preset sampling cycles, and simultaneously, it is determined that the point cloud angle correction value corresponding to the same angle index value is equal to the cumulative value of the periodic sampling angles within the preset target number of preset sampling cycles. Then, the point cloud distance correction value and the point cloud angle correction value corresponding to the same angle index value are combined to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's movement. The preset target number of times is determined by the measurement accuracy of the encoder. Preferably, the preset target number of periodic sampling angles and preset target number of periodic sampling distances can be combined with the point cloud data and the motion parameters sampled by the encoders of the robot's left and right drive wheels to fill the target memory space. Thus, by executing steps B1 to B8, the distance periodic correction value and the angle periodic correction value are dynamically updated, allowing the finally set point cloud distance correction value and point cloud angle periodic correction value to have a real-time correction advantage within multiple preset sampling cycles.
[0066] Regarding the measurement accuracy of the encoder, the point cloud frame is first considered as a series of discrete points in a 360-degree circle. These points are sampled in a certain order. Then, step A saves the periodic sampling distance and periodic sampling angle in the target memory space for each preset sampling period. Then, step B processes these points according to the periodic sampling distance and periodic sampling angle saved in each preset sampling period. During the processing, the robot walks towards the point cloud, and time has passed. That is to say, these points have relative motion with respect to the robot, resulting in a distance offset or a certain angle of rotation. Since measuring a short distance traveled by the drive wheel within a short period of time using an encoder is considered a reliable measurement result, the preset target number is determined by the encoder's measurement accuracy. The distance traveled by the robot's left or right drive wheel within a preset target number of preset sampling periods can be accurately measured by the encoder, eliminating slippage error interference. The preset number of sampling periods is then set as the preset target number of times, and the target memory space is configured to accommodate a maximum of a preset target number of times of sampling distance and a preset target number of times of sampling angle. That is, the preset target number of times of sampling angle and the preset target number of times of sampling distance fill the target memory space, supporting index-based retrieval within the target memory space.
[0067] In summary, by dynamically updating the distance periodic correction value and the angle periodic correction value through steps B1 to B8, the point cloud distance correction value required for each angle index value is obtained by continuously superimposing the periodic sampling distance stored within different preset sampling periods on the distance periodic correction value. Similarly, the point cloud angle correction value required for each angle index value is obtained by continuously superimposing the periodic sampling angle stored within different preset sampling periods on the angle periodic correction value. These values describe the translation and rotation of each point in the point cloud relative to the moving robot, which is equivalent to predicting the motion of the point cloud and achieving cumulative error compensation. This is superior to fixed parameter correction and facilitates subsequent compensation of the corresponding distance and angle.
[0068] As one embodiment, specifically set within a preset sampling period, the method for calculating the periodic sampling distance and periodic sampling angle in step A includes:
[0069] The difference between the distance traveled by the encoder mounted on the robot's left drive wheel at the current moment and the distance traveled at the reference moment is used to obtain the distance traveled by the left drive wheel. The distance traveled by the encoder mounted on the left drive wheel at the current moment can be converted from the pulse count value currently measured by the encoder mounted on the left drive wheel. The distance traveled by the encoder mounted on the left drive wheel at the current moment and the current moment (a sampling timestamp) can be encapsulated in a data structure (e.g., assigned to the corresponding field in an object) and stored. The distance traveled by the encoder mounted on the robot's left drive wheel at the reference moment is a pre-stored motion parameter, so that the object indexed by each angle index value from memory contains motion information within a preset sampling period.
[0070] The difference between the distance traveled by the encoder mounted on the robot's right drive wheel at the current moment and the distance traveled at the reference moment is used to obtain the distance traveled by the right drive wheel. The distance traveled by the encoder mounted on the right drive wheel at the current moment can be converted from the pulse count value currently measured by the encoder mounted on the right drive wheel. The distance traveled by the encoder mounted on the right drive wheel at the current moment and the current moment (a sampling timestamp) can be encapsulated in a data structure (e.g., assigned to the corresponding field in an object) and stored. The distance traveled by the encoder mounted on the robot's right drive wheel at the reference moment is a pre-stored motion parameter, so that the object indexed by each angle index value from memory contains motion information within a preset sampling period.
[0071] Calculate half the sum of the movement distances of the left and right drive wheels to obtain the periodic sampling distance. Control the periodic sampling distance to be stored starting from the end address of the target memory space. In step B1, as the periodic sampling distances are stored in the target memory space sequentially from the first address of the target memory space for each preset sampling period, the closer the traversed address is to the end address of the target memory space, the newer the periodic sampling distance will be. That is, it will be able to traverse the periodic sampling distance stored in the most recent preset sampling period to ensure the real-time nature of the sampling distance information.
[0072] The ratio of the difference between the travel distance of the left and right drive wheels to the wheelbase is calculated to obtain the periodic sampling angle. The periodic sampling angle is then stored starting from the end address of the target memory space. The periodic sampling angle and periodic sampling distance can be stored in the same data structure, but they occupy different addresses. In step B1, as the periodic sampling angles are stored sequentially for each preset sampling period starting from the first address of the target memory space, the closer the traversed address is to the end address of the target memory space, the newer the periodic sampling angle is, meaning it can access the periodic sampling angle stored in the most recent preset sampling period, ensuring the real-time nature of the sampling angle information. Therefore, the aforementioned step B1, which determines whether the end address of the target memory space has been reached, essentially determines whether the periodic sampling distance and periodic sampling angle corresponding to the last preset sampling period stored in the target memory space have been completely traversed.
[0073] It should be noted that the start time of the preset sampling period is the reference time, and the end time of the preset sampling period is the current time. Understandably, if multiple preset sampling periods exist, the start time of the current preset sampling period equals the end time of the previous preset sampling period, and the end time of the current preset sampling period equals the start time of the next preset sampling period. The distance between the robot's left and right drive wheels is equal to the wheelbase. The motion distance sampled within the preset sampling period described in step A is divided into the motion distance of the left drive wheel and the motion distance of the right drive wheel. To calculate the motion distance measured by the encoder mounted on the robot's left drive wheel at the current time, the initial value of the reference time is set to the time when the robot was stationary before walking. Therefore, the motion distance measured by the encoder at the reference time is equal to 0, facilitating the measurement of the motion distance at the current time based on the encoder pulse count value measured at the reference time, thereby calculating the motion distance of the left and right drive wheels.
[0074] This application samples the code disk according to a preset sampling period T, which is generally T = 10ms. Of course, it can be set to other values according to different needs. Setting it to 10 milliseconds is more appropriate. If the time is too long, it will affect the detection results; if the time is too short, the performance requirements of the sensor and processor will be too high.
[0075] Schematic diagram: The robot's wheelbase is H, the speed of the left drive wheel is v1, the speed of the right drive wheel is v2, and the robot's travel speed is... The angular velocity of the robot during rotation is Integrating v over the sampling period from reference time 0 to the current time t yields the robot's movement distance, which is: Integrating w yields the robot's rotation angle, which is... If this application calculates the periodic sampling distance and periodic sampling angle according to step A, and the reference time is 0 (the moment when the robot is stationary before walking), then v2t is the movement distance of the left drive wheel, v1t is the movement distance of the right drive wheel, and the pulse count value generated by the wheel rotation during the time interval 0 to t is multiplied by the number of millimeters corresponding to each pulse, and then divided by 1000 to obtain the total number of meters moved during the time interval 0 to t; where the number of millimeters corresponding to each pulse is equal to the circumference of the wheel (left drive wheel or right drive wheel) divided by the preset encoder ratio. Then according to... Calculate the periodic sampling distance and record it as the periodic sampling distance corresponding to the current preset sampling period; and follow the... Calculate the periodic sampling angle and record it as the periodic sampling angle corresponding to the current preset sampling period.
[0076] Based on the above embodiments, after calculating the periodic sampling distance and periodic sampling angle, to begin transitioning from the current preset sampling period to the next preset sampling period, the current time needs to be updated to the reference time. Simultaneously, the motion distance measured by the encoder mounted on the robot's left drive wheel at the current time is updated to the motion distance measured by the encoder mounted on the robot's left drive wheel at the reference time, and the motion distance measured by the encoder mounted on the robot's right drive wheel at the current time is updated to the motion distance measured by the encoder mounted on the robot's right drive wheel at the reference time. This facilitates the execution of steps A and B within the transition from the current preset sampling period to the next preset sampling period. Therefore, when executing step A again, the motion distance measured by the encoder mounted on the robot's left drive wheel at the current time is directly subtracted from the motion distance measured at the reference time to obtain the left drive wheel motion distance corresponding to the next preset sampling period; and the motion distance measured by the encoder mounted on the robot's right drive wheel at the current time is directly subtracted from the motion distance measured at the reference time to obtain the right drive wheel motion distance corresponding to the next preset sampling period. Since each preset sampling period is a time period experienced by the robot as it walks toward the distribution position of the point cloud in a frame, each point in the point cloud in a frame can correspond to the left drive wheel movement distance and the right drive wheel movement distance of a preset sampling period. Only then can the left drive wheel movement distance and the right drive wheel movement distance be used for motion pose prediction, which is convenient for point cloud correction.
[0077] Before executing step A, each point in the point cloud frame is distributed across various physical locations within a 360-degree angular coverage area relative to the robot. This can be divided into 360 points corresponding to 1-degree angle index values, with each angle index value corresponding to a pose angle. Therefore, the pose angles of the point cloud frame are incremented from 0 degrees at 1-degree intervals. Since the robot performs a correction value acquisition method while moving towards the locations distributed in the point cloud frame, the pose angles of each point in the point cloud frame are set sequentially before executing step A.
[0078] It should be noted that the coordinates of each point in a frame of point cloud can form a two-dimensional matrix. Starting from 0 degrees, corresponding integer angles can be added to each point in the frame of point cloud at 1-degree intervals to serve as pose angles.
[0079] Therefore, for each pose angle set, a pose angle is added to the coordinates of the corresponding point until the added pose angle increases to 359. At this point, the pose angle range of a point cloud frame is 0 to 359. It is determined that 360 pose angles are added to the point cloud frame to avoid using inverse trigonometric functions to calculate angles, thereby speeding up the algorithm execution and reducing calculation errors. It also converts the point cloud frame into a set of points with a resolution of 1 degree according to the angle index value. The sequentially added pose angles form the index order of each point, which can correspond one-to-one with the aforementioned distance period correction value, angle period correction value, and angle index value. This allows for rapid point cloud correction using the point cloud distance correction value and point cloud angle correction value corresponding to each angle index value.
[0080] In a scenario where the coordinates and pose angles of a point cloud frame are stored in a point cloud container (which can be set within the target memory space), for each set pose angle, the coordinates and pose angle of the corresponding point are stored in the point cloud container so that the pose angle of the corresponding point is equal to the angle index value, until the pose angle increases from 0 degrees to 359 degrees. The point cloud frame is then sorted into the point cloud container in ascending order of pose angles. After the point cloud frame is stored in ascending order of pose angles, the absolute value of the difference between the pose angles of points stored in two adjacent storage addresses in the point cloud container is equal to 1.
[0081] Based on the foregoing embodiments, this application also discloses a chip storing a computer program. When the computer program is executed, it implements the steps of the correction value acquisition method disclosed in any of the foregoing embodiments. The chip disclosed in this application dynamically superimposes periodic sampling distances according to a preset sampling period to obtain point cloud distance correction values, and dynamically superimposes periodic sampling angles according to a preset sampling period to obtain point cloud angle correction values. It then uses the periodic sampling distances and periodic sampling angles calculated within each preset sampling period to accumulate and calculate the allowable movement distance (point cloud distance correction value) and movement angle (point cloud angle correction value) for the corresponding point cloud correction, enabling each point in the point cloud to index the corresponding point cloud distance correction value and point cloud angle correction value to compensate for the offset caused by the robot's movement relative to obstacles. In addition, if the movement time (greater than or equal to multiple preset sampling periods) of the linear obstacles (e.g., walls) distributed at the point cloud of the nearest row meets the accuracy requirements of the code disk measurement, then after the chip corrects the point cloud of the frame using the point cloud distance correction value and point cloud angle correction value corresponding to each angle index value obtained by the correction value acquisition method, the resulting contour line is straighter, which to a certain extent avoids the phenomenon of line segment distortion in the image detected by the laser sensor.
[0082] This application also discloses a robot equipped with the aforementioned chip. The robot is equipped with an encoder and a laser sensor; specifically, the robot includes the following structure: a robot body capable of autonomous movement with a left drive wheel and a right drive wheel; a laser sensor is mounted on the top of the robot body, the laser sensor being a lidar sensor capable of scanning a point cloud; and encoders on the left and right drive wheels for detecting the distance traveled by the drive wheels. The encoders can measure the robot's movement distance, including the straight-line distance traveled by the robot relative to its original starting position.
[0083] In a scenario where a robot is about to collide with an obstacle during its movement, the robot starts walking from its original starting position. At the original starting position, the robot uses a laser sensor to scan for the obstacle at the target location in its direction of movement (which can be considered as the front of the robot's head) and collects a frame of point cloud data. That is, the robot uses the laser sensor to collect a frame of point cloud data from the obstacle, which serves as the first frame of point cloud data. Then, the robot walks towards the location distributed in the frame of point cloud data and uses an encoder to measure the distance traveled during the movement. That is, the robot walks towards the target location, and the encoder continues to perform measurement work. The location distributed in the frame of point cloud data can form an area, including the target location. Preferably, the target location can be the location of the first point collected in the frame of point cloud data. The robot can plan an effective path from the original starting position to the target location according to a heuristic search algorithm, and then walk along the effective path to reduce the distance between the robot and the obstacle. During the process of the robot closing the distance to the obstacle, the movement distance within each sampling period can be measured sequentially using a code disk according to the sampling period. This distance can be accumulated to obtain the total movement distance the robot has traveled from the original starting position. The original starting position is the starting position where the robot moves towards the obstacle, and it is also the position where the first frame of point cloud from the obstacle is acquired. The first frame of point cloud is regarded as a circle of point cloud scanned by the robot at the original starting position. It can be regarded as acquiring a frame of point cloud, and then serving as the original frame of point cloud that needs to be corrected during the robot's movement towards the obstacle.
[0084] In order to correct the coordinates of the point cloud frame by combining the movement distance measured by the encoder, the correction value acquisition method disclosed in this application is executed during the process of the robot walking towards the location where the point cloud frame is distributed. That is, the correction value acquisition method is executed during the process of the robot walking towards the location where the point cloud frame is distributed. By executing the correction value acquisition method, the robot compensates the point cloud frame for the movement time (greater than or equal to the multiple preset sampling periods) spent by the robot walking towards the obstacle distributed in the point cloud frame. This helps to predict the relative movement position of the point cloud frame within the same time period, improve the real-time correction accuracy, and then the robot can use the corresponding correction value to directly predict the real-time position of the obstacle and avoid the obstacle in advance.
[0085] The above embodiments are only for illustrating the technical concept and features of this application, and are intended to enable those skilled in the art to understand the content of this application and implement it accordingly. They should not be used to limit the scope of protection of this application. All equivalent changes or modifications made in accordance with the spirit and essence of this application should be included within the scope of protection of this application.
Claims
1. A method for obtaining correction values of point clouds. The main body executing the method for obtaining correction values is a robot equipped with an encoder and a laser sensor. After the robot uses the laser sensor to collect a frame of point cloud, the robot walks towards the location where the frame of point cloud is distributed and uses the encoder to measure the movement distance during the walking process. Its features are, As the robot walks toward the location where the point cloud in the frame is distributed, a correction value acquisition method is executed, the correction value acquisition method including: Step A: Sample the motion distance measured by the encoder according to the preset sampling period, then convert the motion distance sampled in each preset sampling period into periodic sampling distance and periodic sampling angle, and save the periodic sampling distance and periodic sampling angle for each preset sampling period; then proceed to step B. Step B: Set the angle index traversal range of the robot within the preset sampling period according to the ratio of the preset sampling period to the unit angle sampling time; then, within the corresponding angle index traversal range, accumulate the reference distances stored in each preset sampling period according to the same angle index value to obtain the point cloud distance correction value corresponding to the same angle index value; and accumulate the reference angles stored in each preset sampling period according to the same angle index value to obtain the point cloud angle correction value corresponding to the same angle index value, so as to combine the point cloud distance correction value and the point cloud angle correction value corresponding to the same angle index value to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's movement. One preset sampling period corresponds to one angle index traversal range, and one angle index traversal range can be divided into multiple angle index values.
2. The method for obtaining the correction value according to claim 1, characterized in that, In step B, the method for setting the angle index traversal range of the robot within the preset sampling period based on the ratio of the preset sampling period to the unit angle sampling time includes: Calculate the ratio of the preset sampling period to the unit angle sampling time to obtain the predicted angle value of a single preset sampling period scan; The starting angle index value is added to the predicted angle value of a single preset sampling period scan to obtain the ending angle index value; Calculate the target upper limit index value based on the ending angle index value, and then configure the target upper limit index value as the upper limit value of the angle index traversal range; The point cloud frame mentioned above is a point cloud collected by the robot during a scan using a laser sensor. The target upper limit index value is used to represent the maximum number of point clouds that the laser sensor is allowed to collect within a single preset sampling period.
3. The method for obtaining the correction value according to claim 2, characterized in that, The method for calculating the target upper limit index value based on the end angle index value includes: Detect the relationship between the starting and ending angle index values of the point cloud; When the starting index value of the point cloud angle is detected to be less than the ending index value, the starting index value of the point cloud angle is subtracted from the ending index value to obtain the target upper limit index value. When the starting index value of the point cloud angle is detected to be greater than or equal to the ending index value, the starting index value of the point cloud angle is subtracted from 360, and then the difference obtained by subtraction is added to the ending index value to obtain the target upper limit index value. The starting index value of the point cloud angle is used to represent the angle index value of the first point in a frame of point cloud that is acquired by the laser sensor.
4. The method for obtaining the correction value according to claim 3, characterized in that, Step B specifically includes: Step B1: Starting from the first address of the target memory space, traverse the periodic sampling distance and periodic sampling angle stored in the target memory space in step A, and determine whether the traversal has reached the last address of the target memory space. If yes, execute step B8; otherwise, execute step B2. In step A, the periodic sampling distance and periodic sampling angle are both stored starting from the last address of the target memory space. Step B2: Calculate the target upper limit index value by executing the method of setting the robot's angle index traversal range within the preset sampling period according to the ratio of the preset sampling period to the unit angle sampling time, and set the current index value to be equal to 0 within the current preset sampling period, and then execute step B3. Step B3: Determine whether the current index value mentioned in step B2 is less than the target upper limit index value mentioned in step B2. If yes, proceed to step B4; otherwise, proceed to step B7. Step B4: Determine that the current index value mentioned in step B2 is within the angle index traversal range, and control the sum of the current index value mentioned in step B2 and the starting index value of the point cloud angle to take the remainder of 360 to generate the angle index value; then execute step B5; Step B5: Add the periodic sampling distance stored in the target memory space within the current preset sampling period to the pre-set distance period correction value corresponding to the same angle index value to obtain the distance period correction value corresponding to the same angle index value, and update the distance period correction value corresponding to the same angle index value to the pre-set distance period correction value corresponding to the same angle index value; and add the periodic sampling angle stored in the target memory space within the current preset sampling period to the pre-set angle period correction value corresponding to the same angle index value to obtain the angle period correction value corresponding to the same angle index value, and update the angle period correction value corresponding to the same angle index value to the pre-set angle period correction value corresponding to the same angle index value; then execute step B6; Step B6: Control the current index value described in step B2 to automatically increment by one, then update the current index value after automatic increment to the current index value described in step B2, and then execute step B3; Step B7: Update the end angle index value to the start angle index value, and update the next preset sampling period to the current preset sampling period. Then execute step B1 to traverse the periodic sampling distance and periodic sampling angle stored in the next preset sampling period from the target memory space. Step B8: Determine all periodic sampling distances and all periodic sampling angles within the target memory space, and set the distance periodic correction value corresponding to the latest updated angle index value to the point cloud distance correction value corresponding to the same angle index value, and set the angle periodic correction value corresponding to the latest updated angle index value to the point cloud angle correction value corresponding to the same angle index value.
5. The method for obtaining the correction value according to claim 4, characterized in that, Each time step B7 is executed, the updated starting angle index value is increased by one. Then, steps B1 and B2 are executed, causing the target upper limit index value calculated in step B2 to increase by one, thereby expanding the traversal range of the corresponding angle index within the current preset sampling period by one.
6. The method for obtaining the correction value according to claim 4, characterized in that, When the number of times steps B1 to B7 are executed reaches the preset target number, step B8 is executed, and it is determined that the robot has experienced the preset target number of preset sampling cycles. Then, the point cloud distance correction value and the point cloud angle correction value corresponding to the same angle index value are used to form the relative offset accumulated by the points with the same angle index value in the batch of point clouds during the robot's walking process. Among them, the point cloud distance correction value corresponding to the same angle index value is equal to the cumulative value of the reference distance within the preset target number of preset sampling periods, and the point cloud angle correction value corresponding to the same angle index value is equal to the cumulative value of the reference angle within the preset target number of preset sampling periods. The preset target number is determined by the measurement accuracy of the code disk.
7. The method for obtaining the correction value according to claim 1, characterized in that, In step A, the method for converting the periodic sampling distance and the periodic sampling angle includes: The difference between the distance traveled by the encoder mounted on the robot's left drive wheel at the current moment and the distance traveled at the reference moment is used to obtain the distance traveled by the left drive wheel. The difference between the distance traveled by the encoder mounted on the robot's right drive wheel at the current moment and the distance traveled at the reference moment is used to obtain the distance traveled by the right drive wheel. Calculate half the sum of the distances traveled by the left drive wheel and the right drive wheel to obtain the periodic sampling distance; The ratio of the difference between the travel distance of the left drive wheel and the travel distance of the right drive wheel to the wheelbase is calculated to obtain the periodic sampling angle; The start time of the preset sampling period is the reference time, and the end time of the preset sampling period is the current time; the distance between the robot's left drive wheel and its right drive wheel is equal to the wheel track; the motion distance sampled within the preset sampling period is divided into the motion distance of the left drive wheel and the motion distance of the right drive wheel.
8. The method for obtaining the correction value according to claim 7, characterized in that, After calculating the periodic sampling distance and periodic sampling angle, the motion distance measured by the encoder mounted on the robot's left drive wheel at the current moment is updated to the motion distance measured by the encoder mounted on the robot's left drive wheel at the reference moment; and the motion distance measured by the encoder mounted on the robot's right drive wheel at the current moment is updated to the motion distance measured by the encoder mounted on the robot's right drive wheel at the reference moment.
9. A chip storing a computer program, characterized in that, When the computer program is executed, it implements the steps of the correction value acquisition method according to any one of claims 1 to 8.
10. A robot, characterized in that, The robot is equipped with the chip described in claim 9.
Citation Information
Patent Citations
An angle calibration method for laser heads, a chip, and a robot
CN112450808B
