Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of scaling methods of laser two-dimensional distance measuring sensor, have consumption
When short, precision is high, the influence of cost bottom and stability to angular error is small feature.
In order to solve the above-mentioned technical problem, The technical solution adopted by the invention is as follows: a kind of laser two-dimensional distance measuring sensor
Scaling method, comprising the following steps:
When motor drives code-disc uniform rotation, angle value calibration is carried out to each tooth of code-disc;
It is uniformly got ready between two adjacent teeth, calculates to obtain in real time and arbitrarily demarcate angle institute between two neighboring tooth
Corresponding point;
The measurement point that laser two-dimensional distance measuring sensor is at the uniform velocity formed in predetermined angular is obtained, and obtains each measurement point
To the measured value of distance between laser two-dimensional distance measuring sensor, pass through Kalman filtering algorithm and weighted average filtering algorithm phase group
Closing reduces noise to this series of measured values;
It is analyzed by static fixed-point system error calibration model and quantifies to measure influence of the distance to error, and correct sample
Machine systematic error due to caused by measurement distance difference;
The influence analyzed by static panorama systematic error peg model and quantify motor speed to error, and correct sample
Machine error due to caused by motor speed difference.
Further, it is preferable that it is described when motor drives code-disc uniform rotation, angle is carried out to each tooth of code-disc
Angle value calibration, specifically includes:
S1.1: when obtaining the motor and driving the code-disc at the uniform velocity rotate n to enclose, by each tooth of m tooth on code-disc
Time t, the former data that will acquire are expressed as matrix form are as follows:Wherein, each behavior electricity of matrix
Machine turn around code-disc record time, matrix it is each be classified as code-disc turn different circles when, by the time of the same tooth;
S1.2: each column j of matrix (1) is averaged:One train value of gained: t1,t2,…,
tm, as calibrated code-disc angle value.
Preferably, described uniformly to be got ready between two adjacent teeth, it calculates obtain between two neighboring tooth in real time
Point corresponding to any calibration angle, specifically includes:
S2.1: the angle value for choosing two continuous tooth position calibration of code-disc is respectively q1,q2, wherein q1<q2, in q1And q2It
Between beaten m point s1,s2,…,sm, in q1And q2Between choose angle p, it is assumed that the corresponding point in the position of angle p is sx, then according to probability
Formula hasThe corresponding point in the position that can obtain angle p of solution is sx, the wherein value of x are as follows:
Complete angle real-time calibration.
Preferably, the measurement point for obtaining laser two-dimensional distance measuring sensor and at the uniform velocity being formed in predetermined angular range, and
And each measurement point is obtained to the measured value of distance between laser two-dimensional distance measuring sensor, pass through Kalman filtering algorithm and weighting
Average filter algorithm, which is combined, reduces noise to this series of measured values, specifically includes:
S3.1: obtaining the original measurement value of m point in current predetermined angular region, is x1,x2,…,xm;
S3.2: Kalman filtering, adjust automatically Kalman filtering parameter, filtered value are as follows: y are carried out1,y2,…,ym, card
Kalman Filtering is completed;
S3.3: by the value y after Kalman filtering1,y2,…,ym, will be within the scope of 3 ° according to angle growth order
Middle position yp, yp+1…yqWeight be set as w1, remaining is set as w with respect to the weight of the farther away value in center2, and w1And w2
Meet w1=2w2And w1+w2=1;
S3.4: each value in above-mentioned S1.3 is substituted into formula:
Obtain final output filter value y, weighted average filtering is completed.
Preferably, described to be analyzed by static fixed-point system error calibration model and quantify to measure distance to the shadow of error
It rings, and corrects model machine systematic error due to caused by measurement distance difference, specifically include:
S4.1: interval measurement and one group of data is saved in positive stroke, repeated k times, then interval measurement is simultaneously in revesal
One group of data is saved, is repeated k times, 2k group full stroke data are saved;
S4.2: to the exceptional value and zero rejecting in 2k group data, the availability of test data is analyzed;
S4.3: it is averaged, is put down after each measurement distance value x in every group of data is subtracted corresponding actual distance value
Equal error y;
S4.4: being returned using nonlinear least-square, is intended the relationship between measurement distance value x and mean error y
It closes, obtains the nonlinear polynomial model comprising measurement distance value and error y, obtain 2k model:
y1=a11x11+a12x12 2+a13x13 3+ ...+ε,
y2=a21x21+a22x22 2+a23x23 3+ ...+ε,
...
yM=aM1xM1+aM2xM2 2+aM3xM3 3+ ...+ε,
Wherein, m=2k, ε are residual error, a11, a12, a13...,a21,a22,a23...ak1, ak2, ak3... join for models fitting
Number;
Above-mentioned 2k model is done into sum-average arithmetic, obtains a built-up pattern:
Preferably, the shadow analyzed by static panorama systematic error peg model and quantify motor speed to error
It rings, and corrects model machine error due to caused by motor speed difference, specifically include:
S5.1:f adjustment model machine sweep speed carries out DATA REASONING and saves to form one group of number in each sweep speed
According to, it circuits sequentially and carries out h times, formation h group data;
S5.2: to the exceptional value and zero rejecting in h group data, the availability of test data is analyzed;
S5.3: it is averaged, is put down after subtracting corresponding actual distance value to each measurement distance value in every group of data
Equal error e;
S5.4: being returned using nonlinear least-square, is carried out to the relationship between motor momentary rate p and mean error e
Fitting obtains the nonlinear polynomial model comprising measurement distance value and error about motor speed, obtains k specific moulds
Type:
e1=b11p1+b12p1 2+b13p1 3+…+ε,
e2=b21p2+b22p2 2+b23p2 3+…+ε,
...
ek=bk1pk+bk2pk 2+bk3pk 3+…+ε,
Wherein, ε is residual error, b11, b12, b13...,b21,b22,b23...bk1, bk2, bk3... it is model fitting parameter;
Above-mentioned k model is done into sum-average arithmetic, obtains a built-up pattern:
It is highly preferred that the exceptional value is the measured value above and below average value other than three times standard deviation in the S4.2.
It is highly preferred that in the S4.2, the availability of the analysis test data, including by positive stroke measurment data and
Revesal measurement data carries out variance analysis respectively, if significance test passes through, the multiplicity of positive revesal, which passes through, to be required, if
It is not significant, then do not pass through requirement;The positive stroke of k group and k group revesal are subjected to variance analysis respectively, if significance test is logical
It crosses, then k experiment multiplicity, if not significant, does not pass through requirement by requiring.
Beneficial effects of the present invention: the present invention passes through combined non-linearity least square model algorithm in distance calibration, and
Comprehensively consider influence of the motor speed to systematic error, systematic error calibration total time is effectively reduced, improves systematic error calibration
Precision;The present invention is effectively controlled by combined filter algorithm, i.e. comprehensive utilization kalman filter method and weighted average filtering algorithm
This is made, and reduces random error;The present invention passes through code-disc calibration algorithm and the angle calibration of dependence code-disc in angle calibration
Algorithm reduces influence of the stability to angular error, realizes the real-time adaptive calibration to angle.
Specific embodiment
The present invention will be further explained below with reference to the attached drawings and specific examples, so that those skilled in the art can be with
It more fully understands the present invention and can be practiced, but illustrated embodiment is not as a limitation of the invention.
Present embodiment discloses a kind of scaling method of laser two-dimensional distance measuring sensor, including angle calibration and apart from mark
Fixed, angle calibration is divided into code-disc calibration algorithm and angle real-time calibration algorithm two parts, since code-disc production precision is limited, code-disc
Tooth between angle and uneven, there are certain error, our product needs to control angle by code-disc, so to code
Disk calibration is particularly important;
Code-disc calibration algorithm is to carry out angle value mark to each tooth of code-disc when motor drives code-disc uniform rotation
It is fixed, it specifically includes:
S1.1: when obtaining the motor and driving the code-disc at the uniform velocity rotate n to enclose, by each tooth of m tooth on code-disc
Time t, the former data that will acquire are expressed as matrix form are as follows:Wherein, each behavior electricity of matrix
Machine turn around code-disc record time, matrix it is each be classified as code-disc turn different circles when, by the time of the same tooth;
S1.2: each column j of matrix (1) is averaged:One train value of gained: t1,t2,…,
tm, as calibrated code-disc angle value;
The part initial data of acquisition is as shown in Figure 1, each of them is recorded as sensor turns around the time number of preservation
According to (calling a record in the following text), preceding 88 values of each record are respectively the time interval (μ that sensor passes through each tooth record
S), last two values are the time (μ s) that sensor turns around;
By above-mentioned data read in python in and be processed into as shown in Fig. 2, wherein each behavior one record, it is each to be classified as
The time value of the same between cog difference circle number scale record;
The data pre-processed in Fig. 2 are subjected to code-disc angle calibration, calibration result is as shown in Figure 3, wherein number is
The number of each tooth of code-disc, angle_ever are the corresponding calibrated angle value of each tooth of code-disc.
Angle real-time calibration algorithm is uniformly to be got ready between two adjacent teeth, and it is two neighboring to calculate acquisition in real time
Point corresponding to angle is arbitrarily demarcated between tooth, is specifically included:
S2.1: the angle value for choosing two continuous tooth position calibration of code-disc is respectively q1,q2, wherein q1<q2, in q1And q2It
Between beaten the uniform point s of m1,s2,…,sm, in q1And q2Between choose position and the output angle p of angle p and real-time calibration angle of departure p
The calibration value of measured value can be obtained according to the calibration value for the measured value that angle p can be obtained in S1.1 and S1.2 according to following method
Which point the corresponding position of angle p is, it is assumed that the corresponding point in the position of angle p is sx, then according to new probability formula, haveThe corresponding point in the position that can obtain angle p of solution is sx, the wherein value of x are as follows:Complete angle
Spend real-time calibration;
As shown in figure 3,20 points have been beaten between third tooth (19.57 degree) and the 4th tooth (24.08 degree), number difference
For s1,s2,…,s20, it now determines the number of 21 degree of point, determines 21 degree of which position o'clock in 20 points:
That is the number of 21 degree of point is s7。
The characteristics of distance calibration is divided into random error calibration and systematic error demarcates two parts, random error is to a certain object
When reason amount makees duplicate measurements, error amount is measured in the case where condition is constant, random variation is presented;
Influence of the random error to ranging is ignorable.Therefore, for the required precision for making product reach final, if
The scheme for the reduction random error under static panorama mode is counted;
Random error is demarcated as obtaining the measurement point that laser two-dimensional distance measuring sensor is at the uniform velocity formed in predetermined angular range,
And each measurement point is obtained to the measured value of distance between laser two-dimensional distance measuring sensor, by Kalman filtering algorithm and is added
Weight average filtering algorithm, which is combined, reduces noise to this series of measured values, and Kalman filtering is a kind of utilization linear system state
Equation observes data by system input and output, the algorithm of optimal estimation is carried out to system mode, due to having in observation data
Random error meet white noise, therefore the optimal estimation that obtains of Kalman filtering has filtered out the influence of random error, laser just
There is relevance before and after the primary outcome measure of two-dimentional distance measuring sensor, be suitble to reduce noise with Kalman filtering, specifically
Include:
S3.1: obtaining the original measurement value of m point in current predetermined angular region, is x1,x2,…,xm;
S3.2: Kalman filtering, adjust automatically Kalman filtering parameter, filtered value are as follows: y are carried out1,y2,…,ym, card
Kalman Filtering is completed;
S3.3: by the value y after Kalman filtering1,y2,…,ym, will be within the scope of 3 ° according to angle growth order
Middle position yp, yp+1…yqWeight be set as w1, remaining is set as w with respect to the weight of the farther away value in center2, and w1And w2
Meet w1=2w2And w1+w2=1;
S3.4: each value in above-mentioned S1.3 is substituted into formula:
Obtain final output filter value y, weighted average filtering is completed.
Obtain the output valve (csv format) of 20 points within the scope of current 3 degree as shown in figure 4, it can be seen from Fig. 4 that without
The model machine error of random error calibration is larger, and scatter plot is as shown in figure 5, data carry out Kalman filtering, filtered knot in Fig. 4
Fruit is as shown in fig. 6, comparison diagram 4 and Fig. 6, Kalman filtering front and back random error differ greatly, after Kalman filtering, at random
Error is obviously reduced, under provide the comparison after initial data VS Kalman filtering as shown in fig. 7, dot be filtering before number,
Cross point is the number after filtering, hence it is evident that is found out, data random error reduces after filtering, finally carries out data each in Fig. 6
Weighted average filtering, exports result after filtering are as follows: 510.560196.
Systematic error refers to that under identical measuring condition, duplicate measurements acquired results are always bigger than normal or less than normal, it then follows one
Fixed rule.The dynamical surveying mode of laser two-dimensional distance measuring sensor model machine includes one-point measurement and panoramic scanning both of which.
Wherein one-point measurement mode refers to that model machine motor does not turn, in the mode of the distance value of fixed position measurement fixed point;Panoramic scanning
Mode refers to that model machine motor rotates, in the mode of the distance value of each point in fixed position measurement two-dimensional scanning face.Panoramic scanning
Whether the difference of mode and one-point measurement mode just rotates in motor.Therefore, the calibration of systematic error is just according to above-mentioned two mould
The principle of formula is split as two steps: 1 under static fixed point mode, demarcates systematic error;2 back calibration knot
On fruit, offset of the motor speed to calibration result when increasing panoramic scanning;
Influence of the distance to error is analyzed and quantified to measure by static fixed-point system error calibration model, it is quiet by collecting
State experimental data establishes nonlinear least-square regression model amendment model machine systematic error due to caused by measurement distance difference, tool
Body includes:
S4.1: interval measurement and one group of data is saved in positive stroke, repeated k times, then interval measurement is simultaneously in revesal
One group of data is saved, is repeated k times, 2k group full stroke data are saved, positive stroke is that ascending measurement, revesal are in range
Have in range and arrive small measurement greatly, interval measurement is to carry out equidistant interval measurement, saves 8 to 12 seconds and is somebody's turn to do when data save
The situation of change of data is in the section time to reduce error;
S4.2: to the exceptional value and zero rejecting in 2k group data, the availability of test data is analyzed, the exceptional value is
Measured value above and below average value other than three times standard deviation, the availability of the analysis test data, including positive revesal repeat
Whether degree passes through requirement: positive stroke measurment data and revesal measurement data being carried out variance analysis respectively, if significance test
Pass through, then the multiplicity of positive revesal, if not significant, does not pass through requirement by requiring;Whether k measurement multiplicity, which passes through, is wanted
It asks: the positive stroke of k group and k group revesal is subjected to variance analysis respectively, if significance test passes through, k measurement multiplicity
By requiring, if not significant, do not pass through requirement;If availability of data does not pass through, weight after product or test method is improved
Number newly is adopted, until availability of data passes through, continues following step;
S4.3: it is averaged, is put down after each measurement distance value x in every group of data is subtracted corresponding actual distance value
Equal error y, every group of measurement distance x and error y is one-to-one relationship;
S4.4: being returned using nonlinear least-square, is intended the relationship between measurement distance value x and mean error y
It closes, obtains the nonlinear polynomial model comprising measurement distance value and error y, obtain 2k model:
y1=a11x11+a12x12 2+a13x13 3+ ...+ε,
y2=a21x21+a22x22 2+a23x23 3+ ...+ε,
...
yM=aM1xM1+aM2xM2 2+aM3xM3 3+ ...+ε,
Wherein, M=2k, ε are residual error, a11, a12, a13...,a21,a22,a23...ak1, ak2, ak3... join for models fitting
Number;
Above-mentioned 2k model is done into sum-average arithmetic, obtains a built-up pattern:
Experimental data is tested and saved to the static fixed-point system error calibration for carrying out laser two-dimensional distance measuring sensor, wherein altogether
It carries out positive revesal experiment, data twice and saves as csv file;Data are read in into python, and excluding outlier, through analyzing number
According to can be used, the partial data after arrangement is as shown in Figure 8, wherein measureddata is measurement value sensor, and truedata is true
Real value, batch are that (which time experiment previous position represents to double figures experiment numbers, and latter position represents positive revesal, and 0 represents positive row
Journey, 1 represents revesal);
Establish combined non-linearity least square model: four groups of data are fitted common nonlinear least-square respectively and return mould
Type, four groups of fit equations are as follows:
y1=-2.2982x+0.0021x2-5.5126e-07x3+5.8717e-11x4+2810.1611;
y2=-0.9577x+0.0012x2-3.008e-07x3+3.4030e-11x4+2110.5527;
y3=-1.5984x+0.0016x2-4.2445e-07x3+4.6323e-11x4+2437.8659;
y4=-1.9634x+0.0019x2-4.9118e-07x3+5.2998e-11x4+2634.2918;
Aforementioned four model is made built-up pattern, final mask are as follows:
Y=-1.7044x+0.0017x2-4.4192e-07x3+4.8017e-11x4+2498.2179;
For models fitting figure as shown in figure 9, each point is initial data, curve is models fitting data.From figure, model
Fitting effect is preferable;
According to model foundation calibration scale, calibration scale partial data is as shown in Figure 10, wherein first is classified as sensor output survey
Magnitude, second is classified as calibration value.
The influence analyzed by static panorama systematic error peg model and quantify motor speed to error, it is quiet by collecting
State panorama experimental data establishes nonlinear least-square regression model amendment model machine error due to caused by motor speed difference, tool
Body includes:
S5.1:f adjustment model machine sweep speed carries out DATA REASONING and saves to form one group of number in each sweep speed
The number of every group of DATA REASONING is determined according to, the number of adjustment model machine sweep speed, when each DATA REASONING, saves 60s to 70s, according to
Secondary circulation carries out h times, forms h group data;
S5.2: in h group data exceptional value and zero reject, the availability of test data is analyzed wherein, in average value
Measured value other than upper and lower three times standard deviation is referred to as exceptional value, analyzes test data availability are as follows: the data that will be tested each time
Variance analysis (examining the similitude of several groups of data) is carried out respectively, if significance test passes through, multiplicity is repeatedly tested and passes through
It is required that not passing through requirement if not significant;If availability of data does not pass through, adopted again after improving product or experimental method
Number continues following step until availability of data passes through;
S5.3: it is averaged, is put down after subtracting corresponding actual distance value to each measurement distance value in every group of data
Equal error e, every group of motor momentary rate p and error e is one-to-one relationship;
S5.4: being returned using nonlinear least-square, is carried out to the relationship between motor momentary rate p and mean error e
Fitting obtains the nonlinear polynomial model comprising measurement distance value and error about motor speed, obtains k specific moulds
Type:
e1=b11p1+b12p1 2+b13p1 3+…+ε,
e2=b21p2+b22p2 2+b23p2 3+…+ε,
...
ek=bk1pk+bk2pk 2+bk3pk 3+…+ε,
Wherein, ε is residual error, b11, b12, b13...,b21,b22,b23...bk1, bk2, bk3... it is model fitting parameter;
Above-mentioned k model is done into sum-average arithmetic, obtains a built-up pattern:
Data acquisition and pretreatment: it carries out the static panorama systematic error calibration experiment of laser two-dimensional distance measuring sensor and protects
Experimental data is deposited, wherein being tested three times altogether, data save as csv file;Data are read in into python, and rejecting abnormalities
Value.Available through analysis data, the partial data after arrangement is as shown in figure 11, wherein speed is sensor motor revolving speed, error
For measurement value sensor error, batch is experiment numbers;
Establish combined non-linearity least square model: three groups of data are fitted common nonlinear least-square respectively and return mould
Type, three groups of fit equations are as follows:
Above three model is made built-up pattern, final mask are as follows:
E=4.0225p+0.0739p2+0.00053p3+83.2652
Models fitting figure is as shown in figure 12, and each point is initial data, and curve is models fitting data, from figure, mould
Type fitting effect is preferable, output valve (having been subjected to static fixed point calibration) each for sensor, in addition above-mentioned final mask calculates
E value out is exported as final calibration value.
Embodiment described above is only to absolutely prove preferred embodiment that is of the invention and being lifted, protection model of the invention
It encloses without being limited thereto.Those skilled in the art's made equivalent substitute or transformation on the basis of the present invention, in the present invention
Protection scope within.Protection scope of the present invention is subject to claims.