Robot main direction detection method, system, intelligent mobile instrument and storage medium
By preprocessing and fitting the point cloud data of the intelligent sweeping robot with straight lines, and dynamically updating the straight line sorting table, the problem of poor route recognition was solved, and efficient and accurate robot main direction detection was achieved.
Patent Information
- Application Number
- CN202411398193.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In existing technologies, intelligent robotic vacuum cleaners have poor route recognition when moving, resulting in skewed mapping and affecting user experience and cleaning efficiency.
By preprocessing the received initial point cloud data, candidate point cloud data is obtained, and straight line fitting is performed on it. The validity is detected based on a preset threshold, and the straight line sorting table is dynamically updated until the preset fitting conditions are met, so as to obtain the best fitted straight line to control the robot's main direction detection.
It improves the effectiveness and accuracy of route recognition, reduces the amount of computation, increases computational efficiency, and achieves efficient and accurate robot main direction detection.
Smart Images

Figure CN119379737B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of robot control, and in particular to a method, system, intelligent mobile instrument, and storage medium for detecting the main direction of a robot. Background Technology
[0002] Currently, the positioning and navigation technologies used by mainstream robotic vacuum cleaners on the market mainly include two types: visual positioning and navigation technology and laser positioning and navigation technology.
[0003] Laser positioning and navigation technology mainly works by emitting laser signals at the target object, calculating the distance based on the time difference of the signal reflected back from the object, and then determining the angle between the object and the transmitter by emitting the laser at the same angle, thus 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. Simply put, its working principle involves optical processing of the robot's surrounding environment. First, a camera acquires image information, compresses the acquired information, and then feeds it back to a learning subsystem composed of neural networks and statistical methods. This learning subsystem then associates the acquired image information with the robot's actual position, completing the robot's autonomous navigation and positioning function.
[0005] However, the current method for detecting the main direction of a robot vacuum's map is based on converting point clouds into pixels or grids. If accuracy is lost during this conversion process, it can lead to skewed mapping, affecting the user experience and potentially reducing the robot vacuum's cleaning efficiency.
[0006] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention
[0007] The main objective of this 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 performance of existing intelligent sweeping robots when they are moving.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] In a first aspect, embodiments of this application provide a robot main direction detection method, including:
[0010] After receiving the setting instruction for the current detection mode, the imported initial point cloud data is preprocessed to obtain candidate point cloud data;
[0011] Each time a straight line is fitted to the candidate point cloud data, the current fitted line is obtained. The validity of the current fitted line is detected based on the corresponding preset threshold under the current detection mode, and the current fitted line with a valid detection result is recorded as a valid fitted line.
[0012] After obtaining at least one effective fitted line, the number of target point clouds that are less than a preset distance threshold with respect to the current effective fitted line is determined each time, and the old line sorting table obtained from the previous line fitting is dynamically updated according to the number of target point clouds until the preset fitting condition is met, and the latest line sorting table is obtained.
[0013] The effective fitted line with the most target point cloud in the latest line sorting table is fitted again to obtain the best fitted line, and the robot is controlled to perform robot main direction detection based on the best fitted line.
[0014] In some embodiments, dynamically updating the old line sorting table obtained from the previous line fitting based on the target point cloud number includes:
[0015] Compare the number of target point clouds corresponding to the current effective fitted line with the number of the first target point clouds of the first effective fitted line in the old line sorting table, and retain the effective fitted line with the most target point clouds in the line sorting table.
[0016] All valid fitted lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table, which serves as the old line sorting table for the next line fitting.
[0017] In some embodiments, the step of refitting the effective fitted line containing the most target point cloud data in the latest line sorting table to obtain the best fitted line, and controlling the robot to perform robot main direction detection based on the best fitted line, includes:
[0018] The second effective fitted line with the most target point clouds is selected from the latest line sorting table. All target point clouds corresponding to the second effective fitted line are fitted with lines to obtain the best fitted line. The angle of the main direction is calculated based on the best fitted line.
[0019] In some embodiments, different preset thresholds are set for different detection modes, including a preset distance threshold and a preset intrapoint count threshold; the step of performing a straight line fitting on the candidate point cloud data each time to obtain the current fitted straight line, and performing validity detection on the current fitted straight line based on the corresponding preset threshold in the current detection mode, includes:
[0020] At least two point clouds from the candidate point cloud data are randomly selected for line fitting to obtain the current fitted line;
[0021] Calculate the vertical distances of the remaining candidate point clouds in the candidate point cloud data to the current fitted line, and count the number of point clouds whose vertical distances to the current fitted line are not greater than the preset distance threshold to obtain the target point cloud number;
[0022] When the number of target point clouds is not less than the preset threshold number of internal points, the current fitted line is recorded as the effective fitted line.
[0023] In some embodiments, the preset threshold includes: a preset angle threshold;
[0024] Before comparing the number of target point clouds corresponding to the currently effective fitted line with the number of target point clouds of the first effective fitted line in the old line sorting table, the process also includes:
[0025] The deviation between the current effective fitted line and the initial parameters corresponding to any one of the effective fitted lines in the old line sorting table is calculated to obtain the included angle, and it is determined whether the included angle is within the preset angle threshold.
[0026] The effective fitted line whose included angle is within the preset angle threshold is taken as the first effective fitted line.
[0027] In some embodiments, the preset fitting condition is a preset number of fitting iterations, and the preset number of fitting iterations is obtained by:
[0028] After calculating the probability of not being able to obtain the target point cloud based on the number of target point clouds and the total number of candidate point clouds of the currently effective fitted line, the preset number of fitting attempts is calculated based on the probability of not being able to obtain the target point cloud.
[0029] In some embodiments, the step of performing validity detection on the current fitted line based on a corresponding preset threshold under the current detection mode further includes:
[0030] If the current fitted line is invalid, then at least two point clouds from the remaining candidate point clouds will be randomly selected for line fitting until the preset fitting condition is met or the valid fitted line is obtained.
[0031] Secondly, embodiments of this application provide a robot main orientation detection system, including:
[0032] The preprocessing module is used to preprocess the imported initial point cloud data after receiving the setting instruction for the current detection mode to obtain candidate point cloud data.
[0033] The first fitting module is used to perform straight line fitting on the candidate point cloud data each time to obtain the current fitted line, perform validity detection on the current fitted line based on the corresponding preset threshold in the current detection mode, and record the current fitted line with a valid detection result as a valid fitted line.
[0034] The dynamic update module is used to determine the number of target point clouds that are less than a preset distance threshold from the current effective fitted line each time after obtaining at least one of the effective fitted lines, and to dynamically update the old line sorting table obtained from the previous line fitting based on the number of target point clouds, until the preset fitting condition is met and the latest line sorting table is obtained.
[0035] The second fitting module is used to perform line fitting again on the effective fitted line with the most target point cloud in the latest line sorting table to obtain the best fitted line, and control the robot to perform robot main direction detection based on the best fitted line.
[0036] Thirdly, embodiments of this application provide an intelligent mobile instrument, including: a memory and a processor; wherein, the memory stores a computer program, and when the computer program is executed by the processor, it implements the steps of the robot main direction detection method as described above.
[0037] Fourthly, embodiments of this application provide 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 to existing technologies, this invention provides a robot main direction detection method, system, intelligent mobile instrument, and storage medium. The method includes: after receiving a setting instruction for the current detection mode, preprocessing the imported initial point cloud data to obtain candidate point cloud data; performing line fitting on the candidate point cloud data each time to obtain a current fitted line; performing validity detection on the current fitted line based on a corresponding preset threshold under the current detection mode, and recording the current fitted line with a valid detection result as a valid fitted line; after obtaining at least one valid fitted line, determining the number of target point clouds whose distance from the current valid fitted line is less than a preset distance threshold each time, and dynamically updating the old line sorting table obtained from the previous line fitting according to the number of target point clouds, until a preset fitting condition is met to obtain a latest line sorting table; performing line fitting again on the valid fitted line containing the most target point clouds in the latest line sorting table to obtain the best fitted line, and controlling the robot to perform robot main direction detection based on the best fitted line, thereby achieving efficient and accurate final fitting of the best fitted line from the candidate point cloud data, and realizing main direction angle calculation or usage scenario detection. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 A flowchart of one embodiment of the robot main direction detection method provided by the present invention;
[0041] Figure 2 A flowchart illustrating the judgment process of one embodiment of the robot main direction detection method provided by the present invention;
[0042] Figure 3 A flowchart illustrating the effectiveness detection in one embodiment of the robot main direction detection method provided by the present invention;
[0043] Figure 4 A flowchart illustrating the dynamic updating of an old line sorting table in one embodiment of the robot main direction detection method provided by the present invention;
[0044] Figure 5 A flowchart illustrating the acquisition of a first valid fitted line in one embodiment of the robot main direction detection method provided by the present invention;
[0045] Figure 6 This is an architectural diagram of one embodiment of the robot main direction detection system provided by the present invention. Detailed Implementation
[0046] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0047] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0048] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0049] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0050] This invention provides a method, system, intelligent mobile instrument, and storage medium for robot main direction detection. In this invention, after repeatedly performing effective line fitting detection on candidate point cloud data to obtain several effective fitted lines, the old line sorting table is dynamically updated each time based on a preset angle threshold and the target point cloud count of each of the current effective fitted lines. When the number of line fitting attempts reaches a pre-set preset number, line fitting is performed on all interior points of the effective fitted line containing the largest number of target point clouds to obtain the best fitted line for robot main direction detection or usage scenario detection. This improves the effectiveness and accuracy of route recognition, reduces computational load, and increases computational efficiency.
[0051] The design scheme of the robot main direction detection method is described below 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 intended to limit it specifically:
[0052] Please see Figure 1 This application provides a robot main direction detection method, including steps S100-S400:
[0053] S100. After receiving the setting instruction for the current detection mode, preprocess the imported initial point cloud data to obtain candidate point cloud data.
[0054] See also, as an example Figure 2 The implementation process of the robot main orientation detection method (i.e., the improved RANSAC algorithm) is as follows:
[0055] This robot main direction detection method is applied to intelligent mobile instruments (such as robotic vacuum cleaners). When using the intelligent mobile instrument, the user can pre-set the parameters for straight line detection according to the selected detection mode. Specifically, for different detection modes, the user can set corresponding preset thresholds for the number of interior points, preset residual thresholds (similar to preset distance thresholds; the preset residual threshold is a preset threshold for determining whether the target point cloud is an interior point on the currently fitted straight 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. 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.
[0056] Therefore, considering the accuracy of line fitting and subsequent computational load, the preset distance threshold and preset internal point count threshold can be set smaller when detecting the robot's main direction in a local area, while the preset distance threshold and preset internal point count threshold can be set larger when detecting the robot's main direction in the whole map. The initial number of iterations can be set to a slightly larger value, and subsequent calculations will automatically adjust.
[0057] The detection modes include: local robot main direction detection, full-map robot main direction detection, long corridor detection, skirting board detection, narrow straight passage detection, and straight wall scene detection.
[0058] First, the user selects a detection mode (i.e., the current detection mode) based on the usage scenario. Then, the system receives the setting instruction for the current detection mode and proceeds to data processing before line detection:
[0059] The system receives the imported initial point cloud data and preprocesses it, including cleaning the data, handling missing values, standardizing or scaling features, encoding categorical variables, and reducing dimensionality. In this embodiment, equal-interval sampling is used to remove noise, thereby ensuring high-quality data, accelerating the learning process and model reliability, and reducing the computational load of subsequent fitting and detection, ultimately obtaining 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 the current fitted line. The validity of the current fitted line is detected based on the corresponding preset threshold under the current detection mode, and the current fitted line with a valid detection result is recorded as the valid fitted line.
[0061] Different preset thresholds are set for different detection modes, including: preset distance threshold, preset number of inner points threshold, and preset angle threshold.
[0062] As an example, after preprocessing the initial point cloud data to obtain candidate point cloud data, the process begins with cyclic detection to effectively fit straight lines to the candidate point cloud data:
[0063] For example, each time two candidate point cloud data are randomly selected for line fitting, the current fitted line is obtained after the current fitting detection is completed, and the validity of the current fitted line is detected based on the corresponding preset threshold (here referring to the preset number of points threshold) in the current detection mode. That is, the validity of the current fitted line is determined according to the preset number of points threshold in the preset threshold. The current fitted line with the valid detection result is recorded as the valid fitted line, thereby effectively improving the efficiency and accuracy of calculating the fitted line.
[0064] For example, in one implementation, please refer to Figure 3 Step S200: Each time a straight line is fitted to the candidate point cloud data to obtain the current fitted straight line, the validity of the previously fitted straight line is detected based on the corresponding preset threshold under the current detection mode, including:
[0065] S210. Select at least two point clouds from the candidate point cloud data and perform line fitting to obtain the current fitted line;
[0066] S220. Calculate the vertical distances of the remaining candidate point clouds in the candidate point cloud data to the current fitted line, and count the number of point clouds whose vertical distances to the current fitted line are not greater than a preset distance threshold, to obtain the target point cloud number.
[0067] S230. When the number of target point clouds is not less than the preset threshold for the number of internal points, the current fitted line is recorded as a valid fitted line.
[0068] In this embodiment, "selection" means random selection, so either of the at least two target point clouds that have already been selected can be selected again for further fitting processing.
[0069] As an example, after obtaining the candidate point cloud data, the iterative process of line detection begins:
[0070] First, select at least two target point clouds from the candidate point cloud data and perform a line fitting using the least squares method to obtain the current fitted line and its line parameters. The line parameters include the y-component, x-component, and line constant term of the line direction vector. The angle of the line, i.e. the slope of the line, can be calculated from this.
[0071] Then, based on the line parameters, the vertical distances from the remaining candidate point clouds in the candidate point cloud data to the currently fitted line are calculated, i.e., the vertical distances from the remaining candidate point clouds to the currently fitted line. These vertical distances are then compared with a preset residual threshold (i.e., a preset distance threshold) in the current detection mode to count the number of interior points of the currently fitted line, thus obtaining the target point cloud count. Those remaining candidate point clouds whose vertical distances to the currently fitted line are not greater than the preset distance threshold are called interior points.
[0072] Finally, the number of interior points is compared with the preset interior point threshold in the current detection mode to determine whether the currently fitted line is valid (corresponding to...). Figure 2 The method determines whether the number of inliers meets the requirements for fitting a straight line. Specifically, it determines whether the number of target point clouds for the current fitted line is not less than a preset threshold for the number of inliers. If the number of target point clouds is not less than the preset threshold for the number of inliers, the current fitted line is retained as a valid fitted line, thereby achieving efficient and accurate line fitting operation.
[0073] For example, in another implementation, another instance of this application is that at least two target point clouds that are selected each time cannot be selected again.
[0074] For example, in one implementation, the validity of the current fitted line is detected based on a corresponding preset threshold under the current detection mode, and then the method further includes:
[0075] If the current fitted line is invalid, continue to select at least two point clouds from the remaining candidate point clouds to perform line fitting until the preset fitting conditions are met or a valid fitted line is obtained.
[0076] As an example, when determining whether the target point cloud number is not less than a preset threshold number of points:
[0077] If the number of target point clouds is less than a preset threshold for the number of points within the target cloud, the current fitted line with a target point cloud number less than the preset threshold for the number of points within the target cloud is determined as an invalid fitted line. The iteration count is then incremented by one, and at least two target point clouds are randomly selected from the candidate point cloud data to perform the valid fitted line detection step. Then, when the current fitted line is invalid, the valid fitted line detection step is repeated until the preset number of fittings is reached or a valid fitted line is obtained.
[0078] Please continue reading. Figure 1 S300. After obtaining at least one effective fitted line, determine the number of target point clouds whose distance from the current effective fitted line is less than a preset distance threshold each time, and dynamically update the old line sorting table obtained from the previous line fitting based on the number of target point clouds, until the preset fitting condition is met, and obtain the latest line sorting table.
[0079] For example, during the iterative process of line detection, if the old line sorting table contains at least one valid fitted line, and the current valid fitted line is obtained by detecting the current fitted line, the old line sorting table obtained from the previous line fitting can be dynamically updated based on the target point cloud number of the current valid fitted line and the preset angle threshold corresponding to the preset detection mode. That is, based on the preset angle threshold and the target point cloud number of the current valid fitted line, the target valid fitted line in the old line sorting table is replaced and sorted together with the remaining valid fitted lines in the old line sorting table, or directly sorted together with the valid fitted lines in the old line sorting table.
[0080] Then, after each update in the iteration process, it is determined whether the condition for ending the iteration has been met, that is, whether the number of line fitting operations has reached the preset number of fittings (i.e. the preset fitting condition). When the preset number of fittings is reached, the operation of valid fitted line detection is stopped, the latest line sorting table is obtained, and the iteration process is exited.
[0081] For example, in one implementation, the preset fitting condition is a preset number of fittings, and the preset number of fittings is obtained by:
[0082] After calculating the probability of not being able to obtain the target point cloud based on the number of target point clouds and the total number of candidate point clouds currently validly fitted lines, the preset number of fitting attempts is calculated based on the probability of not being able to obtain the target point cloud.
[0083] As an example, the preset number of fits is obtained in the following way:
[0084] After obtaining the effective fitted line containing the most target point clouds, the probability of not obtaining the target point cloud is calculated based on the target point cloud number and the total number of candidate point clouds of the current effective fitted line: we can first sample K point clouds at the beginning of the iteration, assuming the target point cloud number is n and the total number of point clouds is m. Then, the probability that any point cloud is an interior point is p = n / m (1).
[0085] Then, the preset number of fitting iterations is calculated based on the probability of not obtaining the target point cloud number: first, the probability of not obtaining an interior point is calculated as e = 1 - p (2); then the probability that any K points are interior points is p. K (3); Similarly, at least one of the K points is an outside point, meaning the probability of sampling failure is 1-p. K (4), then the probability of failing all M sampling attempts is (1-p) K ) M (5) Then the probability of success in at least one of the M samplings is z = 1 - (1 - p) K ) M (6) From this, the minimum number of iterations required (preset fitting number) N = log(1-z) / log(1-p) can be calculated.K (7).
[0086] Secondly, replace the initial iteration count with a preset number of fitting iterations, and in each subsequent effective fitting line detection, determine whether the number of line fitting iterations is not less than the preset number of fitting iterations (N = log(1-z) / log(1-p)). K And when the number of line fitting attempts is not less than the preset number of fitting attempts, the operation of valid line fitting detection is stopped to exit the iteration process.
[0087] Furthermore, please refer to Figure 4 The old straight line sorting table obtained from the previous straight line fitting is dynamically updated based on the target point cloud number, including:
[0088] S305. Compare the number of target point clouds corresponding to the current effective fitted line with the number of the first target point clouds of the first effective fitted line in the old line sorting table, and keep the effective fitted line with the most target point clouds in the line sorting table.
[0089] S306. Sort all valid fitted lines in the line sorting table according to their respective target point cloud numbers to obtain an updated line sorting table. The updated line sorting table is used as the old line sorting table for the next line fitting.
[0090] As an example, when there is only the first valid fitted line in the old line sorting table, and the current valid fitted line is obtained by performing line fitting on the current fitted line, the following two scenarios may exist:
[0091] In the first scenario, if the first effective fitted line is exactly the first effective fitted line (the same effective fitted line as the target, and the effective fitted line whose angle deviation from the current effective fitted line is within a preset angle threshold (e.g., 1°-2°)), then the number of target point clouds corresponding to the current effective fitted line is compared with the number of target point clouds of the first effective fitted line, and the effective fitted line with the most target point clouds is retained in the line sorting table.
[0092] For example, if the first effective fitted line (which is also the first effective fitted line in the first scenario) is A, and the current effective fitted line is B, and the angle deviation between A and B is within the preset angle threshold, then the number of interior points of A and B is directly compared, and the effective fitted line with the most target point cloud numbers is retained.
[0093] Then, all valid fitted lines in the line sorting table are sorted according to their respective target point cloud counts. At this point, only the valid fitted line with the largest target point cloud count is available, so no sorting is required, and an updated line sorting table is obtained. After that, the updated line sorting table is used as the old line sorting table for the next line fitting.
[0094] In the second scenario, if the first effective fitted line is not the first effective fitted line, then the first effective fitted line and the current effective fitted line are sorted directly according to their respective target point cloud numbers to obtain an updated line sorting table. Similarly, the updated line sorting table is used as the old line sorting table for the next line fitting.
[0095] However, if there are at least two valid fitted lines in the old line sorting table, and the current fitted line is fitted with a line to obtain the current valid fitted line, and if there is a first valid fitted line in the old line sorting table, then similarly, the current valid fitted line is compared with the first valid fitted line according to their respective target point cloud numbers, and the valid fitted line with the most target point cloud numbers is retained in the sorting position of the first valid fitted line in the line sorting table.
[0096] Then, all valid fitted lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table. After that, 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 valid fitted lines C and D in the old line sorting table, and the current valid fitted line is B, and the angle deviation between B and C is within the preset angle threshold, the number of interior points of B and C is compared, and the valid fitted line with the most target point cloud numbers is retained. Assuming that B is retained, the updated line sorting table will be sorted as B and D.
[0098] Furthermore, in another embodiment of this application, several valid fitted lines with angle deviations outside a preset angle threshold may be sorted first. Then, in the line sorting table, only the order of the valid fitted line with the larger number of target point clouds among the several valid fitted lines with angle deviations within the preset angle threshold is retained.
[0099] In one implementation, please refer to Figure 5 The number of target point clouds corresponding to the current effective fitted line is compared with the number of target point clouds of the first effective fitted line in the old line sorting table. This process also includes:
[0100] S301. Calculate the deviation between the initial parameters of the current effective fitted line and each effective fitted line in the old line sorting table to obtain the included angle, and determine whether the included angle is within the preset angle threshold.
[0101] S302. The effective fitted line whose included angle is within the preset angle threshold is taken as the first effective fitted line.
[0102] As an example, when there is at least one valid fitted line in the old line sorting table, the deviation between the initial parameters corresponding to the current valid fitted line and each valid fitted line in the old line sorting table is calculated to obtain the included angle, and it is determined whether the included angle is within a preset angle threshold:
[0103] If the angle is within the preset angle range, it means that the two effective fitted lines can be fitted into one line. Then, the effective fitted line with the included angle within the preset angle threshold is taken as the first effective fitted line, so that the number of target point clouds between the current effective fitted line and the first effective fitted line can be compared.
[0104] However, if the current valid fitted line is not within the preset angle range, it is added to the old line sorting table, and all valid fitted lines in the old line sorting table are sorted to obtain the updated line sorting table.
[0105] Please continue reading. Figure 1 S400, perform line fitting again on the effective fitted line with the most target point cloud in the latest line sorting table to obtain the best fitted line, and control the robot to perform robot main direction detection based on the best fitted line.
[0106] As an example, after obtaining the latest line sorting table, line fitting is performed on all interior points of the effective fitted line containing the most target point cloud in the latest line sorting table to obtain the best fitted line (in detection modes such as narrow straight channel detection and straight wall scene detection, line fitting is performed on the interior points of the first few effective fitted lines that are ranked higher in terms of target point cloud and are not parallel or perpendicular to other lines to obtain the corresponding number of better fitted lines), so as to perform robot main direction detection based on the best fitted line.
[0107] In other embodiments of this application, after obtaining the best-fitting straight line, the main direction angle can be calculated based on the best-fitting straight line (applicable to local robot main direction detection and full-image main direction detection modes), or scene judgment can be performed to obtain scene judgment results (applicable to narrow straight channel detection, long corridor detection, skirting board detection and straight wall scene detection modes).
[0108] One method for scene determination is to check whether the point cloud data contains a specific straight line representing the scene. For example:
[0109] For long corridor detection, the top few effective fitted lines ranked by target point cloud number can be further analyzed. Then, the relative position of the line and the machine can be determined to determine whether the machine is in the long corridor. For baseboard detection, it is necessary to determine whether there is a sufficiently long line close to the machine among the top few effective fitted lines to determine the baseboard scene. Alternatively, in narrow straight passage scenes, there must be at least one long line on each side of the machine, and in straight wall scenes, there must be at least one long line near the machine.
[0110] It is understandable that this application can detect not only the main direction of a local area, but also the main direction of the entire map, preventing map distortion when the main directions of the local environment differ significantly from the overall environment. Simultaneously, it also has the function of detecting the environment, identifying whether the robot vacuum is in a narrow, straight passage or against a straight wall, facilitating more precise control of the robot vacuum.
[0111] For example, in one implementation, step S400 involves refitting the effective fitted line containing the most target point cloud data in the latest line sorting table to obtain the best fitted line, and controlling the robot to perform robot main direction detection based on the best fitted line, including:
[0112] S410. Select the second effective fitted line with the most target point clouds from the latest line sorting table, perform line fitting on all target point clouds corresponding to the second effective fitted line to obtain the best fitted line, and calculate the angle of the main direction based on the best fitted line.
[0113] For example, after obtaining the latest line sorting table, the second effective fitted line containing the most target point clouds is selected from the latest line sorting table. All target point clouds in the second effective fitted line containing the most target point clouds are then fitted again using the least squares method to obtain fitted line parameters that are closer to the real environment, thus obtaining the best fitted line. The angle of the best principal direction can then be calculated based on the best fitted line.
[0114] However, if the number of line fitting attempts is less than the preset number of attempts, the operation of detecting valid fitted lines will continue.
[0115] Further, please refer to Figure 6 This 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 fitted line, and to perform validity detection on the current fitted line based on the corresponding preset threshold in the current detection mode, and to record the current fitted line with the valid detection result as the valid fitted line.
[0117] The dynamic update module 3 is used to determine the number of target point clouds whose distance from the current effective fitted line is less than a preset distance threshold after obtaining at least one effective fitted line, and to dynamically update the old line sorting table obtained from the previous line fitting based on the number of target point clouds, until the preset fitting conditions are met and the latest line sorting table is obtained; the second fitting module 4 is used to perform line fitting again on the effective fitted line with the most target point clouds in the latest line sorting table to obtain the best fitted line, and to control the robot to perform robot main direction detection based on the best fitted line.
[0118] As an example, the robot main orientation detection method is applied to a robot main orientation detection system. The implementation process of the robot main orientation detection system is as follows:
[0119] First, after selecting a detection mode based on the usage scenario, the user performs data processing: receiving the imported initial point cloud data and performing preprocessing on the initial point cloud data with equal interval sampling.
[0120] Then, the iterative process of detecting the effective fitted line begins:
[0121] Each time, at least two target point clouds in the candidate point cloud data are randomly selected and a straight line is fitted using the least squares method to obtain the current fitted line and its line parameters; and the vertical distances of the remaining candidate point clouds in the candidate point cloud data from the current fitted line are calculated based on the line parameters.
[0122] Next, the vertical distance is compared with a preset residual threshold (i.e., a preset distance threshold) in the current detection mode to count the number of target point clouds whose vertical distance is less than the preset residual threshold (points with a vertical distance less than the preset residual threshold are called inliers, i.e., target point clouds). Then, the number of target point clouds is compared with a preset inlier count threshold in the current detection mode to determine the validity of the currently fitted line: if the number of target point clouds is not less than the preset inlier count threshold, the currently fitted line is valid and retained as a valid fitted line; otherwise, it is invalid.
[0123] Next, after obtaining at least one effective fitted line in the old line sorting table, the number of target point clouds in the candidate point cloud data whose distance from the current effective fitted line is less than a preset distance threshold is counted. The old line sorting table is then dynamically updated based on the number of target point clouds. That is, the current effective fitted lines can be compared and sorted based on the number of target point clouds of the current effective fitted lines and the preset angle threshold. This will replace several effective fitted lines within the preset angle threshold and sort several effective fitted lines outside the preset angle threshold.
[0124] Furthermore, after the current line fitting operation is completed, the same number of target point clouds are randomly selected from the candidate point cloud data, and the above effective line fitting detection steps are repeated. Then, the line fitting iterative process is repeated until the number of line fittings reaches the preset fitting condition, and the latest line sorting table is obtained so that the effective line fitting with the most target point clouds can be selected (while narrow straight channel detection and straight wall scene detection will select the top few lines with more target point clouds).
[0125] Finally, the number of model iterations is calculated based on the probability of not being able to find an interior point. After pre-calculating the preset number of fittings, it is determined whether the number of line fittings in the line fitting operation has reached the preset number of fittings. If it has, the operation of valid fitted line detection is stopped, and then line fitting is performed on all interior points of the valid fitted line containing the most target point cloud to obtain the best fitted line (for narrow straight channel detection and straight wall scene detection, line fitting is performed on the interior points of the first few valid fitted lines with the most target point cloud to obtain several better fitted lines), so that the sweeping robot can drive according to the best fitted line.
[0126] Furthermore, this application also provides an intelligent mobile instrument, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the intelligent mobile instrument to perform the functions of the various modules in the above-described robot main direction detection method or robot main direction detection system.
[0127] The intelligent mobile instrument can be an intelligent robotic vacuum cleaner; the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0128] Memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). Memory stores computer programs, and the processor, upon receiving execution instructions, can execute the computer programs accordingly.
[0129] This application also provides a computer-readable storage medium for storing computer programs used in the aforementioned intelligent mobile device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0130] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0131] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0132] If a function is implemented as a software 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 this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application.
[0133] In summary, the present invention provides a robot main direction detection method, system, intelligent mobile instrument, and storage medium. The method includes: after receiving a setting instruction for the current detection mode, preprocessing the imported initial point cloud data to obtain candidate point cloud data; performing line fitting on the candidate point cloud data each time to obtain a current fitted line; performing validity detection on the current fitted line based on a corresponding preset threshold under the current detection mode, and recording the current fitted line with a valid detection result as a valid fitted line; after obtaining at least one valid fitted line, determining the number of target point clouds whose distance from the current valid fitted line is less than a preset distance threshold each time, and dynamically updating the old line sorting table obtained from the previous line fitting according to the number of target point clouds, until a preset fitting condition is met to obtain a latest line sorting table; performing line fitting again on the valid fitted line containing the most target point clouds in the latest line sorting table to obtain the best fitted line, and controlling the robot to perform robot main direction detection based on the best fitted line.
[0134] By performing multiple effective fitted line detections on candidate point cloud data, several effective fitted lines are obtained. Each time, the old line sorting table is dynamically updated based on the preset angle threshold and the number of target point clouds for each of the current effective fitted lines. When the number of line fittings reaches the preset number of fittings, all interior points of the effective fitted line with the most target point clouds in the latest line sorting table are fitted with lines to obtain the best fitted line for robot main direction detection or usage scenario detection. This improves the effect and accuracy of route recognition, reduces the amount of computation, and improves computational efficiency.
[0135] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for detecting the main orientation of a robot, characterized in that, include: After receiving the setting instruction for the current detection mode, the imported initial point cloud data is preprocessed to obtain candidate point cloud data; Each time a straight line is fitted to the candidate point cloud data, the current fitted line is obtained. The validity of the current fitted line is detected based on the corresponding preset threshold under the current detection mode, and the current fitted line with a valid detection result is recorded as a valid fitted line. After obtaining at least one effective fitted line, the number of target point clouds that are less than a preset distance threshold with respect to the current effective fitted line is determined each time, and the old line sorting table obtained from the previous line fitting is dynamically updated according to the number of target point clouds until the preset fitting condition is met, and the latest line sorting table is obtained. The effective fitted line with the most target point cloud in the latest line sorting table is fitted again to obtain the best fitted line, and the robot is controlled to perform main direction detection based on the best fitted line.
2. The main direction detection method according to claim 1, characterized in that, The step of dynamically updating the old straight line sorting table obtained from the previous straight line fitting based on the target point cloud number includes: Compare the number of target point clouds corresponding to the current effective fitted line with the number of the first target point clouds of the first effective fitted line in the old line sorting table, and retain the effective fitted line with the most target point clouds in the line sorting table. All valid fitted lines in the line sorting table are sorted according to their respective target point cloud numbers to obtain an updated line sorting table, which serves 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 process of refitting the effective fitted line containing the most target point cloud data in the latest line sorting table to obtain the best fitted line, and controlling the robot to perform main direction detection based on the best fitted line, includes: The second effective fitted line with the most target point clouds is selected from the latest line sorting table. All target point clouds corresponding to the second effective fitted line are fitted with lines to obtain the best fitted line. The angle of the main direction is calculated based on the best fitted line.
4. The main direction detection method according to claim 1, characterized in that, Different preset thresholds are set for different detection modes, including a preset distance threshold and a preset intrapoint count threshold. Each time a straight line is fitted to the candidate point cloud data to obtain the current fitted line, the validity of the current fitted line is checked based on the corresponding preset threshold under the current detection mode, including: At least two point clouds from the candidate point cloud data are randomly selected for line fitting to obtain the current fitted line; Calculate the vertical distances of the remaining candidate point clouds in the candidate point cloud data to the current fitted line, and count the number of point clouds whose vertical distances to the current fitted line are not greater than the preset distance threshold to obtain the target point cloud number; When the number of target point clouds is not less than the preset threshold number of internal points, the current fitted line is recorded as the effective fitted line.
5. The main direction detection method according to claim 2, characterized in that, The preset threshold includes: a preset angle threshold; Before comparing the number of target point clouds corresponding to the currently effective fitted line with the number of target point clouds of the first effective fitted line in the old line sorting table, the process also includes: The deviation between the current effective fitted line and the initial parameters corresponding to any one of the effective fitted lines in the old line sorting table is calculated to obtain the included angle, and it is determined whether the included angle is within the preset angle threshold. The effective fitted line whose included angle is within the preset angle threshold is taken as the first effective fitted line.
6. The main direction detection method according to claim 2, characterized in that, The preset fitting condition is a preset number of fitting iterations, which is obtained by: After calculating the probability of not being able to obtain the target point cloud based on the number of target point clouds and the total number of candidate point clouds of the currently effective fitted line, the preset number of fitting attempts is calculated based on 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 process of performing validity detection on the current fitted line based on a corresponding preset threshold under the current detection mode further includes: If the current fitted line is invalid, then at least two point clouds from the remaining candidate point clouds will be randomly selected for line fitting until the preset fitting condition is met or the valid fitted line is obtained.
8. A main direction detection system, characterized in that, include: The preprocessing module is used to preprocess the imported initial point cloud data after receiving the setting instruction for the current detection mode to obtain candidate point cloud data. The first fitting module is used to perform straight line fitting on the candidate point cloud data each time to obtain the current fitted line, perform validity detection on the current fitted line based on the corresponding preset threshold in the current detection mode, and record the current fitted line with a valid detection result as a valid fitted line. The dynamic update module is used to determine the number of target point clouds that are less than a preset distance threshold from the current effective fitted line each time after obtaining at least one of the effective fitted lines, and to dynamically update the old line sorting table obtained from the previous line fitting based on the number of target point clouds, until the preset fitting condition is met and the latest line sorting table is obtained. The second fitting module is used to perform line fitting again on the effective fitted line with the most target point cloud in the latest line sorting table to obtain the best fitted line, and control the robot to perform main direction detection based on the best fitted line.
9. An intelligent mobile instrument, characterized in that, include: A memory and a processor; wherein the memory stores a computer program, which, when executed by the processor, implements the steps of the main direction detection method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The system contains a computer program that, when executed by a processor, implements the steps of the main direction detection method as described in any one of claims 1-7.
Citation Information
Patent Citations
Method for optimizing fitting straight line based on laser point cloud data, chip and robot
CN115113230A
Optimized RANSAC point cloud plane fitting method based on DBSCAN clustering
CN118312880A