Robot main direction detection method and system, intelligent mobile instrument and storage medium
By preprocessing and linear fitting detection of the point cloud data introduced by the scanning robot, dynamically update the straight line sorting table to obtain the best fit line, solve the problem of poor effects of the scanning robot line recognition, and realize the efficient and accurate robot owner owner owner Direction detection.
Patent Information
- Application Number
- CN202411398193.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-30
AI Technical Summary
When existing sweeping robots move, the route recognition effect is poor, resulting in skewness during map creation, affecting the user experience and reducing the cleaning efficiency.
By pre -processing the imported cloud data, the candidate point cloud data is obtained, and the straight -line fitting detection is performed. The validity detection of the fit line is performed according to the preset threshold. Dynamically update the linear sorting table until the preset fitting conditions are met to obtain the best fit line to control the robot for main direction detection.
The effect and accuracy of route recognition has been improved, the amount of calculation is reduced, the calculation efficiency is improved, and the main direction of the main direction of the robot is achieved.
Smart Images

Figure CN119379737A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot control, and in particular to a robot main direction detection method, system, intelligent mobile instrument and storage medium. Background Art
[0002] At present, there are two main positioning and navigation technologies used by mainstream sweeping robots on the market, one is visual positioning and navigation technology, and the other is laser positioning and navigation technology.
[0003] Laser positioning and navigation technology mainly works by emitting laser signals to the target object, calculating the distance based on the time difference of the signal reflected from the object, and then emitting the laser at an angle to determine the angle between the object and the transmitter, thereby obtaining the relative position of the object and the transmitter.
[0004] Visual positioning and navigation technology includes cameras (CCD image sensors), video signal digitization equipment, DSP-based fast signal processors, computers and their peripherals, etc. Its working principle is to optically process the environment around the robot, first collect image information with a camera, compress the collected information, and then feed it back to a learning subsystem composed of neural networks and statistical methods. The learning subsystem then links the collected image information with the actual position of the robot to complete the robot's autonomous navigation and positioning function.
[0005] However, the current main direction detection method for sweeper-based map robots is calculated based on the conversion of point clouds into pixels or grids. If the accuracy is lost during this conversion process, it will cause distortion when building the map, affecting the user experience and there is also a risk of reducing the cleaning efficiency of the sweeper.
[0006] Therefore the prior art still needs to be improved and enhanced. Summary of the invention
[0007] The main purpose of the present invention is to provide a robot main direction detection method, system, intelligent mobile instrument and storage medium, aiming to solve the problem of poor route recognition effect of the intelligent sweeping robot when moving in the prior art.
[0008] In order to achieve the above object, the present invention adopts the following technical solutions:
[0009] In a first aspect, an embodiment of the present application provides a method for detecting a main direction of a robot, comprising:
[0010] After receiving the setting instruction of the current detection mode, the imported initial point cloud data is preprocessed to obtain candidate point cloud data;
[0011] Each time, a current fitting line is obtained by performing straight line fitting on the candidate point cloud data, and a validity detection is performed on the current fitting line based on a corresponding preset threshold value in the current detection mode, and a current fitting line with a valid detection result is recorded as a valid fitting line;
[0012] After obtaining at least one valid fitting straight line, the number of target point clouds whose distance from the current valid fitting straight line is less than a preset distance threshold is determined each time, and the old straight line sorting table obtained by the last straight line fitting is dynamically updated according to the number of target point clouds until the preset fitting condition is met to obtain the latest straight line sorting table;
[0013] The effective fitting line containing the largest number of target point clouds in the latest straight line sorting table is fitted again to obtain the best fitting line, and the robot is controlled to perform robot main direction detection based on the best fitting line.
[0014] In some embodiments, dynamically updating the old straight line sorting table obtained from the last straight line fitting according to the target point cloud number includes:
[0015] Compare the target point cloud number corresponding to the currently obtained valid fitting straight line with the first target point cloud number of the first valid fitting straight line in the old straight line sorting table, and retain the valid fitting straight line with the largest number of target point clouds in the straight line sorting table;
[0016] All valid fitting lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table, and the updated line sorting table is used as the old line sorting table for the next line fitting.
[0017] In some embodiments, the step of performing straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and controlling the robot to perform robot main direction detection based on the best fitting line, includes:
[0018] A second valid fitting straight line corresponding to the largest number of target point clouds is obtained from the latest straight line sorting table, all target point clouds corresponding to the second valid fitting straight line are fitted to obtain the best fitting straight line, and the angle of the main direction is calculated based on the best fitting straight line.
[0019] In some embodiments, different preset thresholds are set correspondingly in different detection modes, and the preset thresholds include: a preset distance threshold and a preset internal point number threshold; each time the candidate point cloud data is fitted with a straight line to obtain a current fitted straight line, the validity detection of the current fitted straight line is performed based on the corresponding preset threshold in the current detection mode, including:
[0020] Select at least two point clouds from the candidate point cloud data to perform straight line fitting to obtain the current fitting straight line;
[0021] Calculating the vertical distances from the remaining candidate point clouds in the candidate point cloud data to the current fitting straight line, and counting the number of point clouds whose vertical distances to the current fitting straight line are not greater than the preset distance threshold, to obtain the target point cloud number;
[0022] When the number of the target point cloud is not less than the preset internal point number threshold, the current fitting straight line is recorded as the valid fitting straight line.
[0023] In some embodiments, the preset threshold includes: a preset angle threshold;
[0024] The step of comparing the target point cloud number corresponding to the currently obtained valid fitting straight line with the first target point cloud number of the first valid fitting straight line in the old straight line sorting table further includes:
[0025] Calculate the deviation between the current valid fitting straight line and the initial parameters corresponding to any valid fitting straight line in the old straight line sorting table to obtain an angle, and determine whether the angle is within the preset angle threshold;
[0026] The valid fitting straight line whose included angle is within the preset angle threshold is used as the first valid fitting straight line.
[0027] In some embodiments, the preset fitting condition is a preset number of fitting times, and the preset number of fitting times is obtained, including:
[0028] After calculating the probability of not being able to obtain the target point cloud according to the number of target point clouds of the current valid fitting line and the total number of candidate point clouds, the preset number of fitting times is calculated according to the probability of not being able to obtain the target point cloud.
[0029] In some embodiments, the performing validity detection on the current fitting straight line based on the corresponding preset threshold in the current detection mode further includes:
[0030] If the current fitting line is invalid, at least two point clouds from the remaining candidate point clouds are continuously selected for straight line fitting until the preset fitting condition is met or the valid fitting line is obtained.
[0031] In a second aspect, an embodiment of the present application provides a robot main direction detection system, comprising:
[0032] A preprocessing module, for preprocessing the imported initial point cloud data to obtain candidate point cloud data after receiving the setting instruction of the current detection mode;
[0033] a first fitting module, configured to perform straight line fitting on the candidate point cloud data each time to obtain a current fitting line, perform validity detection on the current fitting line based on a corresponding preset threshold value in the current detection mode, and record the current fitting line with a valid detection result as a valid fitting line;
[0034] A dynamic update module is used for determining the number of target point clouds whose distance from the current valid fitting line is less than a preset distance threshold each time after obtaining at least one of the valid fitting lines, and dynamically updating the old straight line sorting table obtained by the last straight line fitting according to the target point cloud number, until the preset fitting condition is met, and the latest straight line sorting table is obtained;
[0035] The second fitting module is used to perform straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and control the robot to perform robot main direction detection based on the best fitting line.
[0036] In a third aspect, an embodiment of the present application provides an intelligent mobile instrument, comprising: a memory and a processor; wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the robot main direction detection method as described above are implemented.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the robot main direction detection method as described above.
[0038] Compared with the prior art, the present invention provides a robot main direction detection method, system, intelligent mobile instrument and storage medium, the method comprising: after receiving the setting instruction of the current detection mode, preprocessing the imported initial point cloud data to obtain candidate point cloud data; performing straight line fitting on the candidate point cloud data each time to obtain the current fitting line, performing validity detection on the current fitting line based on the corresponding preset threshold value in the current detection mode, and recording the current fitting line with a valid detection result as a valid fitting line; after obtaining at least one of the valid fitting lines, determining the number of target point clouds whose distance from the current valid fitting line is less than the preset distance threshold each time, and dynamically updating the old straight line sorting table obtained by the last straight line fitting according to the target point cloud number until the preset fitting condition is met to obtain the latest straight line sorting table; performing straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and controlling the robot to perform robot main direction detection based on the best fitting line, so as to achieve efficient and accurate final fitting of the best fitting line from the candidate point cloud data, and achieve main direction angle calculation or usage scene detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A flowchart of an embodiment of a method for detecting the main direction of a robot provided by the present invention;
[0041] Figure 2 A judgment flow chart of an embodiment of a method for detecting the main direction of a robot provided by the present invention;
[0042] Figure 3 A flowchart of effectiveness detection in an embodiment of a method for detecting the main direction of a robot provided by the present invention;
[0043] Figure 4 A flowchart of dynamically updating an old straight line sorting table in an embodiment of a robot main direction detection method provided by the present invention;
[0044] Figure 5 A flowchart of obtaining a first valid fitting straight line in an embodiment of a robot main direction detection method provided by the present invention;
[0045] Figure 6 This is an architectural relationship diagram of an embodiment of the robot main direction detection system provided by the present invention. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0047] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0048] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0049] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0050] The present invention provides a robot main direction detection method, system, intelligent mobile instrument and storage medium. In the present invention, after obtaining a number of effective fitting lines by performing effective fitting line detection on candidate point cloud data for multiple times, the old straight line sorting table is dynamically updated each time according to the preset angle threshold and the number of target point clouds of the current effective fitting lines, and when the number of straight line fittings reaches the preset number of fittings obtained in advance, straight line fitting is performed on all the inner points of the effective fitting line containing the largest number of target point clouds to obtain the best fitting line for robot main direction detection or use scene detection, thereby improving the effect and accuracy of route recognition, reducing the amount of calculation, and improving the calculation efficiency.
[0051] The following describes the design of the robot main direction detection method through specific exemplary embodiments. It should be noted that the following embodiments are only used to explain the technical solution of the invention and are not specifically limited:
[0052] See also Figure 1 , the embodiment of the present application provides a method for detecting the main direction of a robot, comprising steps S100-S400:
[0053] S100, after receiving the setting instruction of the current detection mode, pre-processing the imported initial point cloud data to obtain candidate point cloud data;
[0054] For illustration, see also Figure 2 , the implementation process of the robot main direction detection method (i.e., the improved RANSAC algorithm) is as follows:
[0055] Among them, the robot main direction detection method is applied to intelligent mobile instruments (such as sweepers). When the user uses the intelligent mobile instrument, the user can pre-set the parameters of the straight line detection according to the selected detection mode, that is, set the corresponding preset inner point number threshold, preset residual threshold (same as the preset distance threshold, the preset residual threshold is the preset threshold for determining whether the target point cloud is an inner point on the current fitting line, and the specific range needs to be determined according to the accuracy of the point cloud data and the usage scenario) and the initial number of iterations in different detection modes. For example, in the full-map robot main direction detection mode, the preset distance threshold is set to 3cm, and the initial number of iterations is set to 500 times.
[0056] Then, if the accuracy of straight-line fitting and the amount of subsequent calculations are taken into consideration, the preset distance threshold and the preset internal point number threshold can be set smaller when detecting the local robot's main direction, while the preset distance threshold and the preset internal point number threshold can be set larger when detecting the full-map robot's main direction. The initial number of iterations can be set to a slightly larger value, and subsequent calculations will be automatically adjusted.
[0057] Among them, the detection modes include: local robot main direction detection, full-image robot main direction detection, long corridor detection, skirting board detection, narrow straight channel detection and straight wall scene detection.
[0058] First, the user selects a detection mode (i.e., the current detection mode) according to the usage scenario. Then, the system will receive the setting instruction of the current detection mode and enter the data processing before the straight line detection:
[0059] Receive the imported initial point cloud data and preprocess the initial point cloud data, for example, including: cleaning data, processing missing values, standardizing or scaling features, encoding categorical variables, and reducing dimensions. In this embodiment, equal-interval sampling processing is adopted to remove noise to ensure high-quality data, accelerate the learning process and model reliability, and reduce the calculation amount of subsequent fitting detection, so as to finally obtain candidate point cloud data.
[0060] Please continue reading Figure 1 , S200, each time a straight line is fitted to the candidate point cloud data to obtain a current fitting line, a validity check is performed on the current fitting line based on a corresponding preset threshold in the current detection mode, and the current fitting line with a valid detection result is recorded as a valid fitting line.
[0061] Different preset thresholds are correspondingly set in different detection modes, and the preset thresholds include: a preset distance threshold, a preset inner point number threshold and a preset angle threshold.
[0062] Exemplarily, after the initial point cloud data is preprocessed to obtain the candidate point cloud data, a loop detection of effective fitting lines for the candidate point cloud data is started:
[0063] For example, two candidate point cloud data are randomly selected each time for straight line fitting, and the current fitting line is obtained after the current fitting detection is completed, and the validity of the current fitting line is checked based on the corresponding preset threshold (here refers to the preset internal point number threshold) in the current detection mode, that is, whether the current fitting line is valid is judged according to the preset internal point number threshold in the preset threshold, and then the current fitting line with a valid detection result is recorded as a valid fitting line, thereby effectively improving the efficiency and accuracy of calculating the fitting line.
[0064] For example, in one embodiment, see Figure 3 , step S200, each time the candidate point cloud data is fitted with a straight line to obtain a current fitted straight line, and the validity of the previous fitted straight line is detected based on the corresponding preset threshold in the current detection mode, including:
[0065] S210, performing straight line fitting on at least two point clouds in the candidate point cloud data to obtain a current fitting straight line;
[0066] S220, calculating the vertical distances from the remaining candidate point clouds in the candidate point cloud data to the current fitting line, and counting the number of point clouds whose vertical distances to the current fitting line are not greater than a preset distance threshold, to obtain the number of target point clouds;
[0067] S230: When the number of target point clouds is not less than a preset internal point number threshold, the current fitting straight line is recorded as a valid fitting straight line.
[0068] In this embodiment, the optional selection is a random selection, so any one of the at least two target point clouds that have been selected can also be selected to continue the fitting process.
[0069] Demonstratively, after obtaining the candidate point cloud data, the iterative process of line detection begins:
[0070] First, at least two target point clouds in the optional candidate point cloud data are selected to perform a straight line fitting using the least squares method to obtain the current fitting straight line and its straight line parameters, where the straight line parameters include: the y component, x component and straight line constant term of the straight line direction vector, from which the angle of the straight line, that is, the slope of the straight line, can be calculated.
[0071] Then, the vertical distances of the remaining candidate point clouds in the candidate point cloud data to the current fitting line are calculated according to the line parameters, that is, the vertical distances of the remaining candidate point clouds from the current fitting line. The vertical distance is compared with the preset residual threshold (i.e., the preset distance threshold) in the current detection mode to count the number of inner points of the current fitting line and obtain the number of target point clouds. Among them, those remaining candidate point clouds whose vertical distances to the current fitting line are not greater than the preset distance threshold are called inner points.
[0072] Finally, the number of inliers is compared with the preset inliers threshold in the current detection mode to determine whether the current fitted straight line is valid (corresponding to Figure 2 In the step of determining whether the number of inner points meets the requirement of the fitted straight line), that is, determining whether the number of target point clouds of the current fitted straight line is not less than the preset inner point number threshold, and when the number of target point clouds is not less than the preset inner point number threshold, retaining the current fitted straight line as a valid fitted straight line, thereby achieving efficient and accurate straight line fitting operation.
[0073] For example, in yet another embodiment, another example in the present application is that at least two target point clouds selected each time cannot be selected further.
[0074] For example, in one embodiment, the validity detection of the current fitting straight line is performed based on the corresponding preset threshold value in the current detection mode, and then the following is further included:
[0075] If the current fitting line is invalid, at least two point clouds from the remaining candidate point clouds are continuously selected for straight line fitting until a preset fitting condition is met or a valid fitting line is obtained.
[0076] Exemplarily, when judging whether the number of target point clouds is not less than the preset internal point number threshold:
[0077] If the number of target point clouds is less than the preset inner point number threshold, the current fitting line whose number of target point clouds is less than the preset inner point number threshold is determined as an invalid fitting line, and the number of iterations is increased by one, and at least two target point clouds are selected from the candidate point cloud data to perform the valid fitting line detection step. Then, when the current fitting line is invalid, the valid fitting line detection step is repeated until the preset number of fitting times is reached or a valid fitting line is obtained.
[0078] Please continue reading Figure 1 S300, after obtaining at least one valid fitting straight line, the number of target point clouds whose distance to the current valid fitting straight line is less than a preset distance threshold is determined each time, and the old straight line sorting table obtained by the last straight line fitting is dynamically updated according to the number of target point clouds until the preset fitting condition is met to obtain the latest straight line sorting table.
[0079] Exemplarily, in the iterative process of straight line detection, if the old straight line sorting table stores at least one valid fitting straight line, and the current fitting straight line is detected to obtain the current valid fitting straight line, the old straight line sorting table obtained from the previous straight line fitting can be dynamically updated according to the target point cloud number of the current valid fitting straight line and the preset angle threshold corresponding to the preset detection mode, that is, according to the preset angle threshold and the target point cloud number of the current valid fitting straight line, the target valid fitting straight line in the old straight line sorting table is replaced and sorted together with the remaining valid fitting straight lines in the old straight line sorting table, or is directly sorted together with the valid fitting straight lines in the old straight line sorting table.
[0080] Then, after each update in the iterative process, it is determined whether the conditions for ending the iteration are met, that is, whether the number of straight line fitting times of the fitting straight line operation reaches the preset fitting times (that is, the preset fitting conditions), and when it is reached, the operation of valid fitting straight line detection is stopped to obtain the latest straight line sorting table, thereby jumping out of the iterative process.
[0081] For example, in one embodiment, the preset fitting condition is a preset number of fitting times, and the preset number of fitting times is obtained, including:
[0082] After calculating the probability of not being able to obtain the target point cloud according to the number of target point clouds of the current valid fitting line and the total number of candidate point clouds, the preset number of fitting times is calculated according to the probability of not being able to obtain the target point cloud.
[0083] Exemplarily, the preset number of fitting times is obtained in the following manner:
[0084] After obtaining the valid fitting line that contains the most target point clouds, the probability of not obtaining the target point clouds is calculated based on the target point clouds of the current valid fitting line and the total number of candidate point clouds: K point clouds can be randomly sampled at the beginning of the iteration, assuming that the number of target point clouds is n and the total number of point clouds is m. Then, the probability that any point cloud is an inner point is p = n / m (1).
[0085] Then, the preset number of fitting times is calculated based on the probability of not getting the target point cloud number: first calculate the probability of not getting the inner point e = 1-p(2); then the probability that any K points are inner points is p K (3); Similarly, at least one of the K points is an outside point, that is, the probability of sampling failure is 1-p K (4), then the probability of failure in all M samplings is (1-p K ) M (5), then the probability of at least one success in M samplings is z = 1-(1-p K ) M (6), from which the minimum number of iterations required (preset number of fittings) can be calculated: N = log(1-z) / log(1-pK )(7).
[0086] Secondly, the preset fitting times replaces the initial iteration times, and in each subsequent effective fitting straight line detection, it is determined whether the straight line fitting times are not less than the preset fitting times (N = log(1-z) / log(1-p K )), and when the number of straight line fitting times is not less than the preset number of fitting times, the operation of valid fitting straight line detection is stopped to jump out of the iterative process.
[0087] For further information, see Figure 4 , dynamically update the old straight line sorting table obtained from the last straight line fitting according to the number of target point clouds, including:
[0088] S305, comparing the number of target point clouds corresponding to the currently obtained valid fitting line with the first target point cloud number of the first valid fitting line in the old line sorting table, and retaining the valid fitting line with the largest number of target point clouds in the line sorting table;
[0089] S306, sorting all valid fitting lines in the line sorting table according to their respective target point cloud numbers to obtain an updated line sorting table, and the updated line sorting table is used as the old line sorting table for the next line fitting.
[0090] Exemplarily, when there is only the first valid fitting line in the old straight line sorting table and a current valid fitting line is obtained by performing straight line fitting on the current fitting line, the following two scenarios may exist:
[0091] In the first scenario, if the first valid fitting line happens to be the first valid fitting line (the same as the target valid fitting line, the angle deviation of which from the current valid fitting line is within the preset angle threshold (for example, 1°-2°)), then at this time, the number of target point clouds corresponding to the current valid fitting line is compared with the first target point cloud number of the first valid fitting line, and the valid fitting line with the largest number of target point clouds is retained in the line sorting table.
[0092] For example, if the first valid fitting line (also the first valid fitting line in the first scenario) is A, and the current valid fitting line is B, and the angle deviation between A and B is within the preset angle threshold, the number of inner points of A and B is directly compared, and the valid fitting line with the largest number of target point clouds is retained.
[0093] Then, all valid fitting lines in the straight line sorting table are sorted according to their respective target point cloud numbers. At this time, only the valid fitting line with the largest number of target point clouds does not need to be sorted, and an updated straight line sorting table is obtained. Afterwards, the updated straight line sorting table is used as the old straight line sorting table for the next straight line fitting.
[0094] In the second scenario, if the first valid fitting line is not the first valid fitting line, then at this time, the first valid fitting line and the current valid fitting line are directly sorted according to their respective target point cloud numbers to obtain an updated straight line sorting table. Similarly, the updated straight line sorting table is used as the old straight line sorting table for the next straight line fitting.
[0095] However, when there are at least two sorted valid fitting lines in the old straight line sorting table, and the current fitting line is fitted to obtain the current valid fitting line, and there is a first valid fitting line in the old straight line sorting table, similarly, the current valid fitting line is compared with the first valid fitting line according to their respective target point cloud numbers, and the valid fitting line with the largest number of target point clouds is retained in the sorting position of the first valid fitting line in the straight line sorting table.
[0096] Then, all valid fitting lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table. Afterwards, the updated line sorting table is used as the old line sorting table for the next line fitting.
[0097] For example, if there are two sorted valid fitting lines C and D in the old straight line sorting table, and the current valid fitting line is B, and the angle deviation between B and C is within the preset angle threshold, the number of inner points of B and C is compared, and the valid fitting line with the largest number of target point clouds is retained. Assuming that B is retained, B and D are sorted in the updated straight line sorting table.
[0098] Furthermore, in another embodiment of the present application, several valid fitting lines whose angle deviations are outside the preset angle threshold may be sorted first, and then, in the straight line sorting table, only the order of the valid fitting line with a larger number of target point clouds among the several valid fitting lines whose angle deviations are within the preset angle threshold is retained.
[0099] In one embodiment, see Figure 5 , compare the target point cloud number corresponding to the current valid fitting line with the first target point cloud number of the first valid fitting line in the old line sorting table, and also include:
[0100] S301, performing deviation calculation on the initial parameters corresponding to the current valid fitting straight line and each valid fitting straight line in the old straight line sorting table to obtain an angle, and determining whether the angle is within a preset angle threshold;
[0101] S302: taking a valid fitting straight line whose included angle is within a preset angle threshold as a first valid fitting straight line.
[0102] Exemplarily, when there is at least one valid fitting straight line in the old straight line sorting table, the deviation of the initial parameters corresponding to the current valid fitting straight line and each valid fitting straight line in the old straight line sorting table is calculated to obtain the included angle, and it is determined whether the included angle is within the preset angle threshold:
[0103] If they are within the preset angle range, it means that the two valid fitting lines can be fitted into one straight line, then the valid fitting line with an included angle within the preset angle threshold is taken as the first valid fitting line, so as to compare the target point cloud number between the current valid fitting line and the first valid fitting line.
[0104] However, if it is not within the preset angle range, the current valid fitting straight line is added to the old straight line sorting table, and all valid fitting straight lines in the old straight line sorting table are sorted to obtain an updated straight line sorting table.
[0105] Please continue reading Figure 1 , S400, performing straight line fitting again on the valid fitting straight line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting straight line, and controlling the robot to perform robot main direction detection based on the best fitting straight line.
[0106] Exemplarily, after obtaining the latest straight line sorting table, straight line fitting is performed on all inner points of the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line (in detection modes such as narrow straight channel detection and straight wall scene detection, the inner points in the first few valid fitting lines with a relatively high number of target point clouds and which are not parallel or perpendicular to other lines are respectively fitted to obtain a corresponding number of better fitting lines), so that the main direction detection of the robot can be performed according to the best fitting line.
[0107] Among them, in other embodiments of the present application, after obtaining the best fitting straight line, the main direction angle can be further calculated based on the best fitting straight line (applicable to detection modes such as local robot main direction detection and full-image main direction detection) or scene judgment can be performed to obtain a scene judgment result (applicable to detection modes such as narrow straight channel detection, long corridor detection, skirting board detection and straight wall scene detection).
[0108] Among them, the scene determination can be performed by determining whether the point cloud data contains a specific straight line for determining the scene, for example:
[0109] If it is a long corridor detection, the first few valid fitting lines with the target point cloud number can be further analyzed, and then the relative position of the line and the machine can be determined to determine whether the machine is in the long corridor; if it is a skirting detection, it is necessary to determine whether there is a straight line that is long enough and close to the machine among the first few valid fitting lines, so as to determine the skirting scene; or in a narrow straight channel scene, there must be at least one long straight line on the left and right sides of the machine, and in a straight wall scene, there must be at least one long straight line near the machine.
[0110] It can be understood that in this application, not only the local main direction can be detected, but also the main direction of the entire map can be detected to prevent the map from being skewed when the main direction of the local environment is too different from that of the overall environment. At the same time, it also has the function of detecting the environment, identifying whether the sweeper is in a narrow straight passage or a straight wall, which facilitates more accurate control of the sweeper.
[0111] For example, in one embodiment, step S400, performing straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and controlling the robot to perform robot main direction detection based on the best fitting line, includes:
[0112] S410, screening out the second valid fitting straight line corresponding to the largest number of target point clouds from the latest straight line sorting table, performing straight line fitting on all target point clouds corresponding to the second valid fitting straight line to obtain the best fitting straight line, and calculating the angle of the main direction based on the best fitting straight line.
[0113] Demonstratively, after obtaining the latest straight line sorting table, the second valid fitting straight line containing the largest number of target point clouds is selected from the latest straight line sorting table, and all target point clouds in the second valid fitting straight line containing the largest number of target point clouds are again fitted with the least squares method to obtain fitting straight line parameters that are closer to the real environment, thereby obtaining the best fitting straight line, and the best main direction angle can be further calculated based on the best fitting straight line.
[0114] However, if the number of straight line fitting times is less than the preset number of fitting times, the operation of valid fitting straight line detection continues to be performed.
[0115] For further information, see Figure 6 , the embodiment of the present application provides a robot main direction detection system, including:
[0116] The preprocessing module 1 is used to preprocess the imported initial point cloud data after receiving the setting instruction of the current detection mode to obtain candidate point cloud data; the first fitting module 2 is used to perform straight line fitting on the candidate point cloud data each time to obtain the current fitting line, and perform validity detection on the current fitting line based on the corresponding preset threshold value under the current detection mode, and record the current fitting line with a valid detection result as a valid fitting line.
[0117] The dynamic update module 3 is used to determine the number of target point clouds whose distance to the current valid fitting line is less than a preset distance threshold each time after obtaining at least one valid fitting line, and dynamically update the old straight line sorting table obtained by the previous straight line fitting according to the number of target point clouds until the preset fitting conditions are met to obtain the latest straight line sorting table; the second fitting module 4 is used to perform straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and control the robot to perform robot main direction detection based on the best fitting line.
[0118] Exemplarily, the robot main direction detection method is applicable to the robot main direction detection system. Then, the implementation process of the robot main direction detection system is as follows:
[0119] First, after the user selects a detection mode according to the usage scenario, data processing is performed first: the imported initial point cloud data is received and pre-processed by performing equal-interval sampling processing on the initial point cloud data.
[0120] Then, the iterative process of valid fitting line detection begins:
[0121] Each time, at least two target point clouds in the candidate point cloud data are randomly selected to perform a straight line fitting using the least squares method to obtain the current fitting straight line and its straight line parameters; and the vertical distances of the remaining candidate point clouds in the candidate point cloud data from the current fitting straight line are calculated based on the straight line parameters.
[0122] Secondly, the vertical distance is compared with the preset residual threshold (i.e., the preset distance threshold) in the current detection mode to count the number of target point clouds (point clouds with vertical distances less than the preset residual threshold are called inliers, i.e., target point clouds) whose vertical distances are less than the preset residual threshold to obtain the number of target point clouds. The number of target point clouds is then compared with the preset inlier threshold in the current detection mode to determine whether the current fitted line is valid based on the comparison result: if the number of target point clouds is not less than the preset inlier threshold, the current fitted line is valid and retained as a valid fitted line, otherwise it is invalid.
[0123] Next, after obtaining at least one valid fitting straight line in the old straight line sorting table, the number of target point clouds whose distances from the remaining candidate point clouds in the candidate point cloud data to the current valid fitting straight line are less than the preset distance threshold is counted, and the old straight line sorting table is dynamically updated according to the number of target point clouds, that is, according to the number of target point clouds of the current valid fitting straight line and the preset angle threshold, the current valid fitting straight line can be compared and sorted, thereby replacing several valid fitting straight lines within the preset angle threshold, and sorting several valid fitting straight lines outside the preset angle threshold.
[0124] Furthermore, after completing the current straight line fitting operation, continue to select the same number of target point clouds from the candidate point cloud data, repeat the above steps of valid fitting straight line detection, and then loop the iterative process of straight line fitting until the number of straight line fittings reaches the preset fitting condition, and obtain the latest straight line sorting table, so as to screen out the valid fitting straight lines containing the largest number of target point clouds (while narrow straight channel detection and straight wall scene detection will screen out the first few with a large number of target point clouds).
[0125] Finally, the number of model iterations is calculated according to the probability that no inner point can be obtained. After the preset number of fitting times is calculated in advance, it is determined whether the number of straight line fitting times of the fitting line operation reaches the preset number of fitting times: if it reaches it, the operation of valid fitting line detection is stopped, and then all the inner points in the valid fitting line with the largest number of target point clouds are further fitted to obtain the best fitting line (for narrow straight channel detection and straight wall scene detection, the inner points in the first few valid fitting lines with a large number of target point clouds will be fitted to obtain several better fitting lines) so that the sweeper can drive according to the best fitting line.
[0126] Furthermore, the present application also provides an intelligent mobile instrument. Exemplarily, the intelligent mobile instrument includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the intelligent mobile instrument to execute the functions of each module in the above-mentioned robot main direction detection method or the above-mentioned robot main direction detection system.
[0127] Among them, the intelligent mobile instrument can be an intelligent sweeping robot; the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0128] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. Among them, the memory is used to store a computer program, and the processor can execute the computer program accordingly after receiving an execution instruction.
[0129] The present application also provides a computer-readable storage medium for storing a computer program used in the above-mentioned intelligent mobile instrument. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0130] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus embodiments described above are merely schematic, for example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the apparatus, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0132] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present application.
[0133] In summary, the present invention provides a robot main direction detection method, system, intelligent mobile instrument and storage medium, the method comprising: after receiving the setting instruction of the current detection mode, preprocessing the imported initial point cloud data to obtain candidate point cloud data; performing straight line fitting on the candidate point cloud data each time to obtain the current fitting line, performing validity detection on the current fitting line based on the corresponding preset threshold in the current detection mode, and recording the current fitting line with a valid detection result as a valid fitting line; after obtaining at least one of the valid fitting lines, determining the number of target point clouds whose distance from the current valid fitting line is less than the preset distance threshold each time, and dynamically updating the old straight line sorting table obtained by the last straight line fitting according to the target point cloud number until the preset fitting condition is met to obtain the latest straight line sorting table; performing straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and controlling the robot to perform robot main direction detection based on the best fitting line.
[0134] By performing effective fitting line detection on the candidate point cloud data multiple times and obtaining several effective fitting lines, the old straight line sorting table is dynamically updated each time according to the preset angle threshold and the number of target point clouds of the current effective fitting lines. When the number of straight line fitting times reaches the preset number of fitting times obtained in advance, straight line fitting is performed on all the inner points in the latest straight line sorting table that contain the effective fitting line with the largest number of target point clouds, and the best fitting line is obtained for the robot's main direction detection or usage scene detection, which improves the effect and accuracy of route recognition, reduces the amount of calculation, and improves the calculation efficiency.
[0135] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for detecting the main direction of a robot, characterized in that: include: After receiving the setting instruction of the current detection mode, the imported initial point cloud data is preprocessed to obtain candidate point cloud data; Each time, a current fitting line is obtained by performing straight line fitting on the candidate point cloud data, and a validity detection is performed on the current fitting line based on a corresponding preset threshold value in the current detection mode, and a current fitting line with a valid detection result is recorded as a valid fitting line; After obtaining at least one valid fitting straight line, the number of target point clouds whose distance from the current valid fitting straight line is less than a preset distance threshold is determined each time, and the old straight line sorting table obtained by the last straight line fitting is dynamically updated according to the number of target point clouds until the preset fitting condition is met to obtain the latest straight line sorting table; The effective fitting line containing the largest number of target point clouds in the latest straight line sorting table is fitted again to obtain the best fitting line, and the robot is controlled to perform main direction detection based on the best fitting line.
2. The main direction detection method according to claim 1, characterized in that: The dynamically updating the old straight line sorting table obtained by the last straight line fitting according to the target point cloud number includes: Compare the target point cloud number corresponding to the currently obtained valid fitting straight line with the first target point cloud number of the first valid fitting straight line in the old straight line sorting table, and retain the valid fitting straight line with the largest number of target point clouds in the straight line sorting table; All valid fitting lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table, and the updated line sorting table is used as the old line sorting table for the next line fitting.
3. The main direction detection method according to claim 1, characterized in that: The step of performing straight line fitting again on the valid fitting straight line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting straight line, and controlling the robot to perform main direction detection based on the best fitting straight line, comprises: A second valid fitting straight line corresponding to the largest number of target point clouds is obtained from the latest straight line sorting table, all target point clouds corresponding to the second valid fitting straight line are fitted to obtain the best fitting straight line, and the angle of the main direction is calculated based on the best fitting straight line.
4. The main direction detection method according to claim 1, characterized in that: Different preset thresholds are set correspondingly in different detection modes, and the preset thresholds include: a preset distance threshold and a preset internal point number threshold; each time the candidate point cloud data is fitted with a straight line to obtain a current fitted straight line, the validity detection of the current fitted straight line is performed based on the corresponding preset threshold in the current detection mode, including: Select at least two point clouds from the candidate point cloud data to perform straight line fitting to obtain the current fitting straight line; Calculating the vertical distances from the remaining candidate point clouds in the candidate point cloud data to the current fitting straight line, and counting the number of point clouds whose vertical distances to the current fitting straight line are not greater than the preset distance threshold, to obtain the target point cloud number; When the number of the target point cloud is not less than the preset internal point number threshold, the current fitting straight line is recorded as the valid fitting straight line.
5. The main direction detection method according to claim 2, characterized in that: The preset thresholds include: preset angle thresholds; The step of comparing the target point cloud number corresponding to the currently obtained valid fitting straight line with the first target point cloud number of the first valid fitting straight line in the old straight line sorting table further includes: Calculate the deviation between the current valid fitting straight line and the initial parameters corresponding to any valid fitting straight line in the old straight line sorting table to obtain an angle, and determine whether the angle is within the preset angle threshold; The valid fitting straight line whose included angle is within the preset angle threshold is used as the first valid fitting straight line.
6. The main direction detection method according to claim 2, characterized in that: The preset fitting condition is a preset fitting number, and the preset fitting number is obtained, including: After calculating the probability of not being able to obtain the target point cloud according to the number of target point clouds of the current valid fitting line and the total number of candidate point clouds, the preset number of fitting times is calculated according to the probability of not being able to obtain the target point cloud.
7. The main direction detection method according to claim 4, characterized in that: The validity detection of the current fitting straight line is performed based on the corresponding preset threshold value in the current detection mode, and then further includes: If the current fitting line is invalid, at least two point clouds from the remaining candidate point clouds are continuously selected for straight line fitting until the preset fitting condition is met or the valid fitting line is obtained.
8. A main direction detection system, characterized in that: include: A preprocessing module, for preprocessing the imported initial point cloud data to obtain candidate point cloud data after receiving the setting instruction of the current detection mode; a first fitting module, configured to perform straight line fitting on the candidate point cloud data each time to obtain a current fitting line, perform validity detection on the current fitting line based on a corresponding preset threshold value in the current detection mode, and record the current fitting line with a valid detection result as a valid fitting line; A dynamic update module is used for determining the number of target point clouds whose distance from the current valid fitting line is less than a preset distance threshold each time after obtaining at least one of the valid fitting lines, and dynamically updating the old straight line sorting table obtained by the last straight line fitting according to the target point cloud number, until the preset fitting condition is met, and the latest straight line sorting table is obtained; The second fitting module is used to perform straight line fitting again on the valid fitting line containing the largest number of target point clouds in the latest straight line sorting table to obtain the best fitting line, and control the robot to perform main direction detection based on the best fitting line.
9. An intelligent mobile device, characterized in that: include: A memory and a processor; wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the steps of the main direction detection method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the steps of the main direction detection method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method for optimizing fitting straight line based on laser point cloud data, chip and robot
CN115113230A
Obstacle detection method, device and equipment and computer storage medium
CN115116020A
Optimized RANSAC point cloud plane fitting method based on DBSCAN clustering
CN118312880A
Pallet detection device, forklift, pallet detection method, and program
EP3961259A1