Method and system for measuring volume of rotating cargo based on hybrid solid-state radar
By installing a hybrid solid-state radar on the wrapping machine and combining it with point cloud filtering and data processing technology, the problem of low volume measurement accuracy of the wrapping machine was solved, and high-precision and low-cost volume measurement of rotating cargo was achieved.
Patent Information
- Application Number
- CN202510818082.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-23
AI Technical Summary
Existing wrapping machines have low accuracy when measuring the volume of rotating goods, and the sensors are expensive, making it impossible to effectively measure the volume of rotating goods.
A hybrid solid-state radar is installed on the top of the wrapping machine. Through point cloud data processing technology, including point cloud filtering, speed acquisition and rectangle extraction, the length, width and height of the goods are calculated. The OpenCV function is used to extract the minimum circumscribed rectangle of the boundary line and output the length and width values of the goods.
The accuracy of rotating cargo volume measurement is improved, the measurement cost is reduced, and stable volume measurement is achieved.
Smart Images

Figure CN120684973A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of measuring the volume of rotating cargo, and in particular, to a method and system for measuring the volume of rotating cargo based on a hybrid solid-state radar. Background Art
[0002] In the logistics industry, volume and weight are two crucial parameters, impacting numerous aspects of logistics, including pricing and safety. Wrapping machines are a common piece of equipment in the industry. They involve placing cargo on the machine's center tray, which then rotates, wrapping and packaging the cargo as it rotates. They also perform cargo weighing. However, these machines typically lack the ability to directly measure cargo volume. Even high-end wrapping machines equipped with advanced sensors often struggle to accurately measure the volume of rotating cargo, and the expensive sensors contribute to high overall system costs. Summary of the Invention
[0003] The purpose of the present application is to provide a method and system for measuring the volume of rotating cargo based on a hybrid solid-state radar, which can improve the accuracy of volume measurement of rotating cargo.
[0004] This application is implemented as follows:
[0005] In a first aspect, the present application provides a method for measuring the volume of rotating cargo based on a hybrid solid-state radar, comprising:
[0006] S1: Install the hybrid solid-state laser radar on the top of the wrapping machine and adjust its scanning range so that it covers the turntable;
[0007] S2: cyclically collecting point clouds of the goods at a first frequency and storing them in a first cache queue;
[0008] S3: cyclically collecting the rotation speed V of the cargo according to the second frequency;
[0009] S4: storing the point cloud of the goods rotating one circle into the second cache queue according to the first cache queue and the rotation speed V;
[0010] S5: Extract all point clouds in the second cache queue and calculate the length, width and height of the goods according to the preset method, including:
[0011] Sort the height values of all point clouds from largest to smallest, extract the largest multiple height values, and iterate from the second point according to the following rules: Calculate the height difference between the current point and the previous point. If the absolute value is less than the preset value, the current point is considered a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is terminated. After the iteration is complete, calculate the average of all height values in the valid point set, mark this average as the estimated height of the cargo, and output it.
[0012] Project all point clouds onto the XY plane to generate a 2D projection map. The pixel value of the point cloud projection point is set to 255, and the pixel value of the area without point cloud projection is 0. Use the cv::findContours function of OpenCV to find the boundary line of the projected area of the goods, and then use the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, output the length and width of the rectangle, and obtain the length and width measurement values of the goods and output them.
[0013] Based on the first aspect, the specific steps of cyclically collecting the point cloud of the goods at the first frequency and storing it in the first cache queue in step S2 include:
[0014] S2-1: Obtain the point cloud of the goods on the turntable and mark the timestamp to obtain the point cloud of the radar coordinate system;
[0015] S2-2: Obtain the actual installation position of the hybrid solid-state lidar relative to the world coordinate system and convert the point cloud of the lidar coordinate system into the point cloud of the world coordinate system;
[0016] S2-3: For the point cloud in the world coordinate system, a straight-through filtering algorithm is used to filter out the point cloud on and below the turntable surface, and then a statistical filtering algorithm is used to eliminate the device noise point cloud to obtain the filtered point cloud and store it in the first cache queue.
[0017] Based on the first aspect, the specific steps of obtaining the actual installation position of the hybrid solid-state laser radar relative to the world coordinate system in step S2-2 and converting the point cloud of the radar coordinate system into a point cloud in the world coordinate system include:
[0018] Get the position of the hybrid solid-state lidar in the world coordinate system as the rotation quaternion q and the translation vector t:
[0019] q=q w +q x i+q y j+q z k (unit quaternion, ||q||=1);
[0020]
[0021] where q w is the real scalar part, which represents the cosine component of the rotation and is directly related to the rotation angle θ. q x ,q y ,q z is the imaginary vector part, which represents the sinusoidal component of the rotation and the direction of the rotation axis; Where (n x , n y , nz ) is the unit rotation axis vector; i, j, k are imaginary units; t is a vector in three-dimensional space, indicating the direction from the origin to the point (t x ,t y ,t z ) directed line segment; t x ,t y ,t z are the components of vector t on the X-axis, Y-axis, and Z-axis; T is the transpose sign;
[0022] Convert quaternion q to rotation matrix
[0023]
[0024] The translation vector t directly constitutes the translation part, and the homogeneous transformation matrix is obtained
[0025]
[0026] Among them, R is a matrix variable, ∈ is a relation symbol, is a set of real numbers, 3×3 is the matrix dimension;
[0027] Assume that the coordinates of the original point cloud in the radar local coordinate system are Its world coordinate system coordinate p world Calculated by the transformation matrix T:
[0028] p world =T·p local ;
[0029] Expands to:
[0030]
[0031] The complete formula chain is:
[0032]
[0033] Where R(q) is the rotation matrix corresponding to the quaternion q.
[0034] Based on the first aspect, the step of filtering out the point cloud on and below the turntable surface using the straight-through filtering algorithm in step S2-3 specifically includes:
[0035] Get the original point cloud coordinates (x, y, z): Get the original point cloud, each point cloud contains three coordinate values of x, y, and z;
[0036] Determine whether the y-coordinate is within the scanning range: Assume that the y-axis starting point of the scanning range is ymin and the end point is ymax; determine whether the y-coordinate of the current point cloud is within this range, that is, whether it satisfies ymax>y>ymin; if not, discard the point cloud and the process ends; if it is within the range, proceed to the next step;
[0037] Determine whether the z coordinate is within the scanning range: Assume that the z-axis starting point of the scanning range is zmin and the end point is zmax; determine whether the z coordinate of the current point cloud is within this range, that is, whether it satisfies zmax>z>zmin; if not, discard the point cloud and the process ends; if within the range, it is considered to be a point within the reasonable scanning range and the point cloud is retained;
[0038] Determine whether the z coordinate is greater than offset_z: Further check whether the z coordinate is greater than the preset offset_z; if not, discard the point cloud and the process ends; if satisfied, retain the point cloud, and finally obtain the original point cloud set A.
[0039] Based on the first aspect, the step of using a statistical filtering algorithm to eliminate device noise point clouds to obtain filtered point clouds and storing them in the first cache queue in step S2-3 includes:
[0040] Traverse each point P in the original point cloud set A;
[0041] Calculate the distance between point P and all other points in the original point cloud set A;
[0042] If the distance is less than 5cm, store point P in the neighborhood point cloud set B;
[0043] Determine whether all points in the original point cloud set A have been traversed;
[0044] If the traversal is not completed, continue to traverse the next point;
[0045] If the traversal is completed, determine whether the number of points in the neighborhood point set B is greater than 5;
[0046] If it is not greater than 5, clear the neighborhood point set B and delete point P in the original point cloud set A;
[0047] If it is greater than 5, keep the point and proceed to the next point;
[0048] The point cloud set A filtered by the statistical filtering algorithm is obtained and stored in the first cache queue.
[0049] Based on the first aspect, the specific steps of cyclically collecting the rotation speed V of the cargo according to the second frequency in step S3 include:
[0050] S3-1: Obtain the number of hops of the wrapping machine encoder and obtain the encoder speed r by calculating the number of hops per unit time;
[0051] S3-2: Obtain the radius ratio of the encoder turntable and the wrapping machine turntable by measurement. Assuming it is 1:N, the rotation speed of the wrapping machine turntable is r*N. The rotation speed of the cargo can be inferred to be V = r*N.
[0052] Based on the first aspect, in step S4, storing the point cloud of the cargo rotating one circle into the second cache queue according to the first cache queue and the rotation speed V includes:
[0053] S4-1: Receive the point cloud and the rotation speed V of the goods from the first cache queue, extract the first frame of data, set the initial angle A to 0 degrees, and start iterating from the second frame;
[0054] S4-2: Subtract the timestamp of the previous frame (n-1) from the timestamp of the current frame (n), and obtain the time difference t;
[0055] S4-3: Multiply the cargo rotation speed V by the time difference t to obtain the rotation angle a between adjacent frames;
[0056] S4-4: The accumulated rotation angle A of the nth frame is the accumulated rotation angle A of the n-1th frame plus the rotation angle a between adjacent frames. The rotation matrix R is constructed using the current accumulated rotation angle A and the axis angle information of the Z axis of the world coordinate system. The rotation matrix R is multiplied by the point cloud of the nth frame to obtain the rotated new point cloud P and store it in the second cache queue.
[0057] S4-5: Determine whether the cumulative rotation angle A reaches 360 degrees. If not, jump to S4-2 and loop in sequence until the cumulative rotation angle A reaches 360 degrees.
[0058] Based on the first aspect, in step S5, the height values of all point clouds are sorted from large to small, the largest multiple height values are extracted, and iteration is performed starting from the second point according to the following rules: the height difference between the current point and the previous point is calculated. If the absolute value is less than a preset value, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the steps of exiting the iteration include:
[0059] Sort the height values of all point clouds from large to small, extract the 10 largest height values, and iterate from the second point according to the following rules: calculate the height difference between the current point and the previous point. If the absolute value is less than 3 cm, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than 3 cm, exit the iteration.
[0060] In a second aspect, the present application provides a system for measuring the volume of rotating cargo based on a hybrid solid-state radar, characterized by comprising:
[0061] Point cloud acquisition module: used for cyclically acquiring point clouds of goods at a first frequency and storing them in a first cache queue;
[0062] Cargo speed collection module: used to collect the cargo speed V in a cyclic manner according to the second frequency;
[0063] Point cloud pose update module: used to store the point cloud of the cargo rotated one circle into the second cache queue according to the first cache queue and the rotation speed V;
[0064] Cargo volume output module: used to extract all point clouds in the second cache queue and calculate the length, width and height of the cargo according to the preset method, including:
[0065] Sort the height values of all point clouds from largest to smallest, extract the largest multiple height values, and iterate from the second point according to the following rules: Calculate the height difference between the current point and the previous point. If the absolute value is less than the preset value, the current point is considered a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is terminated. After the iteration is complete, calculate the average of all height values in the valid point set, mark this average as the estimated height of the cargo, and output it.
[0066] Project all point clouds onto the XY plane to generate a 2D projection map. The pixel value of the point cloud projection point is set to 255, and the pixel value of the area without point cloud projection is 0. Use the cv::findContours function of OpenCV to find the boundary line of the projected area of the goods, and then use the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, output the length and width of the rectangle, and obtain the length and width measurement values of the goods and output them.
[0067] In a third aspect, the present application provides an electronic device, characterized by comprising:
[0068] a memory for storing one or more programs;
[0069] processor;
[0070] When the one or more programs are executed by the processor, the above method is implemented.
[0071] Compared with the prior art, this application has at least the following advantages or beneficial effects:
[0072] The present invention provides a method and system for measuring the volume of rotating cargo based on a hybrid solid-state radar. The method comprises the following steps: sorting the height values of all point clouds from large to small, extracting the largest multiple height values, and iterating from the second point according to the following rules: calculating the height difference between the current point and the previous point. If the absolute value is less than a preset value, the current point is determined to be a valid height point and placed in a valid point set. If the absolute value is greater than a preset value, the iteration is exited. After the iteration is completed, the average value of all height values in the valid point set is calculated, and this average value is marked as the height estimate of the cargo and output. All point clouds are projected onto the XY plane to generate a 2D projection map. The pixel values of the point cloud projection points are set to 255, and the pixel values of the areas without point cloud projection are set to 0. The cv::findContours function of OpenCV is used to find the boundary line of the cargo projection area. The cv::minAreaRect function is then used to extract the minimum circumscribed rectangle of the cargo area boundary line. The length and width of the rectangle are output, and the cargo length and width measurement values are obtained and output. The method can stably measure the volume of rotating cargo and effectively improve the measurement accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0074] Figure 1 This is a flow chart of an embodiment of a method for measuring the volume of rotating cargo based on a hybrid solid-state radar of the present application;
[0075] Figure 2 This is a flowchart of another embodiment of a method for measuring the volume of rotating cargo based on a hybrid solid-state radar of the present application;
[0076] Figure 3 A schematic diagram of using calibration software to convert a point cloud in a radar coordinate system into a point cloud in a world coordinate system in a method for measuring the volume of rotating cargo based on a hybrid solid-state radar in this application;
[0077] Figure 4 This is a flowchart of a method for measuring the volume of rotating cargo based on a hybrid solid-state radar, wherein a straight-through filtering algorithm is used to filter out point clouds on and below the turntable surface;
[0078] Figure 5 This is a flowchart of a method for measuring the volume of rotating cargo based on a hybrid solid-state radar using a statistical filtering algorithm to eliminate equipment noise point cloud;
[0079] Figure 6 This is a flowchart of storing a point cloud of a rotating cargo into a second cache queue according to a cache queue and a rotation speed V in a method for measuring the volume of rotating cargo based on a hybrid solid-state radar in the present application;
[0080] Figure 7 This is a flow chart of obtaining the cargo height value in an embodiment of a method for measuring the volume of rotating cargo based on a hybrid solid-state radar of the present application;
[0081] Figure 8 This is a flow chart of obtaining the length and width values of cargo in a method for measuring the volume of rotating cargo based on a hybrid solid-state radar in this application;
[0082] Figure 9 This is a structural schematic diagram of an embodiment of a system for measuring the volume of rotating cargo based on a hybrid solid-state radar according to the present application;
[0083] Figure 10 This is a structural diagram of an embodiment of an electronic device of the present application.
[0084] icon:
[0085] 1. Point cloud acquisition module; 2. Cargo speed acquisition module; 3. Point cloud posture update module; 4. Cargo volume output module; 5. Processor; 6. Memory; 7. Communication interface. DETAILED DESCRIPTION
[0086] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0087] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features thereof may be combined with each other.
[0088] Example
[0089] The embodiments of the present application provide a method and system for measuring the volume of rotating cargo based on a hybrid solid-state radar, which can improve the accuracy of volume measurement of rotating cargo.
[0090] Please refer to Figure 1 The present application provides a method for measuring the volume of rotating cargo based on a hybrid solid-state radar, comprising the following steps:
[0091] S1: Install the hybrid solid-state laser radar on the top of the wrapping machine and adjust its scanning range so that it covers the turntable;
[0092] Specifically, this embodiment does not limit the model of the hybrid solid-state laser radar; it only needs to be able to scan goods. The preferred hybrid solid-state laser radar model is the Leishen Intelligent_CX1S3. This embodiment fixes the hybrid solid-state laser radar to the top of the wrapping machine, eliminating the need to modify the wrapping machine's structure. Simply adding a solid-state laser radar to the top of the wrapping machine is convenient, fast, and reduces costs. After the hybrid solid-state laser radar is installed, its scanning range must be adjusted to cover the turntable. Once the goods are placed on the turntable, the hybrid solid-state laser radar can collect a point cloud of the goods for subsequent processing.
[0093] S2: cyclically collecting point clouds of the goods at a first frequency and storing them in a first cache queue;
[0094] For details, please refer to Figure 2 , preferably collecting the point cloud of the cargo in a 120 Hz cycle, as one of the collection methods, including:
[0095] S2-1: Obtain the point cloud of the goods on the turntable and mark the timestamp to obtain the point cloud of the radar coordinate system. At this time, the point cloud is the point cloud in the radar coordinate system;
[0096] S2-2: Obtain the actual installation position of the hybrid solid-state lidar relative to the world coordinate system and convert the point cloud of the lidar coordinate system into the point cloud of the world coordinate system;
[0097] S2-3: For the point cloud in the world coordinate system, a straight-through filtering algorithm is used to filter out the point cloud on and below the turntable surface, and then a statistical filtering algorithm is used to eliminate the device noise point cloud to obtain the filtered point cloud and store it in the first cache queue.
[0098] The specific steps of converting the point cloud in the radar coordinate system into the point cloud in the world coordinate system in step S2-2 include:
[0099] Get the position of the hybrid solid-state lidar in the world coordinate system as the rotation quaternion q and the translation vector t:
[0100] q=q w +q x i+q y j+q z k (unit quaternion, ||q||=1);
[0101]
[0102] where q w is the real scalar part, which represents the cosine component of the rotation and is directly related to the rotation angle θ. q x ,q y ,qz is the imaginary vector part, which represents the sinusoidal component of the rotation and the direction of the rotation axis; Where (n x , n y , n z ) is the unit rotation axis vector; i, j, k are imaginary units; t is a vector in three-dimensional space, indicating the direction from the origin to the point (t x , t y , t z ) directed line segment; t x , t y , t z are the components of vector t on the X-axis, Y-axis, and Z-axis; T is the transpose sign;
[0103] Convert quaternion q to rotation matrix
[0104]
[0105] The translation vector t directly constitutes the translation part, and the homogeneous transformation matrix is obtained
[0106]
[0107] Among them, R is a matrix variable, ∈ is a relation symbol, is a set of real numbers, 3×3 is the matrix dimension;
[0108] Assume that the coordinates of the original point cloud in the radar local coordinate system are Its world coordinate system coordinate p world Calculated by the transformation matrix T:
[0109] p world =T·p local ;
[0110] Expands to:
[0111]
[0112] The complete formula chain is:
[0113]
[0114] Where R(q) is the rotation matrix corresponding to the quaternion q.
[0115] With such a setting, the point cloud data collected by the lidar is initially located in a local coordinate system (radar coordinate system) with the radar itself as the origin. By obtaining the actual installation position of the radar in the world coordinate system (including three-dimensional coordinates and attitude angles), all point cloud data can be converted to the same fixed world coordinate system. This conversion eliminates the data deviation caused by the difference in sensor position, so that the data collected by different sensors (such as cameras, millimeter-wave radars) at different times can be aligned in a unified space. This embodiment can also set the radar's position in the world coordinate system through calibration software and adjust it visually in real time. The calibration software is named the independently developed point cloud calibration software, and the software name is ZLSOTACalibration. Its algorithm service uses grpc communication to transmit and calibrate data. The method of setting the radar's position in the world coordinate system and adjusting it visually in real time through calibration software includes: Figure 3 TCP posture parameter settings in, Figure 3 A schematic diagram of using calibration software to convert the point cloud of the radar coordinate system into a point cloud in the world coordinate system. According to the actual installation position of the radar relative to the center of the world coordinate system, fill in the X, Y, Z and downward Euler angles here. Through this algorithm of the terminal device, the radar's measurement data is converted from the radar coordinate system to the world coordinate system. The actual installation of the hybrid solid-state laser radar does not require a precise 45-degree angle. If there is an installation deviation, it only needs to be corrected in the calibration software. This embodiment can also set the scanning range of the radar through the calibration software and adjust it visually in real time: limit the scanning range of the Y-axis and Z-axis of the radar in the world coordinate system, such as Figure 3 The YZ scanning range is shown on the left. This range can be freely configured within 5 meters on the Z axis and 5 meters on the Y axis. This embodiment also uses calibration software to set the ground filtering algorithm threshold and adjust it visually in real time. This configuration is due to the possibility that the site ground may be uneven, which may result in interfering point clouds. By setting the offset_z parameter in the software, uneven ground point clouds can be filtered out.
[0116] Please refer to Figure 4 As one embodiment of the present invention, the step of using a straight-through filtering algorithm to filter out the point cloud on and below the turntable surface in step S2-3 specifically includes:
[0117] Get the original point cloud coordinates (x, y, z): Get the original point cloud, each point cloud contains three coordinate values of x, y, and z;
[0118] Determine whether the y-coordinate is within the scanning range: Assume that the y-axis starting point of the scanning range is ymin and the end point is ymax; determine whether the y-coordinate of the current point cloud is within this range, that is, whether it satisfies ymax>y>ymin; if not, discard the point cloud and the process ends; if it is within the range, proceed to the next step;
[0119] Determine whether the z coordinate is within the scanning range: Assume that the z-axis starting point of the scanning range is zmin and the end point is zmax; determine whether the z coordinate of the current point cloud is within this range, that is, whether it satisfies zmax>z>zmin; if not, discard the point cloud and the process ends; if within the range, it is considered to be a point within the reasonable scanning range and the point cloud is retained;
[0120] Determine whether the z coordinate is greater than offset_z: Further check whether the z coordinate is greater than the preset offset_z; if not, discard the point cloud and the process ends; if satisfied, retain the point cloud, and finally obtain the original point cloud set A.
[0121] Through such settings, reasonable scanning points are screened out from the original point cloud data, and the point clouds on and below the turntable surface are filtered out.
[0122] Please refer to Figure 5 As one embodiment of the present invention, the step of using a statistical filtering algorithm to eliminate device noise point clouds to obtain filtered point clouds and storing them in the first cache queue in step S2-3 includes:
[0123] Traverse each point P in the original point cloud set A;
[0124] Calculate the distance between point P and all other points in the original point cloud set A;
[0125] If the distance is less than 5cm, store point P in the neighborhood point cloud set B;
[0126] Determine whether all points in the original point cloud set A have been traversed;
[0127] If the traversal is not completed, continue to traverse the next point;
[0128] If the traversal is completed, determine whether the number of points in the neighborhood point set B is greater than 5;
[0129] If it is not greater than 5, clear the neighborhood point set B and delete point P in the original point cloud set A;
[0130] If it is greater than 5, keep the point and proceed to the next point;
[0131] The point cloud set A filtered by the statistical filtering algorithm is obtained and stored in the first cache queue.
[0132] This setting can filter out noise points in the point cloud data. By traversing each point in the point cloud set, calculating its distance to other points, and judging whether to retain the point based on a set threshold (such as 5cm), the point cloud data is filtered. The threshold is set to a minimum number of points in the point cloud of 5 and a statistical spacing of 5cm. That is, when the number of nearby points within 5cm of a point is less than 5, this point and the points within 5cm of it are discarded.
[0133] S3: cyclically collecting the rotation speed V of the cargo according to the second frequency;
[0134] Please refer to Figure 2 Specifically, the second frequency is preferably 2 Hz. As one of the methods of this embodiment, the rotation speed V of the goods is collected cyclically according to the second frequency, including:
[0135] S3-1: Obtain the number of hops of the wrapping machine encoder and obtain the encoder speed r by calculating the number of hops per unit time;
[0136] S3-2: Obtain the radius ratio of the encoder turntable and the wrapping machine turntable by measurement. Assuming it is 1:N, the rotation speed of the wrapping machine turntable is r*N. The rotation speed of the cargo can be inferred to be V = r*N.
[0137] It should be noted that the wrapping machine turntable does not output the rotation speed. In this embodiment, the encoder rotation speed r is obtained by the number of encoder jumps, and then the rotation speed V = r*N of the goods is obtained by the ratio of the radius of the encoder turntable and the wrapping machine turntable, which is used for the subsequent calculation of the cumulative rotation angle A.
[0138] S4: storing the point cloud of the goods rotating one circle into the second cache queue according to the first cache queue and the rotation speed V;
[0139] Please refer to Figure 6 As one embodiment of the present invention, storing the point cloud of a rotation of the cargo into a second cache queue according to a cache queue and a rotation speed V includes:
[0140] S4-1: Receive the point cloud and the rotation speed V of the goods from the first cache queue, extract the first frame of data, set the initial angle A to 0 degrees, and start iterating from the second frame;
[0141] S4-2: Subtract the timestamp of the previous frame (n-1) from the timestamp of the current frame (n), and obtain the time difference t;
[0142] S4-3: Multiply the cargo rotation speed V by the time difference t to obtain the rotation angle a between adjacent frames;
[0143] S4-4: The accumulated rotation angle A of the nth frame is the accumulated rotation angle A of the n-1th frame plus the rotation angle a between adjacent frames. The rotation matrix R is constructed using the current accumulated rotation angle A and the axis angle information of the Z axis of the world coordinate system. The rotation matrix R is multiplied by the point cloud of the nth frame to obtain the rotated new point cloud P and store it in the second cache queue.
[0144] S4-5: Determine whether the cumulative rotation angle A reaches 360 degrees. If not, jump to S4-2 and loop in sequence until the cumulative rotation angle A reaches 360 degrees.
[0145] Through this setting, the rotation angle of the goods can be accurately calculated, and the rotation matrix can be applied to process the point cloud data, ultimately achieving the accurate extraction and storage of the point cloud of the goods rotating one circle.
[0146] S5: Extract all point clouds in the second cache queue and calculate the length, width and height of the goods according to the preset method, including:
[0147] Calculating the height of the cargo includes: sorting the height values of all point clouds from largest to smallest, extracting the largest multiple height values, and iterating from the second point according to the following rules: calculating the height difference between the current point and the previous point. If the absolute value is less than a preset value, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is exited. After the iteration is complete, the average of all height values in the valid point set is calculated, marked as the estimated height value of the cargo, and output.
[0148] Please refer to Figure 7 As one of the implementation methods, it specifically includes: sorting the height values of all point clouds from large to small, extracting the 10 largest height values, and iterating from the second point according to the following rules: calculating the height difference between the current point and the previous point. If the absolute value is less than 3 cm, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than 3 cm, the iteration is exited.
[0149] Through such settings, accurate cargo height values can be effectively obtained from point cloud data.
[0150] Please refer to Figure 8 Calculating the length and width of the goods includes: projecting all point clouds onto the XY plane to generate a 2D projection map, setting the pixel value of the point cloud projection point to 255, and the pixel value of the area without point cloud projection to 0, using OpenCV's cv::findContours function to find the boundary line of the projected area of the goods, and then using the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, outputting the length and width of the rectangle, and thus obtaining and outputting the measured length and width of the goods.
[0151] Through such settings, accurate length and width values of the goods can be effectively obtained from the point cloud data.
[0152] Please refer to Figure 9 As one embodiment of the present invention, a system for measuring the volume of rotating cargo based on a hybrid solid-state radar is further provided, comprising:
[0153] Point cloud acquisition module 1: used for cyclically acquiring point clouds of goods at a first frequency and storing them in a first cache queue;
[0154] Cargo speed collection module 2: used to collect the cargo speed V in a cyclic manner according to the second frequency;
[0155] Point cloud pose update module 3: used to store the point cloud of the cargo rotated one circle into the second cache queue according to the first cache queue and the rotation speed V;
[0156] Cargo volume output module 4: used to extract all point clouds in the second cache queue and calculate the length, width and height of the cargo according to a preset method, including:
[0157] Sort the height values of all point clouds from largest to smallest, extract the largest multiple height values, and iterate from the second point according to the following rules: Calculate the height difference between the current point and the previous point. If the absolute value is less than the preset value, the current point is considered a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is terminated. After the iteration is complete, calculate the average of all height values in the valid point set, mark this average as the estimated height of the cargo, and output it.
[0158] Project all point clouds onto the XY plane to generate a 2D projection map. The pixel value of the point cloud projection point is set to 255, and the pixel value of the area without point cloud projection is 0. Use the cv::findContours function of OpenCV to find the boundary line of the projected area of the goods, and then use the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, output the length and width of the rectangle, and obtain the length and width measurement values of the goods and output them.
[0159] Specifically, for the specific implementation of the system for measuring the volume of rotating cargo based on a hybrid solid-state radar, please refer to the specific implementation of the method for measuring the volume of rotating cargo based on a hybrid solid-state radar, and no further details will be given here.
[0160] Please refer to Figure 10 As one embodiment of the present invention, an electronic device is further provided, including:
[0161] Memory 6, for storing one or more programs;
[0162] Processor 5; the processor 5 is connected to the memory 6 via a communication interface 7 to transmit data;
[0163] When the one or more programs are executed by the processor 5 , the above method is implemented.
[0164] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present application is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
Claims
1. A method for measuring the volume of rotating cargo based on hybrid solid-state radar, characterized in that: include: S1: Install the hybrid solid-state laser radar on the top of the wrapping machine and adjust its scanning range so that it covers the turntable; S2: cyclically collecting point clouds of the goods at a first frequency and storing them in a first cache queue; S3: cyclically collecting the rotation speed V of the cargo according to the second frequency; S4: storing the point cloud of the goods rotating one circle into the second cache queue according to the first cache queue and the rotation speed V; S5: Extract all point clouds in the second cache queue and calculate the length, width and height of the goods according to the preset method, including: Sort the height values of all point clouds from largest to smallest, extract the largest multiple height values, and iterate from the second point according to the following rules: Calculate the height difference between the current point and the previous point. If the absolute value is less than the preset value, the current point is considered a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is terminated. After the iteration is complete, calculate the average of all height values in the valid point set, mark this average as the estimated height of the cargo, and output it. Project all point clouds onto the XY plane to generate a 2D projection map. The pixel value of the point cloud projection point is set to 255, and the pixel value of the area without point cloud projection is 0. Use the cv::findContours function of OpenCV to find the boundary line of the projected area of the goods, and then use the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, output the length and width of the rectangle, and obtain the length and width measurement values of the goods and output them.
2. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 1, characterized in that: In step S2, cyclically collecting the point cloud of the goods at the first frequency and storing it in the first cache queue includes: S2-1: Obtain the point cloud of the goods on the turntable and mark the timestamp to obtain the point cloud of the radar coordinate system; S2-2: Obtain the actual installation position of the hybrid solid-state lidar relative to the world coordinate system and convert the point cloud of the lidar coordinate system into the point cloud of the world coordinate system; S2-3: For the point cloud in the world coordinate system, a straight-through filtering algorithm is used to filter out the point cloud on and below the turntable surface, and then a statistical filtering algorithm is used to eliminate the device noise point cloud to obtain the filtered point cloud and store it in the first cache queue.
3. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 2, characterized in that: In step S2-2, the actual installation position of the hybrid solid-state laser radar relative to the world coordinate system is obtained, and the specific steps of converting the point cloud of the radar coordinate system into the point cloud of the world coordinate system include: The steps of obtaining the actual installation position of the hybrid solid-state laser radar relative to the world coordinate system and converting the point cloud of the radar coordinate system into the point cloud of the world coordinate system specifically include: Get the position of the hybrid solid-state lidar in the world coordinate system as the rotation quaternion q and the translation vector t: (unit quaternion, ||q||=1); where q w is the real scalar part, which represents the cosine component of the rotation and is directly related to the rotation angle θ. q x ,q y ,q z is the imaginary vector part, which represents the sinusoidal component of the rotation and the direction of the rotation axis; Where (n x , n y , n z ) is the unit rotation axis vector; i, j, k are imaginary units; t is a vector in three-dimensional space, indicating the direction from the origin to the point (t x , t y , t z ) directed line segment; t x , t y , t z are the components of vector t on the X-axis, Y-axis, and Z-axis; T is the transpose sign; Convert quaternion q to rotation matrix The translation vector t directly constitutes the translation part, and the homogeneous transformation matrix is obtained Among them, R is a matrix variable, ∈ is a relation symbol, is a set of real numbers, 3×3 is the matrix dimension; Assume that the coordinates of the original point cloud in the radar local coordinate system are Its world coordinate system coordinate p world Calculated by the transformation matrix T: p world =T·p local ; Expands to: The complete formula chain is: Where R(q) is the rotation matrix corresponding to the quaternion q.
4. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 2, characterized in that: The step of using the straight-through filtering algorithm to filter out the point cloud on and below the turntable surface in step S2-3 specifically includes: Get the original point cloud coordinates (x, y, z): Get the original point cloud, each point cloud contains three coordinate values of x, y, and z; Determine whether the y-coordinate is within the scanning range: Assume that the y-axis starting point of the scanning range is ymin and the end point is ymax; determine whether the y-coordinate of the current point cloud is within this range, that is, whether it satisfies ymax>y>ymin; if not, discard the point cloud and the process ends; if it is within the range, proceed to the next step; Determine whether the z coordinate is within the scanning range: Assume that the z-axis starting point of the scanning range is zmin and the end point is zmax; determine whether the z coordinate of the current point cloud is within this range, that is, whether it satisfies zmax>z>zmin; if not, discard the point cloud and the process ends; if within the range, it is considered to be a point within the reasonable scanning range and the point cloud is retained; Determine whether the z coordinate is greater than offset_z: Further check whether the z coordinate is greater than the preset offset_z; if not, discard the point cloud and the process ends; if satisfied, retain the point cloud, and finally obtain the original point cloud set A.
5. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 4, characterized in that: The step of using a statistical filtering algorithm to eliminate the device noise point cloud to obtain a filtered point cloud and storing it in the first cache queue in step S2-3 includes: Traverse each point P in the original point cloud set A; Calculate the distance between point P and all other points in the original point cloud set A; If the distance is less than 5cm, store point P in the neighborhood point cloud set B; Determine whether all points in the original point cloud set A have been traversed; If the traversal is not completed, continue to traverse the next point; If the traversal is completed, determine whether the number of points in the neighborhood point set B is greater than 5; If it is not greater than 5, clear the neighborhood point set B and delete point P in the original point cloud set A; If it is greater than 5, keep the point and proceed to the next point; The point cloud set A filtered by the statistical filtering algorithm is obtained and stored in the first cache queue.
6. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 1, characterized in that: The specific steps of cyclically collecting the rotation speed V of the cargo according to the second frequency in step S3 include: S3-1: Obtain the number of hops of the wrapping machine encoder and obtain the encoder speed r by calculating the number of hops per unit time; S3-2: Obtain the radius ratio of the encoder turntable and the wrapping machine turntable by measurement. Assuming it is 1:N, the rotation speed of the wrapping machine turntable is r*N. The rotation speed of the cargo can be inferred to be V = r*N.
7. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 1, characterized in that: In step S4, storing the point cloud of the goods rotating one circle into the second cache queue according to the first cache queue and the rotation speed V includes: S4-1: Receive the point cloud and the rotation speed V of the goods from the first cache queue, extract the first frame of data, set the initial angle A to 0 degrees, and start iterating from the second frame; S4-2: Subtract the timestamp of the previous frame (n-1) from the timestamp of the current frame (n), and obtain the time difference t; S4-3: Multiply the cargo rotation speed V by the time difference t to obtain the rotation angle a between adjacent frames; S4-4: The accumulated rotation angle A of the nth frame is the accumulated rotation angle A of the n-1th frame plus the rotation angle a between adjacent frames. The rotation matrix R is constructed using the current accumulated rotation angle A and the axis angle information of the Z axis of the world coordinate system. The rotation matrix R is multiplied by the point cloud of the nth frame to obtain the rotated new point cloud P and store it in the second cache queue. S4-5: Determine whether the cumulative rotation angle A reaches 360 degrees. If not, jump to S4-2 and loop in sequence until the cumulative rotation angle A reaches 360 degrees.
8. The method for measuring the volume of rotating cargo based on hybrid solid-state radar according to claim 1, characterized in that: In step S5, the height values of all point clouds are sorted from large to small, the largest multiple height values are extracted, and iteration is performed starting from the second point according to the following rules: the height difference between the current point and the previous point is calculated. If the absolute value is less than the preset value, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is exited. The steps include: Sort the height values of all point clouds from large to small, extract the 10 largest height values, and iterate from the second point according to the following rules: calculate the height difference between the current point and the previous point. If the absolute value is less than 3 cm, the current point is determined to be a valid height point and added to the valid point set. If the absolute value is greater than 3 cm, exit the iteration.
9. A system for measuring the volume of rotating cargo based on hybrid solid-state radar, characterized in that: include: Point cloud acquisition module: used for cyclically acquiring point clouds of goods at a first frequency and storing them in a first cache queue; Cargo speed collection module: used to collect the cargo speed V in a cyclic manner according to the second frequency; Point cloud pose update module: used to store the point cloud of the cargo rotated one circle into the second cache queue according to the first cache queue and the rotation speed V. This module includes: calculating the cumulative rotation angle A of the nth frame based on the first cache queue and the rotation speed V, constructing the rotation matrix R using the current cumulative rotation angle A and the axis angle information of the world coordinate system Z axis, multiplying the rotation matrix R by the point cloud of the nth frame to obtain the rotated new point cloud P and storing it in the second cache queue until the cumulative rotation angle A reaches 360 degrees; Cargo volume output module: used to extract all point clouds in the second cache queue and calculate the length, width and height of the cargo according to the preset method, including: Sort the height values of all point clouds from largest to smallest, extract the largest multiple height values, and iterate from the second point according to the following rules: Calculate the height difference between the current point and the previous point. If the absolute value is less than the preset value, the current point is considered a valid height point and added to the valid point set. If the absolute value is greater than the preset value, the iteration is terminated. After the iteration is complete, calculate the average of all height values in the valid point set, mark this average as the estimated height of the cargo, and output it. Project all point clouds onto the XY plane to generate a 2D projection map. The pixel value of the point cloud projection point is set to 255, and the pixel value of the area without point cloud projection is 0. Use the cv::findContours function of OpenCV to find the boundary line of the projected area of the goods, and then use the cv::minAreaRect function to extract the minimum enclosing rectangle of the boundary line of the goods area, output the length and width of the rectangle, and obtain the length and width measurement values of the goods and output them.
10. An electronic device, characterized in that: include: a memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 8 is implemented.