Visual servo motion planning method of forest maintenance robot spraying device
Through multi-line lidar and clustering algorithm, tree point cloud data is processed, combined with principal component analysis and weighted center algorithm, the precise extraction of the trunk skeleton is achieved, solving the problems of sparse data and noise interference in single scans, and providing more accurate Tree structure information and efficient spray paths.
Patent Information
- Application Number
- CN202410997715.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-07-24
AI Technical Summary
The prior art has insufficient accuracy in retrieving structure information when processing single-scan tree point cloud data, and there are problems of sparse data and noise interference, making it difficult to achieve accurate tree structure information extraction.
Multi-line lidar is used to obtain point cloud data, and trunk point clouds are obtained through height threshold filtering and spatial clustering algorithm, vertical segmentation and kernel density estimation are performed. Combined with principal component analysis and weighted center algorithm, iterative correction is obtained to obtain the trunk skeleton and perform The spatial Bezier curve smoothing process is used to generate the motion trajectory of the spraying device.
It effectively improves the accuracy of tree trunk skeleton reconstruction, provides more accurate tree structure information, adapts to different tree species and environmental conditions, improves the rationality and efficiency of spray paths, and reduces the risk of spraying agent waste and pollution.
Smart Images

Figure CN118876060A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot control technology, and in particular to a visual servo motion planning method for a spraying device of a forest maintenance robot. Background Art
[0002] In recent years, with the continuous improvement of robotics and automation requirements, more and more outdoor robots are working in unstructured wild environments, and the refined perception and modeling of outdoor scenes has become a research hotspot. Among them, trees are common natural objects, and the accurate acquisition of their structural information is crucial for applications such as robot tree painting, fruit picking, and tree health monitoring. LiDAR is widely used in digital modeling of outdoor scenes due to its high-precision and high-efficiency three-dimensional information acquisition capabilities.
[0003] In the process of using LiDAR to scan outdoor scenes to build an overall map, it is usually impossible to scan each object multiple times due to time costs, data storage and application goals, especially objects with complex shapes and uneven branches such as trees. In most cases, unless a specific tree is scanned, each tree usually only appears in one scan data, and the acquired point cloud data is usually sparse, which makes it difficult for traditional grid construction methods based on dense point clouds to effectively restore tree structure information. In addition, due to factors such as occlusion by branches and leaves and changes in lighting, there are often a lot of noise and outliers in the point cloud data of a single scan, which further aggravates the difficulty of extracting tree structure information. However, in application scenarios such as robotic tree painting, accurate tree structure information is crucial. Missing or inaccurate structural information will lead to a decrease in the painting effect and may even cause damage to the painting device.
[0004] Therefore, how to efficiently and robustly extract accurate tree structure information from sparse, noisy single-scan point cloud data has become a key problem to be solved in the field of robot-environment interaction. Therefore, in view of the problem of insufficient accuracy of structural information restoration in the prior art when processing single-scan tree point cloud data, the present invention proposes a visual servo motion planning method for a spraying device of a forest maintenance robot. Summary of the invention
[0005] The purpose of the present invention is to provide a visual servo motion planning method for a forest maintenance robot spraying device, which overcomes the shortcomings of single-scan point cloud data, effectively solves challenges such as data sparsity and noise interference, realizes accurate extraction of tree skeletons, and provides more accurate and reliable structural information for applications such as robot tree painting.
[0006] To achieve the above object, the present invention provides a visual servo motion planning method for a spraying device of a forest maintenance robot, comprising the following steps:
[0007] S1. Use multi-line laser radar to obtain the point cloud of the tree to be painted, and obtain the point cloud of the tree trunk to be painted through height threshold filtering and spatial clustering algorithm;
[0008] S2, segmenting the point cloud of the tree trunk to be painted obtained in step S1 in the vertical direction to obtain point cloud blocks, and performing kernel density estimation, point cloud weight calculation, and data centralization on the overall point cloud and the point cloud blocks respectively; obtaining the first eigenvectors of the overall point cloud of the tree trunk and each point cloud block based on the principal component analysis method and using them as the principal components;
[0009] S3, using the weighted center algorithm to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node;
[0010] S4, using the principal components of the point cloud blocks obtained in step S2, the principal components of the overall point cloud are corrected by the proportional coefficient, and then iteratively corrected, and the root nodes obtained in step S3 are continuously accumulated to obtain the center points of each point cloud block, and the center points are sequentially connected to obtain the trunk skeleton;
[0011] S5. Perform spatial Bezier curve smoothing processing on the tree trunk skeleton obtained in step S4 to obtain a motion trajectory of the spraying device.
[0012] Preferably, in step S1, the Robosense-lidar-16 laser radar is used to scan and obtain the original point cloud data, as shown below:
[0013] P = {p i ∣p i =(x i ,y i ,z i ),i=1,2,...,N}
[0014] Among them, P represents the point cloud, P i represents the i-th point in the point cloud, (x i ,y i ,z i ) represents the three-dimensional coordinates of the i-th point, and N represents the total number of points in the point cloud.
[0015] Preferably, in step S1, a height threshold filtering method is used to perform denoising on the point cloud, the height threshold is set to 1.2 m, all points with Z coordinate values greater than 1.2 m in the point cloud data are removed, and points with Z coordinate values less than or equal to 1.2 m are retained;
[0016] S121. Define a point cloud P′ containing only points that meet the height condition, as shown below:
[0017] P′={p i ∣p i =(xi ,y i ,z i ),z i ≤1.2,i=1,2,...,N}
[0018] Among them, P′ represents the point cloud after height threshold filtering, p i represents the i-th point in the original point cloud P; (x i ,y i ,z i ) represents the three-dimensional coordinates of the i-th point, z i ≤1.2 indicates point p i The height shall not exceed 1.2m;
[0019] S122, define a screening condition function χ(z i ), the function is in z i 1 if ≤1.2, 0 otherwise:
[0020]
[0021] S123, the screening function χ(z i ) as the screening condition of point cloud P′, the screened point cloud P′ is as follows:
[0022] P′={p i ∣p i =(x i ,y i ,z i ),χ(z i )=1}
[0023] Then the matrix form of the point cloud P′ is as follows:
[0024]
[0025] Among them, N′ is the i ≤1.2; therefore, the point cloud matrix P′ after filtering with a height threshold of 1.2m is obtained.
[0026] Preferably, in step S1, a density-based spatial clustering algorithm is used to process the filtered point cloud P′, and the specific process is as follows:
[0027] S131. For any point p in the point cloud, its ∈ neighborhood N ∈ (p) is defined as p i All points contained in the spherical space with centered and radius ∈, that is:
[0028] N ∈ (p) = {q∈R 3|dist(p,q)<∈}
[0029] Where dist(p,q) is the Euclidean distance between points p and q;
[0030] S132. If the ∈ neighborhood of a point contains at least MinPts points, the point is defined as a core point, as shown below:
[0031] |N ∈ (p i )|≥MinPts
[0032] Among them, |N ∈ (p i )| represents the number of elements in the set; if point q is in the ∈ neighborhood of point p, and p is a core point, then q is considered to be directly density-reachable, that is:
[0033] q∈N ∈ (p)
[0034] If there exists a series of points p 1 ,p 2 ,...,p n So that p i+1 For every i that is directly density-reachable, then point p n Considered to be from p 1 density accessible;
[0035] S133, global point cloud P after clustering algorithm processing G Contains points with empty background data removed, as shown below:
[0036]
[0037] Where M is the number of points retained after clustering; the point cloud data P after height threshold filtering and spatial clustering G , which is the point cloud with the empty background data removed.
[0038] Preferably, in step S2, the point cloud of the tree trunk to be painted obtained in step S1 is segmented in the vertical direction to obtain point cloud blocks, and kernel density estimation and point cloud weight calculation are performed on the overall point cloud and the point cloud blocks respectively. The specific process is as follows:
[0039] S21, the global point cloud P G Slice the point cloud at equal intervals along the z-axis direction and divide it into 10 non-interfering point cloud blocks with a height of 12 cm. Define the height threshold h i (i=1,2,...,10), as shown below:
[0040] h i =0.12(i-1)
[0041] will satisfy h i ≤p z <h i+1 The point p∈P G Divide into point cloud block B i , where p z represents the z coordinate value of point p, then the global point cloud P G It is divided into 10 point cloud blocks as shown below:
[0042]
[0043] Among them, B i Represents the i-th point cloud block; each point cloud block B i Contains the z coordinate value of the global point cloud in the area [h i ,h i+1 ) all points within;
[0044] S22. For each point cloud block B i Kernel density estimation is performed for each point in the point cloud block B. i For any point x in , its density value is obtained by weighting the contribution of all points in the neighborhood. The weight function is determined by the kernel function K. The kernel density estimate at point x is as follows:
[0045]
[0046] in, is the estimated density at point x, n is the point cloud block B i The number of midpoints, d is the dimension of the point; h is the bandwidth parameter, which determines the width of the kernel; K is the kernel function, using a Gaussian kernel, as shown below:
[0047]
[0048] Then for every point x∈B i , its kernel density is estimated as:
[0049]
[0050] S23, assign an initial weight to each point according to the kernel density estimate, introduce an exponential decay factor to adjust the spatial distribution characteristics of the weight, and point x j The initial weight w(x j ), as follows:
[0051]
[0052] The weights are normalized as follows:
[0053]
[0054] Among them, w norm (x j ) represents point x j In this point cloud block B i The normalized weights in ;
[0055] Through the above weight calculation and normalization processing, each point is assigned a weight value between 0 and 1.
[0056] Preferably, in step S2, the point cloud data is centrally processed by principal component analysis to determine the main direction of the tree point cloud. The specific process is as follows:
[0057] S241, first, perform global point cloud centralization, and centralize the global point cloud data P G Perform centralized calculation, global point cloud P G Every point p i is represented as a three-dimensional coordinate (x i ,y i ,z i ), calculate the mean vector μ of the point cloud as follows:
[0058]
[0059] Where M is the point cloud P G The number of points in ;
[0060] S242, centralize the point cloud block, for each point cloud block B i The mean vector, i.e. the centroid c, is calculated as follows:
[0061]
[0062] Among them, n i It is point cloud block B i The number of points in b ij is the coordinate of the jth point;
[0063] S243, after calculating the centroid, the coordinate origin of the point cloud block is moved to the centroid, and the point cloud P after the centralization processing c , as shown below:
[0064] P c ={p i -μ|i=1,2,...,M}
[0065] Similarly, point cloud block B i Centralized data B i,c , as shown below:
[0066] B i,c = {bij -c|j=1,2,...,n i}.
[0067] Preferably, in step S2, the first eigenvectors of the whole point cloud of the trunk and each point cloud block are obtained based on the principal component analysis method and used as the principal component. The specific process is as follows:
[0068] S251. In order to analyze the features of the point cloud, it is necessary to construct the central matrix X of the point cloud data. c , each row of the matrix corresponds to a centralized point As shown below:
[0069]
[0070] Using point cloud P G The central matrix X c , calculate the point cloud covariance matrix C:
[0071]
[0072] The center matrix of the point cloud block is X i,c , as shown below:
[0073]
[0074] Where n represents the number of points in the point cloud block;
[0075] S252, Point Cloud P G The eigenvalues and eigenvectors of the covariance matrix C are obtained by the following characteristic equation:
[0076] Cv i =λ i v i
[0077] Among them, λ i represents the i-th eigenvalue of the covariance matrix C, v i Representation and eigenvalue λ i The corresponding eigenvector;
[0078] Similarly, the covariance matrix of the point cloud block is obtained by the following characteristic equation:
[0079] C i u i =μ i u i
[0080] Among them, μ i Denotes the covariance matrix C i The i-th eigenvalue of i Represents the eigenvalue μ iThe corresponding eigenvector;
[0081] S253. Select the eigenvector corresponding to the largest eigenvalue in the covariance matrix as the principal component, that is, the main direction of the point cloud, as shown below:
[0082]
[0083]
[0084] Among them, v 1 is the global point cloud P G The first eigenvector, u i,1 It is point cloud block B i The first eigenvector of .
[0085] Preferably, in step S3, a weighted center algorithm is used to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node. The specific process is as follows:
[0086] S31. Select the weighted center point of the point cloud block with the lowest z coordinate in the global point cloud as the starting point, with a weight of w. norm (x j ), traverse the global point cloud P G , find the point p with the lowest z coordinate min , as shown below:
[0087]
[0088] Among them, z i It's point p i The z coordinate value of
[0089] S32. Determine p i The point cloud block it belongs to is denoted as B min , for B min Calculate the weighted center point to get the root node O root , as shown below:
[0090]
[0091] Among them, b min,j It is point cloud block B min The coordinates of the jth point in norm (b min,j ) is point b min,j The normalized weight of min It is point cloud block B min The number of points in .
[0092] Preferably, in step S4, the principal components of the point cloud blocks obtained in step S2 are used to correct the principal components of the overall point cloud by the proportional coefficient, and then iterative correction is performed, and the center points of each point cloud block are obtained by continuously accumulating the root nodes obtained in step S3, and the tree trunk skeleton is obtained by sequentially connecting them. The specific process is as follows:
[0093] S41, let the i-th point cloud block B i The amount of data is N i , global point cloud P G The amount of data is M, then the scale factor α of the i-th point cloud block i , as shown below:
[0094]
[0095] Use the scaling factor α i Iteratively correct the principal components of other point cloud blocks, that is, use the current point cloud block B in each iteration process i The first eigenvector u of i,1 Correct the overall point cloud P after the i-1th iteration G The first eigenvector v 1 ;
[0096] S42, let the overall eigenvector after the i-th iteration be At the i-th iteration, the correction formula of the overall eigenvector is as follows:
[0097]
[0098] S43, after each correction, update the starting point O i+1 , assuming the height of each point cloud block is 12cm, define the scaling factor as:
[0099]
[0100] The starting point update formula is as follows:
[0101]
[0102] S44, update the center point O of the point cloud block obtained by each iteration i+1 Add to the center point matrix O, as shown below:
[0103]
[0104] S45, iteratively calculate the center point until all point cloud blocks participate in the iteration process, and the iteration stops.
[0105] Preferably, in step S5, select O 1 ,O 2,...,O n-1 A total of m=n-1 points are used as control points of the Bezier curve. The formula of the Bezier curve is as follows:
[0106]
[0107] Among them, t is a parameter; B i,m (t) is the basis function of the i-th control point in the n-th Bezier curve, as shown below:
[0108]
[0109] Therefore, the present invention adopts the above-mentioned visual servo motion planning method for the spraying device of the forest maintenance robot, and the beneficial effects are as follows:
[0110] 1. To address the sparsity problem of single-scan point cloud data, the present invention innovatively combines kernel density estimation and principal component analysis, and adopts an iterative optimization strategy to effectively improve the accuracy of tree trunk skeleton reconstruction, and can more accurately restore the real structural information of trees, providing a reliable basis for subsequent spraying path planning.
[0111] 2. The method proposed in the present invention can adapt to different tree species, morphological differences and complex situations in the natural environment, such as branch and leaf occlusion, trunk bending, etc. It has strong robustness and generalization ability and can be extended to a wider range of forest scenes.
[0112] 3. Based on the precise tree trunk skeleton information, the spraying path generated by the present invention is more reasonable and efficient, which can reduce the waste of spraying agent, reduce the cost of spraying operation, and effectively avoid pollution to non-target areas while ensuring the spraying effect.
[0113] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0114] Figure 1 It is a flow chart of a visual servo motion planning method for a spraying device of a forest maintenance robot of the present invention;
[0115] Figure 2 It is a schematic diagram of the trunk skeleton extraction of the present invention;
[0116] Figure 3 It is a comparative schematic diagram of using weighted extraction of root nodes and unweighted extraction of root nodes for the tree trunk point cloud cluster of the present invention. DETAILED DESCRIPTION
[0117] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0118] like Figure 1As shown, the present invention provides a visual servo motion planning method for a spraying device of a forest maintenance robot, comprising the following steps:
[0119] S1. Use multi-line laser radar to obtain the point cloud of the tree to be painted, and obtain the point cloud of the tree trunk to be painted through height threshold filtering and spatial clustering algorithm;
[0120] S2, segmenting the point cloud of the tree trunk to be painted obtained in step S1 in the vertical direction to obtain point cloud blocks, and performing kernel density estimation, point cloud weight calculation, and data centralization on the overall point cloud and the point cloud blocks respectively; obtaining the first eigenvectors of the overall point cloud of the tree trunk and each point cloud block based on the principal component analysis method and using them as the principal components;
[0121] S3, using the weighted center algorithm to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node;
[0122] S4, using the principal components of the point cloud blocks obtained in step S2, the principal components of the overall point cloud are corrected by the proportional coefficient, and then iteratively corrected, and the root nodes obtained in step S3 are continuously accumulated to obtain the center points of each point cloud block, and the center points are sequentially connected to obtain the trunk skeleton;
[0123] S5. Perform spatial Bezier curve smoothing processing on the tree trunk skeleton obtained in step S4 to obtain a motion trajectory of the spraying device.
[0124] The present invention discloses a visual servo motion planning method for a spraying device of a forest maintenance robot. The structure of the movable spraying tree maintenance robot is as follows: the tree maintenance robot is equipped with a crawler mobile platform at the bottom, an embracing tree paint spraying device at the front, a depth camera at the top, and at least a laser radar.
[0125] Example
[0126] S1. Use multi-line laser radar to obtain the point cloud of the trees to be painted, and obtain the point cloud of the tree trunks to be painted through height threshold filtering and spatial clustering algorithm.
[0127] S11, use Robosense-lidar-16 laser radar to scan and obtain the original point cloud data, as shown below:
[0128] P = {p i ∣p i =(x i ,y i ,z i ),i=1,2,...,N}
[0129] Among them, P represents the point cloud, P i represents the i-th point in the point cloud, (x i ,y i,z i ) represents the three-dimensional coordinates of the i-th point, and N represents the total number of points in the point cloud.
[0130] S12. Based on the demand for robot painting trees, combined with the value of 1.2m for painting trees in China, the point cloud is pre-processed by 1.2m height threshold filtering, i.e. i ≤1.2, thereby reducing the number of point clouds that need to be involved in the calculation and improving the efficiency of the robot's tree painting operation.
[0131] The height threshold filtering method is used to denoise the point cloud. The robot tree painting operation is mainly concentrated in the 1.2m height range at the bottom of the trunk. The point cloud data with Z coordinate values greater than 1.2m mainly comes from non-target areas such as crowns, branches and leaves, which has no practical significance for the painting operation. Therefore, the height threshold is set to 1.2m, and all points with Z coordinate values greater than 1.2m in the point cloud data are removed, and points with Z coordinate values less than or equal to 1.2m are retained.
[0132] S121. Define a point cloud P′ containing only points that meet the height condition, as shown below:
[0133] P′={p i ∣p i =(x i ,y i ,z i ),z i ≤1.2,i=1,2,...,N}
[0134] Among them, P′ represents the point cloud after height threshold filtering, p i represents the i-th point in the original point cloud P; (x i ,y i ,z i ) represents the three-dimensional coordinates of the i-th point, z i ≤1.2 indicates point p i The height shall not exceed 1.2m.
[0135] S122, define a screening condition function χ(z i ), the function is in z i 1 if ≤1.2, 0 otherwise:
[0136]
[0137] S123, the screening function χ(z i ) as the screening condition of point cloud P′, the screened point cloud P′ is as follows:
[0138] P′={p i ∣p i =(xi ,y i ,z i ),χ(z i )=1}
[0139] Then the matrix form of the point cloud P′ is as follows:
[0140]
[0141] Among them, N′ is the i The number of points with a height threshold of ≤1.2 is obtained. In this way, the point cloud matrix P′ after filtering with a height threshold of 1.2m is obtained.
[0142] S13. In order to remove the empty background data scanned in the point cloud, a density-based spatial clustering algorithm (Density-based spatial clustering of applications with noise, DBSCAN) is used to process the filtered point cloud P′.
[0143] S131. For any point p in the point cloud, its ∈ neighborhood N ∈ (p) is defined as p i All points contained in the spherical space with centered and radius ∈, that is:
[0144] N ∈ (p) = {q∈R 3 |dist(p,q)<∈}
[0145] where dist(p,q) is the Euclidean distance between points p and q.
[0146] S132. If the ∈ neighborhood of a point contains at least MinPts points, the point is defined as a core point, as shown below:
[0147] |N ∈ (p i )|≥MinPts
[0148] Among them, |N ∈ (p i )| represents the number of elements in the set. If point q is in the ∈ neighborhood of point p, and p is a core point, then q is considered to be directly density-reachable, that is:
[0149] q∈N ∈ (p)
[0150] If there exists a series of points p 1 ,p 2 ,...,p n So that p i+1For every i that is directly density-reachable, then point p n Considered to be from p 1 Density attainable.
[0151] S133, Clustering: In the initialization state, all points are unvisited; then all points are traversed. If a point has not been visited, mark it as visited, calculate its ∈ neighborhood, and if the number of points contained in the neighborhood is not less than MinPts, start to expand a new cluster with this point as the core point. For each point in the neighborhood, if it has not been visited, mark it as visited, and if the neighborhood of the point contains at least MinPts points, add these points to the neighborhood of the current cluster (extend the cluster). Points that are not included in any cluster are marked as noise.
[0152] The global point cloud P after clustering algorithm processing G Contains points with empty background data removed, as shown below:
[0153]
[0154] Among them, M is the number of points retained after clustering. In this way, the point cloud data P after height threshold filtering and spatial clustering G It is the point cloud with the empty background data removed.
[0155] S2. Segment the point cloud of the tree trunk to be painted obtained in step S1 vertically to obtain point cloud blocks, and perform kernel density estimation, point cloud weight calculation, and data centralization on the overall point cloud and the point cloud blocks respectively; obtain the first eigenvectors of the overall point cloud of the trunk and each point cloud block based on the principal component analysis method and use them as the principal components.
[0156] S21. In order to facilitate segmentation analysis of the tree trunk point cloud, the global point cloud P G The image is sliced at equal intervals along the vertical direction (z axis) into 10 non-interfering point cloud blocks with a height of 12 cm. Specifically, the height threshold h is defined as i (i=1,2,...,10), as shown below:
[0157] h i =0.12(i-1)
[0158] will satisfy h i ≤p z <h i+1 The point p∈P G Divide into point cloud block B i , where p z represents the z coordinate value of point p. Thus, the global point cloud P G It is divided into 10 point cloud blocks as shown below:
[0159]
[0160] Among them, B i Represents the i-th point cloud block. Each point cloud block B i Contains the z coordinate value of the global point cloud in the area [h i ,h i+1 ) all points within .
[0161] S22, in order to describe the point density distribution inside each point cloud block, for each point cloud block B i For each point in the point cloud block B, Kernel Density Estimation (KDE) is performed. i For any point x in , its density value is obtained by weighting the contribution of all points in the neighborhood, and the weight function is determined by the kernel function K. Therefore, the kernel density estimate at point x is as follows:
[0162]
[0163] in, is the estimated density at point x, n is the point cloud block B i The number of midpoints, d is the dimension of the point (here 3); h is the bandwidth parameter, which determines the width of the kernel; K is the kernel function, using a Gaussian kernel, as shown below:
[0164]
[0165] Then for every point x∈B i , its kernel density is estimated as:
[0166]
[0167] Among them, the kernel density estimate of each point x is Can be used in subsequent weight adjustment operations.
[0168] S23. To reflect the impact of point cloud density distribution on subsequent processing, an initial weight is assigned to each point according to the kernel density estimate, and an exponential decay factor is introduced to adjust the spatial distribution characteristics of the weight. Specifically, point x j The initial weight w(x j ), as follows:
[0169]
[0170] Normalize the weights as follows:
[0171]
[0172] Among them, w norm (x j) represents point x j In this point cloud block B i The normalized weights in .
[0173] Through the above weight calculation and normalization, each point is assigned a weight value between 0 and 1, which reflects the relative importance of the point in the point cloud block to which it belongs. Points in high-density areas have lower weights, while points in low-density areas have higher weights, which helps to highlight the features of low-density areas in subsequent processing.
[0174] S24. In order to determine the main direction of the tree point cloud (i.e., the central axis direction of the trunk), the principal component analysis (PCA) method is used to centralize the point cloud data to eliminate the influence of the coordinate system selection on the main direction calculation.
[0175] S241, first, perform global point cloud centralization, and centralize the global point cloud data P G Perform centralized calculation, global point cloud P G Every point p i is represented as a three-dimensional coordinate (x i ,y i ,z i ), calculate the mean vector μ of the point cloud as follows:
[0176]
[0177] Where M is the point cloud P G The number of points in .
[0178] S242, centralize the point cloud block, for each point cloud block B i The mean vector (center of mass) c is calculated as follows:
[0179]
[0180] Among them, n i It is point cloud block B i The number of points in b ij are the coordinates of the jth point.
[0181] S243, after calculating the centroid, move the coordinate origin of the point cloud block to the centroid. c , as shown below:
[0182] P c ={p i -μ|i=1,2,...,M}
[0183] Similarly, point cloud block B iCentralized data B i,c , as shown below:
[0184] B i,c = {b ij -c|j=1,2,...,n i}
[0185] S25. Based on the principal component analysis method, the first eigenvectors of the overall point cloud of the trunk and each point cloud block are obtained and used as the principal components.
[0186] S251. In order to analyze the features of the point cloud, it is necessary to construct the central matrix X of the point cloud data. c , each row of the matrix corresponds to a centralized point As shown below:
[0187]
[0188] Using point cloud P G The central matrix X c , calculate the point cloud covariance matrix C:
[0189]
[0190] The center matrix of the point cloud block is X i,c , as shown below:
[0191]
[0192] Among them, n represents the number of points in the point cloud block.
[0193] S252, Point Cloud P G The eigenvalues and eigenvectors of the covariance matrix C are obtained by the following characteristic equation:
[0194] Cv i =λ i v i
[0195] Among them, λ i represents the i-th eigenvalue of the covariance matrix C, v i Representation and eigenvalue λ i The corresponding feature vector.
[0196] Similarly, the covariance matrix of the point cloud block is obtained by the following characteristic equation:
[0197] C i u i =μ i u i
[0198] Among them, μ i Denotes the covariance matrix Ci The i-th eigenvalue of i Represents the eigenvalue μ i The corresponding feature vector.
[0199] S253. Select the eigenvector corresponding to the largest eigenvalue in the covariance matrix as the principal component, that is, the main direction of the point cloud, as shown below:
[0200]
[0201] Among them, v 1 is the global point cloud P G The first eigenvector, u i,1 It is point cloud block B i The first eigenvector of .
[0202] Schematic diagram of tree trunk skeleton extraction, such as Figure 2 shown.
[0203] S3. Use the weighted center algorithm to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node.
[0204] S31. The first step in constructing the tree trunk skeleton is to determine the starting point of the skeleton. The weighted center point of the point cloud block with the lowest z coordinate in the global point cloud is selected as the starting point, with a weight of w. norm (x j ), traverse the global point cloud P G , find the point p with the lowest z coordinate min , as shown below:
[0205]
[0206] Among them, z i It's point p i The z-coordinate value of .
[0207] S32. Determine p i The point cloud block it belongs to is denoted as B min , for B min Calculate the weighted center point to get the root node O root , as shown below:
[0208]
[0209] Among them, b min,j It is point cloud block B min The coordinates of the jth point in norm (b min,j ) is point b min,j The normalized weight of min It is point cloud block B minThe number of points in the tree trunk point cloud cluster. The comparison diagram of using weighted extraction of root nodes and unweighted extraction of root nodes, as shown in Figure 3 shown.
[0210] S4. Using the principal components of the point cloud blocks obtained in step S2, the principal components of the overall point cloud are corrected by proportional coefficients, and then iterative correction is performed. The root nodes obtained in step S3 are continuously accumulated to obtain the center points of each point cloud block, which are then connected in sequence to obtain the trunk skeleton.
[0211] S41, let the i-th point cloud block B i The amount of data is N i , global point cloud P G The amount of data is M, then the scale factor α of the i-th point cloud block i , as shown below:
[0212]
[0213] Use the scaling factor α i Iteratively correct the principal components of other point cloud blocks, that is, use the current point cloud block B in each iteration process i The first eigenvector u of i,1 Correct the overall point cloud P after the i-1th iteration G The first eigenvector v 1 .
[0214] S42, let the overall eigenvector after the i-th iteration be At the i-th iteration, the correction formula of the overall eigenvector is as follows:
[0215]
[0216] S43. In order to ensure the height consistency between point cloud blocks, the starting point coordinates need to be updated after each correction. Considering that the height of each point cloud block is 12 cm, when updating the starting point, the z-axis component of the feature vector needs to be linearly transformed to correspond to the actual height of 12 cm. The scaling factor is defined as:
[0217]
[0218] Specifically, the starting point update formula is:
[0219]
[0220] S44, update the center point O of the point cloud block obtained by each iteration i+1 Add to the center point matrix O, as shown below:
[0221]
[0222] S45, iteratively calculate the center point until all point cloud blocks participate in the iteration process, and the iteration stops.
[0223] S5. Perform spatial Bezier curve smoothing processing on the tree trunk skeleton obtained in step S4 to obtain a motion trajectory of the spraying device.
[0224] In three-dimensional space, the trunk skeleton can be regarded as a combination of smooth spatial curves. The spatial Bezier curve is selected to perform spatial curve smoothing on the extracted skeleton. 1 ,O 2 ,...,O n-1 A total of m = n-1 points are used as control points of the Bezier curve. The formula of the Bezier curve is as follows:
[0225]
[0226] Among them, t is a parameter; B i,m (t) is the basis function of the i-th control point in the n-th Bezier curve, as shown below:
[0227]
[0228] Therefore, the present invention adopts the above-mentioned visual servo motion planning method of the forest maintenance robot spraying device, overcomes the shortcomings of single-scan point cloud data, effectively solves challenges such as data sparsity and noise interference, realizes the precise extraction of tree skeletons, and provides more accurate and reliable structural information for applications such as robot tree painting.
[0229] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A visual servo motion planning method for a spraying device of a forest maintenance robot, characterized in that: The following steps are involved: S1. Use multi-line laser radar to obtain the point cloud of the tree to be painted, and obtain the point cloud of the tree trunk to be painted through height threshold filtering and spatial clustering algorithm; S2, segmenting the point cloud of the tree trunk to be painted obtained in step S1 in the vertical direction to obtain point cloud blocks, and performing kernel density estimation, point cloud weight calculation, and data centralization on the overall point cloud and the point cloud blocks respectively; obtaining the first eigenvectors of the overall point cloud of the tree trunk and each point cloud block based on the principal component analysis method and using them as the principal components; S3, using the weighted center algorithm to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node; S4, using the principal components of the point cloud blocks obtained in step S2, the principal components of the overall point cloud are corrected by the proportional coefficient, and then iteratively corrected, and the root nodes obtained in step S3 are continuously accumulated to obtain the center points of each point cloud block, and the center points are sequentially connected to obtain the trunk skeleton; S5. Perform spatial Bezier curve smoothing processing on the tree trunk skeleton obtained in step S4 to obtain a motion trajectory of the spraying device.
2. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1 is characterized in that: In step S1, the Robosense-lidar-16 laser radar is used to scan and obtain the original point cloud data as shown below: P={p i ∣p i =(x i ,y i ,z i ),i=1,2,...,N} Among them, P represents the point cloud, P i represents the i-th point in the point cloud, (x i ,y i ,z i ) represents the three-dimensional coordinates of the i-th point, and N represents the total number of points in the point cloud.
3. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1 is characterized in that: In step S1, the point cloud is denoised using a height threshold filtering method, the height threshold is set to 1.2 m, all points with Z coordinate values greater than 1.2 m in the point cloud data are removed, and points with Z coordinate values less than or equal to 1.2 m are retained; S121. Define a point cloud P′ containing only points that meet the height condition, as shown below: P′={p i ∣p i =(x i ,y i ,z i ),z i ≤1.2,i=1,2,...,N} Among them, P′ represents the point cloud after height threshold filtering, p i represents the i-th point in the original point cloud P; (x i ,y i ,z i ) represents the three-dimensional coordinates of the i-th point, z i ≤1.2 indicates point p i The height shall not exceed 1.2m; S122, define a screening condition function χ(z i ), the function is in z i 1 if ≤1.2, otherwise 0: S123, the screening function χ(z i ) as the screening condition of point cloud P′, the screened point cloud P′ is as follows: P′={p i ∣p i (x i ,y i ,z i ),χ(z i )=1} Then the matrix form of the point cloud P′ is as follows: Among them, N′ is the i ≤1.2; therefore, the point cloud matrix P′ after filtering with a height threshold of 1.2m is obtained.
4. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1 is characterized in that: In step S1, the filtered point cloud P′ is processed using a density-based spatial clustering algorithm. The specific process is as follows: S131. For any point p in the point cloud, its ∈ neighborhood N ∈ (p) is defined as p i All points contained in the spherical space with centered and radius ∈, that is: N ∈ (p)={q∈R 3 |dist(p,q)<∈} Where dist(p,q) is the Euclidean distance between points p and q; S132. If the ∈ neighborhood of a point contains at least MinPts points, the point is defined as a core point, as shown below: |N ∈ (p i )|≥MinPts Among them, |N ∈ (p i )| represents the number of elements in the set; if point q is in the ∈ neighborhood of point p, and p is a core point, then q is considered to be directly density-reachable, that is: q∈N ∈ (p) If there exists a series of points p1,p2,...,p n So that p i+1 For every i that is directly density-reachable, then point p n is considered to be reachable from the p1 density; S133, global point cloud P after clustering algorithm processing G Contains points with empty background data removed, as shown below: Where M is the number of points retained after clustering; the point cloud data P after height threshold filtering and spatial clustering G , which is the point cloud with the empty background data removed.
5. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1 is characterized in that: In step S2, the point cloud of the tree trunk to be painted obtained in step S1 is segmented in the vertical direction to obtain point cloud blocks, and kernel density estimation and point cloud weight calculation are performed on the overall point cloud and the point cloud blocks respectively. The specific process is as follows: S21, the global point cloud P G Slice the point cloud at equal intervals along the z-axis direction and divide it into 10 non-interfering point cloud blocks with a height of 12 cm. Define the height threshold h i (i=1,2,...,10), as shown below: h i =0.12(i-1) will satisfy h i ≤p z <h i+1 The point p∈P G Divide into point cloud block B i , where p z represents the z coordinate value of point p, then the global point cloud P G It is divided into 10 point cloud blocks as shown below: Among them, B i Represents the i-th point cloud block; each point cloud block B i Contains the z coordinate value of the global point cloud in the area [h i ,h i+1 ) all points within; S22. For each point cloud block B i Kernel density estimation is performed for each point in the point cloud block B. i For any point x in , its density value is obtained by weighting the contribution of all points in the neighborhood. The weight function is determined by the kernel function K. The kernel density estimate at point x is as follows: in, is the estimated density at point x, n is the point cloud block B i The number of midpoints, d is the dimension of the point; h is the bandwidth parameter, which determines the width of the kernel; K is the kernel function, using a Gaussian kernel, as shown below: Then for every point x∈B i , its kernel density is estimated as: S23, assign an initial weight to each point according to the kernel density estimate, introduce an exponential decay factor to adjust the spatial distribution characteristics of the weight, and point x j The initial weight w(x j ), as follows: The weights are normalized as follows: Among them, w norm (x j ) represents point x j In this point cloud block B i The normalized weights in ; Through the above weight calculation and normalization processing, each point is assigned a weight value between 0 and 1.
6. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 5, characterized in that: In step S2, the principal component analysis method is used to centralize the point cloud data to determine the main direction of the tree point cloud. The specific process is as follows: S241, first, perform global point cloud centralization, and centralize the global point cloud data P G Perform centralized calculation, global point cloud P G Every point p i is represented as a three-dimensional coordinate (x i ,y i ,z i ), calculate the mean vector μ of the point cloud as follows: Where M is the point cloud P G The number of points in ; S242, centralize the point cloud block, for each point cloud block B i The mean vector, i.e. the centroid c, is calculated as follows: Among them, n i It is point cloud block B i The number of points in b ij is the coordinate of the jth point; S243, after calculating the centroid, the coordinate origin of the point cloud block is moved to the centroid, and the point cloud P after the centralization processing c , as shown below: P c ={p i -μ∣i=1,2,...,M} Similarly, point cloud block B i Centralized data B i,c , as shown below: B i,c ={b ij -c∣j=1,2,...,n i }。 7. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 6 is characterized in that: In step S2, the first eigenvectors of the whole point cloud of the trunk and each point cloud block are obtained based on the principal component analysis method and used as the principal components. The specific process is as follows: S251. In order to analyze the features of the point cloud, it is necessary to construct the central matrix X of the point cloud data. c , each row of the matrix corresponds to a centralized point As shown below: Using point cloud P G The central matrix X c , calculate the point cloud covariance matrix C: The center matrix of the point cloud block is X i,c , as shown below: Where n represents the number of points in the point cloud block; S252, Point Cloud P G The eigenvalues and eigenvectors of the covariance matrix C are obtained by the following characteristic equation: Cv i =λ i v i Among them, λ i represents the i-th eigenvalue of the covariance matrix C, v i Representation and eigenvalue λ i The corresponding eigenvector; Similarly, the covariance matrix of the point cloud block is obtained by the following characteristic equation: C i in i =μ i in i Among them, μ i Denotes the covariance matrix C i The i-th eigenvalue of i Represents the eigenvalue μ i The corresponding eigenvector; S253. Select the eigenvector corresponding to the largest eigenvalue in the covariance matrix as the principal component, that is, the main direction of the point cloud, as shown below: Among them, v1 is the global point cloud P G The first eigenvector, u i,1 It is point cloud block B i The first eigenvector of .
8. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1, characterized in that: In step S3, the weighted center algorithm is used to calculate the center point of the point cloud block corresponding to the lowest height point and use it as the root node. The specific process is as follows: S31. Select the weighted center point of the point cloud block with the lowest z coordinate in the global point cloud as the starting point, with a weight of w. norm (x j ), traverse the global point cloud P G , find the point p with the lowest z coordinate min , as shown below: Among them, z i It's point p i The z coordinate value of S32. Determine p i The point cloud block it belongs to is denoted as B min , for B min Calculate the weighted center point to get the root node O root , as shown below: Among them, b min,j It is point cloud block B min The coordinates of the jth point in norm (b min,j ) is point b min,j The normalized weight of min It is point cloud block B min The number of points in .
9. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1, characterized in that: In step S4, the principal components of the point cloud blocks obtained in step S2 are used to correct the principal components of the overall point cloud by the proportional coefficient, and then iterative correction is performed. The root nodes obtained in step S3 are continuously accumulated to obtain the center points of each point cloud block, which are connected in sequence to obtain the trunk skeleton. The specific process is as follows: S41, let the i-th point cloud block B i The amount of data is N i , global point cloud P G The amount of data is M, then the scale factor α of the i-th point cloud block i , as shown below: Use the scaling factor α i Iteratively correct the principal components of other point cloud blocks, that is, use the current point cloud block B in each iteration process i The first eigenvector u of i,1 Correct the overall point cloud P after the i-1th iteration G The first eigenvector v1 of S42, let the overall eigenvector after the i-th iteration be At the i-th iteration, the correction formula of the overall eigenvector is as follows: S43, after each correction, update the starting point O i+1 , assuming the height of each point cloud block is 12cm, define the scaling factor as: The starting point update formula is as follows: S44, update the center point O of the point cloud block obtained by each iteration i+1 Add to the center point matrix O, as shown below: S45, iteratively calculate the center point until all point cloud blocks participate in the iteration process, and the iteration stops.
10. The visual servo motion planning method for a forest maintenance robot spraying device according to claim 1, characterized in that: In step S5, select O1, O2, ..., O n-1 A total of m=n-1 points are used as control points of the Bezier curve. The formula of the Bezier curve is as follows: Among them, t is a parameter; B i,m (t) is the basis function of the i-th control point in the n-th Bezier curve, as shown below:
Citation Information
Patent Citations
Layered point cloud segmentation method based on DBSCAN
CN112070769A
Blade point cloud skeleton extraction method and device
CN113989352A
Single tree refined automatic reconstruction method commonly used for laser point cloud
CN116597116A
Tree position detection device, tree position detection method, and program
JP2012098247A
