Precise parcel sorting method and system based on gray scale instrument and servo electric roller
By using high-precision grayscale meter and servo drum in the parcel sorting system, combined with Kalman filtering and multi-objective optimization algorithm, the problems of positioning deviation and slow response speed in traditional sorting technology are solved, and high-precision and high-speed parcel sorting effect is achieved.
Patent Information
- Application Number
- CN202510593861.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-06-24
AI Technical Summary
The existing parcel sorting technology relies on visual positioning, which is prone to deviations in binding between the trolley and the grid. The traditional driving system responds slowly and cannot meet the needs of high-precision sorting.
The precise wrapping sorting method based on the grayscale meter and servo drum is adopted. By installing a high-precision grayscale meter and combining polynomial calibration and Kalman filtering, the positioning accuracy of millimeters is achieved. The MPC online scheduling module based on NSGA-II optimization is introduced to balance tracking errors and control energy consumption in real time. The servo drum closed-loop drive adopts PID parameters optimized by online MOPSO to ensure the fast and smooth execution of speed commands.
It significantly improves the dynamic response speed of the sorting truck, achieves high-precision tracking and smooth energy saving, reduces cumulative errors, reduces operation and maintenance difficulties, and improves system throughput and stability.
Smart Images

Figure CN120197508A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent logistics sorting, and specifically provides a precise parcel sorting method and system based on a grayscale meter and a servo electric roller. Background Technique
[0002] As a key link in modern logistics systems, parcel sorting technology has undergone a profound evolution from manual sorting to mechanization and automation. Early mechanical sorting mainly relied on simple conveyor belts and mechanical baffles, which were easily affected by the shape and placement posture of parcels, making it difficult to balance sorting accuracy and efficiency. With the development of optoelectronic sensors and machine vision technology, sorting solutions based on industrial cameras and laser scanning have gradually matured, capable of obtaining the two-dimensional contour and three-dimensional position of parcels, improving detection accuracy. However, these solutions mostly use high-cost hardware and complex image processing algorithms, and are sensitive to environmental factors such as lighting and surface reflection. At the same time, their sorting execution mostly relies on pneumatic or motor fixed-axis rotation, and the feedback control is mostly simple switch quantity or linear PID, making it difficult to balance the dynamic response speed and positioning accuracy.
[0003] In the prior art, although some systems introduce grayscale sensing for feature extraction, and some solutions use independent servo rollers to achieve lateral offset, the two are often isolated from each other, lacking system integration and algorithm collaborative optimization: grayscale measurement is easily interfered by lighting and surface reflection, and the error of directly mapping position information is large; the servo drive mostly uses PID with empirical parameters, and when facing the diversity of parcel shapes and the speed fluctuation of the conveyor belt, the dynamic response efficiency is insufficient; for problems such as error accumulation, sensing drift, and control trade-off, there is a lack of an adaptive adjustment mechanism based on multi-objective optimization, resulting in difficulty in balancing sorting accuracy and throughput. In addition, the reset operation after sorting often requires complex manual or mechanical switching, and it is impossible to eliminate the cumulative deviation caused by long-term operation in a timely manner. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the technical problems solved by the present invention are: the existing technology relies on visual positioning, which is prone to binding deviation between the trolley and the grid opening; the response speed of the traditional drive system is slow, and it cannot meet the requirements of high-precision sorting.
[0006] To solve the above technical problems, the present invention provides the following technical solutions: a precise parcel sorting method based on a grayscale meter and a servo electric roller, including:
[0007] Install and calibrate the grayscale meter. After the parcel enters the placement area, the grayscale meter scans and generates coordinates.
[0008] Construct a discrete dynamic model with a state vector, and use Kalman filtering to fuse grayscale measurement and encoder data.
[0009] According to the current state and the optimal parameter set optimized by NSGA-II, solve the quadratic programming of finite-horizon MPC online to determine the optimal speed difference;
[0010] Convert the optimal speed difference into the target speeds of the left and right drums, and use the PID closed-loop drive servo drums optimized online for sorting. After sorting is completed, perform a zeroing operation.
[0011] As a preferred scheme of the package precise sorting method based on a grayscale meter and a servo electric drum according to the present invention, wherein: the installation and calibration of the grayscale meter includes fixing a high-precision grayscale meter directly above the package placement area and adjusting the scanning range to cover the entire conveying width;
[0012] Calibrate the grayscale meter, and use a calibration plate to collect the grayscale value G i at the known horizontal and vertical coordinates x i and y i of the target grid number i, and fit a polynomial mapping;
[0013] Solve the polynomial coefficients in a least-squares manner to make the mapping error from the grayscale value to the position less than the error threshold.
[0014] As a preferred scheme of the package precise sorting method based on a grayscale meter and a servo electric drum according to the present invention, wherein: the scanning and generating coordinates includes, after the package enters the placement area, the grayscale meter scans the grayscale value G k at a period T, and converts it into a digital quantity through ADC;
[0015] Quickly calculate the coordinates (x k , y k ) of the center point of the package through polynomial mapping;
[0016] Bind (x k , y k ) with the center coordinates (x i , y i ) of the target grid number i, calculate the difference between the center coordinates of the package center point and the center coordinates of the target grid number i, and obtain the target offset e k .
[0017] As a preferred scheme of the package precise sorting method based on a grayscale meter and a servo electric drum according to the present invention, wherein: the fusion of grayscale measurement and encoder data includes that the encoder continuously feeds back the actual conveying speed v k of the drum, which together with the target offset e k constitutes a state vector
[0018] Let the state vector X kThe measurement value is fused and updated with the Kalman filter to obtain an error estimate and a speed estimate
[0019] As a preferred solution of the package precise sorting method based on the grayscale meter and the servo electric roller described in the present invention, wherein: the NSGA-II optimization includes inputting the decision variable vector θ = {λ, N, Q, R}, constructing a multi-objective function, including the cumulative tracking error The cumulative control quantity The maximum single-step deviation where λ represents the MPC error control weight, Q represents the state noise covariance, R represents the measurement noise covariance, and N represents the prediction step length;
[0020] Set the population size P, the maximum number of generations g, the crossover probability P c and the mutation probability P m ; randomly generate P individuals {θ i} within the range of each variable;
[0021] For each individual θ i , run the sorting system simulation with this parameter set, use the Kalman filter and MPC control, record e0, u0, and calculate the objective where e0 represents the lateral tracking error sequence during the simulation process, and u0 represents the control input sequence output by the MPC during the simulation process;
[0022] Stratify the population according to the Pareto dominance relationship, label the levels, and calculate the crowding distance within the same level; use tournament selection based on levels and crowding to retain P parent generations;
[0023] Perform SBX crossover pairwise on the selected individuals with a probability of P c to generate offspring; perform polynomial mutation on the offspring parameters with a probability of P m ;
[0024] Merge the parent and offspring into 2P individuals, reorder and retain the first P individuals according to levels and crowding, and repeat the iteration until reaching g generations; obtain a set of Pareto optimal solutions {θ}.
[0025] As a preferred solution of the package precise sorting method based on the grayscale meter and the servo electric roller described in the present invention, wherein: the solution of the finite-time MPC quadratic programming includes, after filtering, sending the latest state vector X k as the initial value into the MPC module; constructing a discrete dynamics model, defining the prediction step length N, constructing a state prediction matrix and a control gain matrix, predicting the error vector E and the control weight λ;
[0026] Let u be a vector of control increments of length N, and each component un Corresponding to the command of the roller speed difference within a future prediction step;
[0027] Construct the quadratic cost matrix H to balance the cumulative prediction of lateral error and the consumption of control variables, and add the control weight λ; the linear term f is jointly determined by the current state estimate and the prediction model, specifically including
[0028] each u n is subject to the upper and lower bound amplitudes of the maximum speed difference u max ; organize the upper and lower bounds into an inequality constraint set; on the premise of ensuring that all u n are within the allowable range, find the vector u to minimize the quadratic cost;
[0029] Initialize the control vector u to all zeros and set the working set W to empty; according to the cost matrix H and the linear term f, combined with the current u, calculate the gradient vector g;
[0030] If the gradient magnitudes of all non-working set components are lower than the preset tolerance and all dual quantities corresponding to the working set W are non-negative, then the optimality is satisfied and the iteration is terminated;
[0031] Find the most violated constraint from the inequalities that have not been selected into the working set W and add it to W; for the constraints in the current working set, if their corresponding dual quantities become negative, remove them from W;
[0032] Regard all constraints in W as equalities, fix the corresponding u n at the boundary value, minimize the remaining free components; obtain a search direction Δu, move forward along the direction Δu, determine the maximum feasible step size α, and update u←u + α·Δu;
[0033] If α is less than 1, it is determined that it is blocked by the constraint, and the blocking constraint is added to W;
[0034] When the loop obtains that both the gradient and the dual quantity satisfy the optimal conditions, exit and take the first component u0 of the current u as the optimal speed difference command for this period.
[0035] As a preferred solution of the method for precisely sorting packages based on a grayscale meter and a servo electric roller according to the present invention, wherein: the online optimized PID closed-loop driven servo roller includes decomposing the control vector u into speed adjustment commands for the left and right rollers: while maintaining the basic synchronous conveying speed v0, adding half of the difference to the left roller and subtracting half of the difference from the right roller;
[0036] Inside the servo driver, the PID parameters are automatically tuned online through the multi-objective particle swarm optimization algorithm MOPSO to quickly approximate the actual speed to the command value;
[0037] The package is smoothly guided to the target channel under the differential action of the rollers. When the rear photoelectric switch detects the entry of the package and the PLC completes the sorting determination, the zeroing process is triggered; the PLC sends a position zeroing command to the servo driver to reset the position of the roller encoder to zero, synchronously set the initial error value of the Kalman filter back to zero, and automatically enter the full-scale zeroing calibration after a preset number of times.
[0038] As a preferred embodiment of the package precise sorting system based on a grayscale meter and a servo electric roller according to the present invention, it includes a grayscale scanning module, a state estimation module, a control optimization decision-making module, and a servo roller driving module.
[0039] The grayscale scanning module is responsible for the installation of the grayscale meter, the adjustment of the scanning range, and the calibration.
[0040] The state estimation module is used for real-time fusion of the grayscale measurement coordinates and the encoder speed.
[0041] The control optimization decision-making module is responsible for calling the MPC parameters obtained by offline optimization and the PID parameters for online tuning, solving the finite-time domain MPC online, and fine-tuning the control parameters.
[0042] The servo roller driving module is responsible for converting the control decision into left and right roller speed commands, driving in a closed loop, and performing position reset after sorting is completed.
[0043] A computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the package precise sorting method based on a grayscale meter and a servo electric roller are implemented.
[0044] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the package precise sorting method based on a grayscale meter and a servo electric roller are implemented.
[0045] Advantages of the present invention: The precise parcel sorting method based on a grayscale meter and a servo electric roller provided by the present invention installs a high-precision grayscale meter directly above the parcel placement area, and combines polynomial calibration and Kalman filtering to achieve millimeter-level positioning accuracy; an MPC online scheduling module optimized based on NSGA-II is introduced, which can balance the tracking error and control energy consumption in real time within a finite time domain, significantly improving the dynamic response speed of the sorting trolley; the closed-loop drive of the servo electric roller uses PID parameters optimized by online MOPSO to ensure fast and stable execution of speed commands, effectively suppressing shocks and vibrations; the automatic zeroing function after sorting can eliminate cumulative errors in a timely manner, reducing maintenance costs. The overall solution does not require additional high-cost hardware, and realizes highly flexible and adaptive sorting control through algorithm fusion, is applicable to various parcel sizes and conveying speed scenarios, greatly improves the system throughput and stability, and reduces the operation and maintenance difficulty. Description of the Drawings
[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0047] Figure 1 It is the overall flowchart of a precise parcel sorting method based on a grayscale meter and a servo electric roller provided by the first embodiment of the present invention. Specific Embodiments
[0048] To make the above objects, features, and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention will be described in detail below with reference to the drawings of the specification. Obviously, the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0049] Example 1, referring to Figure 1 , which is an embodiment of the present invention, provides a precise parcel sorting method based on a grayscale meter and a servo electric roller, including:
[0050] S1: Install and calibrate the grayscale meter. After the parcel enters the placement area, the grayscale meter scans and generates coordinates.
[0051] Further, the installation and calibration of the grayscale meter includes fixing a high-precision grayscale meter directly above the parcel placement area and adjusting the scanning range to cover the entire conveying width.
[0052] Calibrate the grayscale meter. Use the calibration plate to collect the grayscale value G at the horizontal and vertical coordinates x i , y i of the known target cell number i, and fit a polynomial mapping. i
[0053] Solve for the polynomial coefficients in the least - squares method to make the mapping error from the grayscale value to the position less than the error threshold. Establish a grayscale - position polynomial mapping model:
[0054] x = a0 + a1G + a2G 2 , y = b0 + b1G + b2G 2
[0055] Use the least - squares method to solve the coefficients {a0, a1, a2} and {b0, b1, b2}, that is, minimize ∑ i (x(G i ) - x i ) 2 , to ensure that the mapping error is lower than the preset threshold (e.g., 1mm). Where G represents the grayscale value, which is the reflection intensity value collected by the grayscale meter on the surface of the package, and the range is generally 0 - 255 (8 - bit grayscale). a0, a1, a2 represent the polynomial coefficients for mapping the grayscale value to the horizontal coordinate x. a0 represents the reference horizontal offset when the grayscale G = 0, a1 is the first - order term coefficient corresponding to the linear influence of the grayscale change on the horizontal position, and a2 is the second - order term coefficient used to correct the non - linear response. Similarly, b0, b1, b2 are the polynomial coefficients for mapping the grayscale value to the vertical coordinate y. G i represents the grayscale value actually measured by the grayscale meter at the i - th known punctuation point.
[0056] The scanning and generating coordinates include that after the package enters the placement area, the grayscale meter scans the grayscale value G at a period T k , and converts it to a digital quantity through ADC.
[0057] Quickly calculate the coordinates (x k , y k ) of the center point of the package through polynomial mapping.
[0058] Bind (x k , y k ) with the center coordinates (x i , y i ) of the target cell number i, calculate the difference between the center coordinates of the package center point and the target cell number i to obtain the target offset e k .
[0059] Furthermore, a high-precision grayscale instrument is fixed directly above the package placement area. For the first time, a multi-point calibration board is used to collect the grayscale-position mapping of the corresponding compartments, and then the polynomial mapping coefficients are solved by the least squares method, ensuring that the mapping error from the grayscale value to the horizontal coordinate is always less than 1 mm. After the package enters the placement area, the grayscale instrument scans at a high speed with a period of 10 ms and immediately converts the grayscale into the horizontal coordinate, completing the "static positioning + compartment binding" in the first step, providing an extremely reliable initial value for subsequent dynamic correction.
[0060] It should be noted that the grayscale instrument is used to replace visual measurement due to its low cost and fast response. The camera is vulnerable to changes in light and the calibration is cumbersome; the single-point measurement of the grayscale instrument requires precise mapping. Through multi-point least squares fitting of the polynomial mapping, the grayscale value is directly mapped to the horizontal coordinate, and the calibration error ≤ 1 mm. This eliminates the positioning drift caused by changes in ambient light and significantly improves the positioning stability.
[0061] S2: Construct a discrete dynamic model with the state vector and use the Kalman filter to fuse the grayscale measurement and encoder data.
[0062] Furthermore, the fusion of the grayscale measurement and encoder data includes that the encoder continuously feeds back the actual conveying speed v k , and the target offset e k together constitute the state vector
[0063] Furthermore, the horizontal offset obtained by grayscale positioning and the conveying speed fed back by the encoder together constitute the state vector, and a Kalman filter is introduced to realize the weighted fusion of the grayscale measurement and encoder data.
[0064] Input the state vector X k and the measurement value into the Kalman filter for fusion update to obtain the error estimate and the speed estimate
[0065] Furthermore, the filter can quickly identify and eliminate occasional noise and drift, and output stable error estimates and speed estimates in real time, significantly reducing the large deviations caused by being vulnerable to external interference when simply relying on grayscale or encoder, and improving the overall robustness.
[0066] It should be noted that the offset and the encoder speed together constitute the state to fuse multi-source data. The simple grayscale measurement is affected by noise, and the encoder has zero drift; traditional filtering is difficult to balance speed and position. The Kalman filter adaptively adjusts the weights, online filters out sudden noise and system drift, and reduces the variance of the error estimate by about 30%, providing a more reliable state basis for subsequent optimal control.
[0067] S3: Based on the current state and the optimal parameter set optimized by NSGA-II, solve the finite-horizon MPC quadratic programming online to determine the optimal speed difference.
[0068] Furthermore, the optimal MPC parameter set (including error control weight, prediction step, noise covariance, etc.) is automatically optimized offline through the multi-objective genetic algorithm (NSGA-II), completely avoiding the pain point of manual repeated parameter tuning. Using these parameters online, solve the quadratic programming of the fixed time domain within each control cycle (10 ms), which can not only minimize the cumulative positioning error to the greatest extent, but also control the energy consumption and mechanical jitter of the roller speed difference, achieving both "high-precision tracking" and "smooth energy saving".
[0069] Furthermore, the NSGA-II optimization includes inputting the decision variable vector θ = {λ, N, Q, R}, constructing a multi-objective function, including the cumulative tracking error cumulative control amount maximum single-step deviation where λ represents the MPC error control weight, Q represents the state noise covariance, R represents the measurement noise covariance, and N represents the prediction step.
[0070] The multi-objective function formula is expressed as:
[0071]
[0072] where both e0 and u0 are obtained by running MPC within the simulation duration T sim inside.
[0073] Set the population size P, the maximum number of generations g, the crossover probability P c , and the mutation probability P m ; randomly generate P individuals {θ i} within the range of each variable.
[0074] For each individual θ i , run the sorting system simulation with this parameter set, use Kalman filtering and MPC control, record e0, u0, and calculate the objective where e0 represents the lateral tracking error sequence during the simulation process, and u0 represents the control input sequence output by MPC during the simulation process.
[0075] Stratify the population according to the Pareto dominance relationship, label the levels, and calculate the crowding distance within the same level; adopt tournament selection based on levels and crowding, and retain P parent generations;
[0076] Perform SBX crossover pairwise on the selected individuals with a probability of P c , generate offspring; perform polynomial mutation on the offspring parameters with a probability of P m .
[0077] Merge the parent and child into a 2P individual, reorder, and retain the top P individuals according to rank and crowding degree. Repeat the iteration until the g-th generation is reached; obtain a set of Pareto optimal solutions {θ}.
[0078] The solution of the finite-horizon MPC quadratic programming includes feeding the latest state vector X k as the initial value into the MPC module, where X k+1 represents the state vector at the (k + 1)-th sampling instant. Construct the discrete dynamics model:
[0079] X k+1 = AX k + Bu k
[0080] where:
[0081] T = 10 ms.
[0082] The prediction matrix defines the prediction horizon N and constructs the state prediction matrix
[0083] Φ = [A; A 2 ; …; A N
[0084] The control gain matrix
[0085]
[0086] where Φ represents the stacked state mapping the current state to the future N steps, and each block A i represents the state change without control input predicted i steps later. B represents the control input matrix, describing the immediate impact of the input on the state. A represents the system state transition matrix, describing how the state evolves over time without control input.
[0087] Define the prediction horizon N, construct the state prediction matrix and the control gain matrix, the prediction error vector e and the control weight λ. The prediction error vector formula is expressed as:
[0088] e = ΦX k + Γu,
[0089] where , construct the weight matrix:
[0090]
[0091] For the control weight λ (scalar), the total cost function formula after quadratic expansion is expressed as:
[0092]
[0093] Construct the quadratic cost matrix H to balance the cumulative prediction lateral error and the control effort consumption, and add the control weight λ; the linear term f is jointly determined by the current state estimate and the prediction model. Here, const represents the constant term, and H represents the cost matrix:
[0094]
[0095] Each u n is bounded by the maximum speed difference u max ; organize the upper and lower bounds into an inequality constraint set. Among them, I N represents the identity matrix, which is used to impose penalties on the control input in the quadratic term.
[0096] Apply amplitude limiting to each control quantity u k+i :
[0097] -U max ≤u k+i ≤U max , i = 0, …, N - 1
[0098] Write it uniformly as an inequality constraint:
[0099] G0u ≤ b
[0100] where G0 and b are the dense matrix and vector composed of the upper and lower bounds respectively. On the premise of ensuring that all u n are within the allowable range, find the vector u to minimize the quadratic cost. Construct the quadratic programming QP to finally obtain the standard QP:
[0101]
[0102] Let u be a vector of control increments of length N, and each component u n corresponds to the drum speed difference command within one future prediction step.
[0103] Initialize the control vector u to all zeros and set the working set W to be empty; according to the cost matrix H and the linear term f, combined with the current u, calculate the gradient vector g.
[0104] If the gradient magnitudes of all non-working set components are lower than the preset tolerance and all dual quantities corresponding to the working set W are non-negative, then the optimality is satisfied and the iteration is terminated.
[0105] Find the most violated constraint from the inequalities that have not been selected into the working set W and add it to W; for the constraints in the current working set, if their corresponding dual quantities become negative, remove them from W.
[0106] Regard all constraints in W as equalities and fix the corresponding u nAt the boundary value, minimize the remaining free components; obtain a search direction Δu, move forward along the direction Δu, determine the maximum feasible step size α, and update u ← u + α·Δu.
[0107] If α is less than 1, it is determined that it is blocked by a constraint, and the blocking constraint is added to W.
[0108] When the gradients and dual variables obtained in the loop both satisfy the optimal conditions, exit and take the first component u0 of the current u as the optimal speed difference command for this cycle.
[0109] It should be noted that the evolutionary algorithm is used to optimize among error, control energy consumption, and limit deviation. It is difficult to balance fast response and control smoothness with fixed parameters; manual parameter adjustment is inefficient. Generate the Pareto front parameter set offline so that the optimal solution can be flexibly selected under different working conditions.
[0110] S4: Convert the optimal speed difference into the target speeds of the left and right rollers, use the online optimized PID closed-loop to drive the servo rollers for sorting, and perform a zeroing operation after sorting is completed.
[0111] Furthermore, based on the speed difference command issued by the outer-layer MPC prediction, the inner loop of the servo driver uses PID control, and the multi-objective particle swarm optimization algorithm (MOPSO) is run online to dynamically fine-tune the PID gains, so that the response time of the system to the speed command is stably maintained at ≤ 0.1 second, and there is no overshoot or oscillation.
[0112] — This three-level control architecture of "prediction + closed-loop + self-optimization" takes into account both fast dynamic response and the smoothness of the whole process, and can not only meet the high-throughput industrial rhythm but also cope with sudden load changes during the sorting process.
[0113] Even further, the online optimized PID closed-loop driven servo roller includes decomposing the control vector u into the speed adjustment commands of the left and right rollers. While maintaining the basic synchronous conveying speed v0, the left roller adds half of the difference, and the right roller subtracts half of the difference.
[0114] Inside the servo driver, the PID parameters automatically optimized by the multi-objective particle swarm optimization algorithm MOPSO are used online to quickly approximate the actual speed to the command value.
[0115] The decision variable vector is expressed by the formula:
[0116] ψ = [K p , K i , K d
[0117] The multi-objective function is expressed by the formula:
[0118]
[0119] Among them, the sliding window length T w is several sampling periods, and Δu k = u k - u k-1 Set the number of particles M, the maximum number of iterations I max , the inertia weight w, the cognitive coefficient c1, and the social coefficient c2.
[0120] At range, randomly initialize the particle position ψ i and the velocity v i .
[0121] The individual best pbest i = ψ i ; The external archive Archive stores the global Pareto solution set.
[0122] For each particle ψ i , run the PID control on the sliding window data and calculate If the current solution dominates pbest i , then update pbest i .
[0123] Add the non-dominated solutions to Archive and retain a limited capacity according to the crowding degree.
[0124] Select gbest from Archive with the inverse probability of crowding degree (or tournament). Update the velocity and position for each particle:
[0125] v i ← wv i + c1r1(pbest i - ψ i ) + c2r2(gbest - ψ i )
[0126] ψ i ← ψ i + v i
[0127] And limit ψ i to the predetermined upper and lower bounds. Repeat the iteration until the number of times I max , and send a set of Pareto optimal {ψ *} in the archive to the PLC. The system can select the final (K p , K i , K d )
[0128] Among them, ψ represents the PID parameter vector [K p , K i , Kd , K p , K i , K d represent the proportional, integral, and derivative loop gains; T w represents the sliding window length for PID tuning; r1, r2 ∼ U(0, 1) represent random weights.
[0129] The package is smoothly guided to the target channel under the differential action of the drum. When the rear optoelectronic switch detects the entry of the package and the PLC determines that the sorting is completed, the zeroing process is triggered; the PLC sends a position zeroing command to the servo drive, resets the position of the drum encoder to zero, synchronously sets the initial error value of the Kalman filter back to zero, and automatically enters the full-scale zeroing calibration after a preset number of times.
[0130] It should be noted that after each sorting is completed, the system automatically resets the position of the drum encoder to zero and resets the initial value of the filter, completely avoiding the edge drift caused by the accumulation of small deviations. A periodic "full-scale calibration" process is also set: the sorting trolley moves to the dedicated calibration position, the grayscale meter checks the zero mark again, and the mapping coefficient is corrected again to ensure that the positioning accuracy does not degrade during long-term operation.
[0131] Embodiment 2, an embodiment of the present invention, provides a method for precise package sorting based on a grayscale meter and a servo electric drum. In order to verify the beneficial effects of the present invention, scientific demonstrations are carried out through economic benefit calculations and simulation experiments.
[0132] First, in the laboratory environment, a standard conveyor line and a servo electric drum system are selected. A high-precision grayscale meter (resolution 0.01 gray level) is fixedly installed directly above the package placement area. The optical focal length and working distance are adjusted to ensure that the scanning range of the grayscale meter covers the full width of the conveyor belt. A circular calibration plate with a diameter of 30 mm is used, and the calibration plate is sequentially placed at the centers of seven compartments numbered 1 to 7, and the corresponding gray values are read. The polynomial mapping function is fitted by the least squares method, and the gray value is mapped to the horizontal coordinate of the compartment. The fitting polynomial form is a quadratic polynomial, and the mapping error is tested to be less than 0.8 mm. All fitting coefficients and the corresponding compartment center coordinates are written into the human-machine interface (HMI) of the PLC.
[0133] Before each test, seven different specifications of simulated packages (randomly assigned IDA - G, size range 200 mm × 150 mm - 300 mm x 200 mm) are sequentially placed in the placement area and precisely aligned to verify the initial static positioning accuracy of the system. The grayscale meter reads the gray value at the center of the package at a period of 10 ms and converts it into a digital quantity through ADC. The horizontal coordinate x is calculated in real time by calling the polynomial mapping function through the HMI interface k , and compared with the preset compartment center coordinate to obtain the original offset e k。
[0134] Meanwhile, the system encoder continuously feeds back the actual conveying speed v of the roller, which together with the offset constitutes the state vector [e k , v k T 。The Kalman filter module fuses and updates the gray-scale measurement and encoder speed according to the covariance matrices Q and R obtained by offline tuning in Matlab / Simulink in advance, and outputs the filtered error estimate and speed estimate This process is completed within each sampling period (within 10 ms), effectively suppressing the sudden deviations caused by gray-scale jitter and speed drift.
[0135] After obtaining the accurate state estimate, the control optimization module calls the optimal parameter set of MPC generated by the offline NSGA-II algorithm, with the error control weight λ = 0.8, the prediction step N = 5, the state noise covariance, and the measurement noise covariance matrix. The MPC module takes the current state as the initial value, online constructs a finite-horizon quadratic programming, weighs the lateral tracking error and the energy consumption of the roller speed difference within the next 5 steps, solves the optimal speed difference sequence, and selects the first speed difference command Δv k 。Subsequently, the command is decomposed into the speeds of the left and right rollers: on the basis of the basic synchronous speed v0 = 1.0 m / s, the left roller is increased by half of the speed difference, and the right roller is decreased by half of the speed difference. The servo driver has a built-in PID closed loop, and the PID gains (K p , K i , K d ) = (1.2, 0.05, 0.01) are fine-tuned by the online MOPSO algorithm, and can complete speed tracking within 0.1 s without obvious overshoot.
[0136] Compared with traditional static sorting or single closed-loop control, significant advantages are achieved in terms of accuracy, stability, and efficiency.
[0137] The average initial mapping error of static gray-scale mapping is about 0.71 mm (fluctuating ±0.06 mm between packages), which is already better than the 1 mm error level without calibration or only relying on mechanical positioning. After further fusion by the Kalman filter, the error is averaged down to 0.46 mm, and the accuracy is improved by about 35%, indicating that the filter has a significant compensation effect on gray-scale jitter and encoder noise, suppressing accidental errors.
[0138] The MPC quadratic programming optimally coordinates the path and speed within the next 5 steps. The average MPC residual error is further reduced to 0.31 mm, a decrease of approximately 32%. In the dynamic deviation control of tracking the center channel, the design of visible prediction and energy consumption trade-off effectively reduces the peak value of the residual error. The values in the MPC residual error row of the table are all lower than 0.35 mm, and the maximum overshoot is only in the range of 0.09 mm - 0.15 mm, far better than the overshoot of more than 0.5 mm commonly seen in traditional PID single-loop regulation.
[0139] The control delay indicators are all between 0.083 s and 0.090 s, much lower than the 0.12 s - 0.15 s response of the existing PLC + servo single closed-loop.
[0140] Example 3, an embodiment of the present invention, provides a precise parcel sorting system based on a grayscale meter and a servo electric roller, including a grayscale scanning module, a state estimation module, a control optimization decision module, and a servo roller drive module.
[0141] The grayscale scanning module is responsible for the installation of the grayscale meter, the adjustment of the scanning range, and the calibration.
[0142] The state estimation module is used for real-time fusion of the grayscale measurement coordinates and the encoder speed.
[0143] The control optimization decision module is responsible for calling the MPC parameters obtained by offline optimization and the PID parameters for online tuning, solving the finite-time domain MPC online, and fine-tuning the control parameters.
[0144] The servo roller drive module is responsible for converting the control decision into left and right roller speed commands, driving in a closed loop, and performing position reset after sorting is completed.
[0145] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, etc., which can store program codes.
[0146] The logic and / or steps represented in the flowchart or otherwise described herein can, for example, be considered as a definitional sequence of executable instructions for implementing logical functions, and can be embodied specifically in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with the instruction execution system, apparatus, or device.
[0147] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection portion having one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which a program can be printed, as the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing as appropriate, and then storing it in a computer memory.
[0148] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc. It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
[0149] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A method for accurate parcel sorting based on a grayscale meter and a servo electric roller, characterized in that: include: Install and calibrate the grayscale meter. After the package enters the placement area, the grayscale meter scans and generates coordinates; The discrete dynamics model is constructed with the state vector, and the grayscale measurement and encoder data are fused using Kalman filtering; Based on the current state and the optimal parameter set optimized by NSGA-Ⅱ, the finite-time MPC quadratic programming is solved online to determine the optimal speed difference; The optimal speed difference is converted into the target speed of the left and right rollers, and the servo rollers are driven by an online optimized PID closed loop for sorting. After the sorting is completed, a zeroing operation is performed.
2. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller according to claim 1, characterized in that: The said installing and calibrating the grayscale meter includes fixing the high-precision grayscale meter just above the parcel placement area and adjusting the scanning range to cover the entire conveying width; Calibrate the grayscale meter by using the calibration plate to calibrate the horizontal and vertical coordinates x of the known target grid number i. i ,y i The gray value G is collected at i , and fit a polynomial mapping; The polynomial coefficients are solved in a least squares manner so that the mapping error from gray value to position is less than the error threshold.
3. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller as claimed in claim 2, characterized in that: The scanning and generating of coordinates includes: after the package enters the placement area, the grayscale meter scans the grayscale value G at a period T k , and converted into digital quantity by ADC; Quickly calculate the coordinates of the package center point (x k ,y k ); (x k ,y k ) and the center coordinate (x i ,y i ) binding, calculate the difference between the center coordinates of the package and the center coordinates of the target grid number i, and get the target offset e k .
4. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller as claimed in claim 3, characterized in that: The fusion of grayscale measurement and encoder data includes the encoder continuously feeding back the actual conveying speed v of the roller. k , with the target offset e k Together they form the state vector The state vector X k The measured value is input into the Kalman filter for fusion update to obtain the error estimate and speed estimation 5. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller according to claim 4, characterized in that: The NSGA-II optimization includes inputting a decision variable vector θ = {λ, N, Q, R}, constructing a multi-objective function, including the cumulative tracking error Cumulative control amount Maximum single step deviation Where λ represents the MPC error control weight, Q represents the state noise covariance, R represents the measurement noise covariance, and N represents the prediction step size; Set the population size P, maximum number of generations g, and crossover probability P c , mutation probability P m ; Randomly generate P individuals {θ i }; For each individual θ i , run the sorting system simulation with this parameter set, use Kalman filtering and MPC control, record e0,u0, and calculate the target Where e0 represents the lateral tracking error sequence of the simulation process, and u0 represents the control input sequence of the MPC output during the simulation process; The population is stratified according to the Pareto dominance relationship, the levels are marked, and the crowding distance is calculated within the same layer; a tournament selection based on level and crowding is used to retain P parents; Perform SBX crossover on selected individuals with probability P c , generate offspring; perform polynomial mutation on offspring parameters with probability P m ; Merge the parent and the child into 2P individuals, reorder them and keep the first P individuals according to the rank and crowding degree, repeat the iteration until the g generation is reached; get a set of Pareto optimal solutions {θ}.
6. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller according to claim 5, characterized in that: The solution of the finite-time MPC quadratic programming includes filtering the latest state vector X k It is sent to the MPC module as the initial value; Construct a discrete dynamics model, define the prediction step size N, construct the state prediction matrix and control gain matrix, predict the error vector E and the control weight λ; Let u be a vector of control increments of length N, with each component u n Corresponding to the roller speed difference instruction within one prediction step in the future; Construct a quadratic cost matrix H to balance the cumulative prediction lateral error and the control consumption, and add the control weight λ; the linear term f is determined by the current state estimation and prediction model, including Each u n Both are subject to the maximum speed difference u max The upper and lower limits are arranged into inequality restriction sets; while ensuring that all u n Under the premise of the allowable range, find the vector u that minimizes the quadratic cost; Initially set the control vector u to all zeros and empty the working set W. Calculate the gradient vector g based on the cost matrix H and the linear term f, combined with the current u. If the gradient amplitudes of all non-working set components are lower than the preset tolerance, and the dual quantities corresponding to all working sets W are non-negative, the optimality is met and the iteration is terminated; From the inequalities that have not been selected into the working set W, find the most severely violated constraint and add it to W; for the constraints in the current working set, if their corresponding dual quantities become negative, remove them from W; Treat all constraints in W as equalities, and fix the corresponding u n At the limit value, minimize the remaining free component; get a search direction Δu, move forward along the direction Δu, determine the maximum feasible step length α, and update u←u+α·Δu; If α is less than 1, it is determined to be blocked by the constraint, and the blocking constraint is added to W; When the loop obtains that both the gradient and the dual quantity meet the optimal conditions, it exits and takes the first component u0 of the current u as the optimal speed difference instruction for this cycle.
7. The method for accurate parcel sorting based on a grayscale meter and a servo electric roller according to claim 6, characterized in that: The online optimized PID closed-loop drive servo roller includes decomposing the control vector u into speed adjustment instructions for the left and right rollers, while maintaining the basic synchronous conveying speed v0, the left roller adds half of the difference and the right roller reduces half of the difference; The servo drive uses the PID parameters automatically tuned online by the multi-objective particle swarm algorithm MOPSO to quickly bring the actual speed close to the command value. The package is smoothly guided to the target channel under the action of the roller differential speed. When the rear photoelectric switch detects the entry of the package and the PLC determines that the sorting is completed, the zeroing process is triggered; The PLC sends a position return to zero command to the servo driver, resets the roller encoder position to zero, and simultaneously sets the initial error value of the Kalman filter back to zero, and automatically enters full-quantity return to zero calibration after a preset number of times.
8. A system using the method for accurate parcel sorting based on a grayscale meter and a servo electric roller as claimed in any one of claims 1 to 7, characterized in that: It includes grayscale scanning module, state estimation module, control optimization decision module and servo roller drive module; The grayscale scanning module is responsible for the installation, scanning range adjustment and calibration of the grayscale instrument; The state estimation module is used to fuse the grayscale measurement coordinates and the encoder speed in real time; The control optimization decision module is responsible for calling the MPC parameters obtained by offline optimization and the PID parameters tuned online, solving the finite time domain MPC online and fine-tuning the control parameters; The servo roller drive module is responsible for converting the control decision into left and right roller speed instructions, closed-loop drive, and performing position resetting after sorting is completed.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for accurate sorting of packages based on a grayscale meter and a servo electric roller as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for accurate parcel sorting based on a grayscale meter and a servo electric roller as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method, device, medium and product for determining position of conveyor belt package
CN122332735A