A kind of servo control method for linear array CCD scanning process
Technical field
The invention belongs to precise flange technical fields, more specifically, are related to a kind of for linear array CCD scanning mistake
The servo control method of journey.
Background technique
CCD (Charge Coupled Device) is a kind of photoelectric coupling type image device, can directly be turned optical signal
It is changed to electric signal, obtains digitized image after signal amplifies analog-to-digital conversion.CCD device is divided by the arrangement mode of its photosensitive unit
For two class of line array CCD and area array CCD.Line array CCD is because its structure is simple, cost is relatively low and is used widely.Different from face
As long as the simply exposure of the image capturing system of battle array CCD can obtain area image, the imaging system of linear array CCD scanning is desirable
Two-dimensional areas image could be obtained using movement velocity continuous scanning, the characteristic and area array CCD acquisition system of imaging have centainly
Difference.
The scene that Line-scanning Image Acquisition System is used to have relative motion between testee and camera, line-scan digital camera are only adopted every time
Collect one-row pixels, to obtain the complete image of a width, subject must be along the direction perpendicular to line array sensor with certain
Speed movement, after line array CCD acquire data line, subject has moved to next unit length just, formation
Continuously data acquire.
Line array CCD has the fixed line-scanning period, when it only press itself scan period acquisition image and and subject
When movement velocity is asynchronous, blurred image situation will occur, the image of acquisition is usually to be distorted, and may be lost important
Data or increase and repeat useless data, the compression of testee is presented or stretches image, therefore is realized in scanning process
The indifference control of speed is the key that obtain correct and equal proportion image.
SERVO CONTROL during existing linear array CCD scanning mostly uses greatly single control model, cannot achieve scanning process
The accurate control of middle different motion state.Again or biaxial movement is using structure is uniformly controlled, and does not account in scanning process
Twin shaft transports the difference of realized function.That is the main movement for realizing subject in scanning process of the movement of x-axis, it is desirable that realize
The indifference of speed controls.The movement of Y-axis is mainly accomplished that positioning function.Ignore during this point normally results in scanning motion
Still the movement of non-scan direction is generated.Phenomena such as even being distorted so as to cause photo generation stretching, the compression of camera shooting,
Difficulty of the acquired photo in subsequent image processing is increased, the detection efficiency of system is reduced.
Summary of the invention
It is an object of the invention to overcome the deficiencies of the prior art and provide a kind of servos for linear array CCD scanning process
Motion control method, by carrying out indifference control to speed in scanning process, to avoid in linear array CCD camera scanning process because of fortune
The image fault that dynamic speed is unstable and generates.
For achieving the above object, a kind of servo control method for linear array CCD scanning process of the present invention,
It is characterized in that, comprising the following steps:
(1), the scanning track of linear array photoelectric coupling type image device CCD is planned
(1.1), the motion profile of scanning direction is planned
The pixel that the every row of line array CCD is arranged is Nr, the width of line array CCD is W0, the sweep speed of line array CCD is Vc, it is shot
Speed of moving body is V0,;
Then have: transversal scanning precisionLongitudinal scanning precision
Guarantee acquisition image it is undistorted, according to the equal principle of horizontal and vertical resolution ratio, subject it is best
Movement speed and the sweep speed of line array CCD meet following relationship:
V0=VC×W0/Nr
Finally, according to movement velocity V0Plan the motion profile of scanning direction;
(1.2), the motion profile of non-scan direction is planned
Set the movement travel of subject to the single sweep operation width W of line array CCD0;
(1.3), planned trajectory is optimized
Increase filter module in the motion profile output end of planning, filters the noise disturbance in planned trajectory;
(2), parameter tuning
(2.1), the parameter tuning of bicyclic pid algorithm
In speed outer ring and position inner ring, desired accelerating curve A is found out according to the planned trajectory after optimization respectivelyg
(t), then by grating scale sensor actual accelerating curve A is obtainedg0(t), acceleration error curve e is then calculatedA(t)
=Ag(t)-Ag0(t), Proportional coefficient K is finally adjusted according to Ziegler-Nichols algorithmpWith integral coefficient Ki, to complete double
The parameter tuning of ring pid algorithm;
(2.2), iterative learning feedforward+PID/feedback control algolithm parameter tuning;
(2.2.1), the speed outer ring for masking system only retains the position inner ring of system;Then according to the rule after optimization
It draws track and finds out desired rate curve Vs(t), by Vs(t) it carries out Fourier transformation and obtains Vs(jw), then with Vs(jw) as system
System initial input is simultaneously input to speed outer ring;According to the actual speed curve V of grating scale read-out systems0(t), by Vs0(t) it carries out
Fourier transformation obtains Vs0(jw), then with Vs0(jw) it is initially exported as system;
Finally, substituting into iterative learning control law to system, the first time input of system is obtainedYdIt (jw) is system desired output speed;
(2.2.2), Y is exported by the first time of grating scale sensor read-out system1(jw), it then, calculates defeated for the first time
Speed-error curve Δ Y out1(jw)=Y1(jw)-Yd(jw);
Again by iterative learning control law, second of input U of system is calculated according to following formula2(jw);
Wherein, UrIt (jw) is the r times input of system, r=2,3,4 ...;Yr-1It (jw) is the r-1 times output of system, ρ
For Difference Terms proportionality coefficient;
Pass through second of output Y of grating scale sensor read-out system simultaneously2(jw), second of output then, is calculated
Speed-error curve Δ Y2(jw)=Y2(jw)-Yd(jw);
Judge that front and back obtains whether speed-error curve vibrates twice, if there is oscillation, is then once obtained rear
It inputs the feed forward input signal as system and otherwise calculates the input next time of system again by iterative learning control law,
And so on, stop iteration when speed-error curve vibrates;
(2.2.3), the speed outer ring that feed forward input signal is input to the bicyclic PID adjusted in step (2.1)
In, complete iterative learning feedforward+PID/feedback control algolithm parameter tuning;
(3), judge subject current motion state
To the movement velocity V of subject0Seek first derivative, obtain the acceleration a of subject, then by acceleration a with
Given threshold value ε compares, when | a | when > ε, subject is in variable motion state;When | a | when≤ε, subject is at the uniform velocity
Motion state;
(4), the switching between different motion state and handover optimization
(4.1), when subject is in variable motion state, it is switched to feedforward control+PID/feedback control, it is specific to control
Process processed are as follows:
(4.1.1), the initial input U for calculating system under this motion state0;
U0=Kp1*Kp2*Vs(0)+Ur(0)
Wherein, Kp1、Kp2For the proportionality coefficient of position inner ring and speed outer ring, Ur(0) at the beginning for feed forward input signal
The value at quarter, Vs(0) value carved at the beginning for desired rate curve;
(4.1.2), the acceleration feedback signal A that system under motion state is read by grating scale0(t), before then bringing into
Control+PID/feedback control law is presented, the acceleration signal A (t) of system under this motion state is calculated;
ev(t)=A (t)-A0(t)
Wherein, Ki2For the integral coefficient of speed outer ring;
(4.1.3), step (4.1.1)-(4.1.2) is repeated, real-time tracking is carried out to acceleration signal A (t), keep system real
When the rate curve that exports reach desired speed curve, to complete the control under the motion state;
(4.2), when subject is in uniform speed motion state, bicyclic PID control, specific control process are switched to are as follows:
(4.2.1), the initial input U for calculating system under this motion state0;
U0=Kp1*Kp2*Vs(0)
(4.2.2), the acceleration feedback signal A that system under motion state is read by grating scale0(t), it then brings into double
Ring PID control rule, calculates the acceleration signal A (t) of system under this motion state;
ev(t)=A (t)-A0(t)
Wherein, Ki2For the integral coefficient of speed outer ring;
(4.2.3), step (4.2.1)-(4.2.2) is repeated, real-time tracking is carried out to acceleration signal A (t), keep system real
When the rate curve that exports reach desired speed curve, to complete the control under the motion state.
Goal of the invention of the invention is achieved in that
A kind of servo control method for linear array CCD scanning process of the present invention, first plans linear array photoelectric coupling type
The scanning track of image device CCD, then bicyclic pid algorithm and iterative learning feedforward+PID/feedback control algolithm parameter are carried out
Adjusting, finally, judge subject current motion state, and according between different motion state switching and handover optimization it is laggard
Row speed control, thus to avoid the image fault generated in linear array CCD camera scanning process because movement velocity is unstable.
Meanwhile a kind of servo control method for linear array CCD scanning process of the present invention also has below beneficial to effect
Fruit:
(1), the difference model-free Iterative Algorithm that feed forward of acceleration uses, can cause to avoid by system modelling mistake
Error, Dynamic iterations process can constantly correct the output error caused by disturbance, realize and control the indifference of boost phase;
Secondly, the application of difference can eliminate system constant error in iterative process, in the algorithm that the present invention uses, Difference Terms are not only
Consider influence of the state of the system before current state twice to system, it is also contemplated that system mode pair during primary iteration
System residual influences, and introduces influence coefficient of the proportionality coefficient ρ to each secondary iteration to system and is distributed;
(2), two kinds of Controlling model switching controls that the present invention designs make system carry out bicyclic PID in the uniform speed scanning stage
Control, accelerates and retarded motion stage system is controlled using feed forward of acceleration, and this control structure makes system while having
The advantages of bicyclic PID control structure, in turn avoid the disadvantage that system is under single mode state of a control;
(3), handover optimization signal is introduced in handoff procedure, is avoided model and is switched to the disturbance of system bring suddenly,
Reduce the time that system switches between two kinds of control models.
Detailed description of the invention
Fig. 1 is a kind of servo control method flow diagram for linear array CCD scanning process of the present invention;
Fig. 2 is linear array CCD scanning process schematic;
Fig. 3 is filtered programming movement trajectory diagram;
Fig. 4 is switch module motion switch state block diagram;
Fig. 5 is handover optimization signal schematic representation;
Fig. 6 is the feed forward input signal comparison diagram of optimization front and back;
Fig. 7 is the structural block diagram of feedforward input module;
Fig. 8 is the structural block diagram of servo control system;
Fig. 9 is traditional PID control and rate curve comparison diagram of the present invention;
Figure 10 is traditional PID control and speed-error curve comparison diagram of the present invention.
Specific embodiment
A specific embodiment of the invention is described with reference to the accompanying drawing, preferably so as to those skilled in the art
Understand the present invention.Requiring particular attention is that in the following description, when known function and the detailed description of design perhaps
When can desalinate main contents of the invention, these descriptions will be ignored herein.
Embodiment
Fig. 1 is a kind of servo control method flow diagram for linear array CCD scanning process of the present invention.
In the present embodiment, as shown in Figure 1, a kind of servo control side for linear array CCD scanning process of the present invention
Method, comprising the following steps:
S1, the scanning track for planning linear array photoelectric coupling type image device CCD
S1.1, the motion profile for planning scanning direction
Line-scanning Image Acquisition System must be containing the normal capture of motion control ability, and the most important link of motion control is determining
The line frequency of line scan camera is in correctly matching and closes with the relationship between movement velocity, only scan frequency and movement velocity
Just available correct distortionless image, specific scanning process are as shown in Figure 2 for system.
Guarantee that acquired image is not stretched or compresses, it is necessary to defer to a bit: horizontal and vertical point of object
Resolution is equal, i.e. the mobile distance of object is identical as the actual size of pixel sampling in a row synchronizing cycle.
The pixel that the every row of line array CCD is arranged is Nr, the width of line array CCD is W0, the sweep speed of line array CCD is Vc, it is shot
Speed of moving body is V0,;
Then have: transversal scanning precisionLongitudinal scanning precision
Guarantee acquisition image it is undistorted, according to the equal principle of horizontal and vertical resolution ratio, subject it is best
Movement speed and the sweep speed of line array CCD meet following relationship:
V0=VC×W0/Nr
When camera lens and selected camera, transverse precision is fixed value, constant in linear array scanning camera line frequency
In the case of the Longitudinal precision of image be the movement velocity with object and change.When speed of moving body is too fast, make reality
Compression of images will cause certain data segments and lose, when speed of moving body speed, stretches real image, can bring repetition
Hash.In NI Vision Builder for Automated Inspection application, in order to obtain moving object clearly image, avoid image fuzzy, line scanning
Image must lock Longitudinal precision: Longitudinal precision being made to be consistently equal to transverse precision.
Finally, according to movement velocity V0Plan the motion profile of scanning direction;Program results are as shown in figure 3, motion process
It is divided into boost phase, uniform motion stage, decelerating phase.In the uniform motion stage, and R1 the and R2 stage is reserved, it is complete to speed
At the uniform velocity start scanning process again entirely.
S1.2, the motion profile for planning non-scan direction
The movement of non-scan direction is hollow travel stage, and CCD line-scan digital camera does not work at this time.When in order to reduce idle stroke
Between, speed is improved in non-line-scan digital camera working region as far as possible, but need to guarantee positioning accuracy.In order to save empty stroke time, at this time
The movement of scanned object is divided into accelerating sections and braking section.The stroke of whole section of movement exactly sets the movement travel of subject
It is set to the single sweep operation width W of line array CCD0;
S1.3, planned trajectory is optimized
In order to avoid the mutation of speed, acceleration in scanning process.It is smooth as far as possible in motion process, steady.It requires to advise
Draw track it is as smooth as possible, without radio-frequency component.In order to keep planned trajectory more smooth, what the present invention used exports in trajectory planning
End adds filter module.Filter module can filter out the noise disturbance in planned trajectory using Kalman filter,
It is exactly the track unsmooth stage accelerated between uniform motion, realizes the optimization to planned trajectory.
Planned trajectory after having added filter to carry out track optimizing adds as shown in figure 3, filter has been added to eliminate later
Velocity jump between fast motion stage and uniform motion stage.
S2, parameter tuning
The parameter tuning of S2.1, bicyclic pid algorithm
In speed outer ring and position inner ring, desired accelerating curve A is found out according to the planned trajectory after optimization respectivelyg
(t), then by grating scale sensor actual accelerating curve A is obtainedg0(t), acceleration error curve e is then calculatedA(t)
=Ag(t)-Ag0(t), Proportional coefficient K is finally adjusted according to Ziegler-Nichols algorithmpWith integral coefficient Ki, to complete double
The parameter tuning of ring pid algorithm;
The parameter tuning of bicyclic pid algorithm includes the parameter tuning of speed outer ring pid algorithm and the pid algorithm of position inner ring
Parameter tuning, tuning process is identical, below we be illustrated by taking the parameter tuning of speed outer ring pid algorithm as an example,
Detailed process are as follows:
1) proportional controller will, be accessed into system;
2), the proportional gain K of Set scale controller inputs a unit step signal, observation electricity to proportional controller
Acceleration responsive curve A of the machine to unit step signals0(t);
3), ascending change proportional gain K, until system vibrates;
4), when self-sustained oscillation occurs continuing in system, gain at this time and cycle of oscillation is recorded, is respectively labeled as critical
Gain KuWith critical period Tu;
5), the Proportional coefficient K of calculating speed outer ringp2With integral coefficient Ki2;
S2.2, iterative learning feedforward+PID/feedback control algolithm parameter tuning;
S2.2.1, the speed outer ring for masking system only retain the position inner ring of system;Then according to the planning after optimization
Track finds out desired rate curve Vs(t), by Vs(t) it carries out Fourier transformation and obtains Vs(jw), then with Vs(jw) it is used as system
Initial input is simultaneously input to speed outer ring;According to the actual speed curve V of grating scale read-out systems0(t), by Vs0(t) Fu is carried out
In leaf transformation obtain Vs0(jw), then with Vs0(jw) it is initially exported as system;
Finally, substituting into iterative learning control law to system, the first time input of system is obtainedYdIt (jw) is system desired output speed;
S2.2.2, Y is exported by the first time of grating scale sensor read-out system1(jw), it then, calculates and exports for the first time
Speed-error curve Δ Y1(jw)=Y1(jw)-Yd(jw);
Again by iterative learning control law, second of input U of system is calculated according to following formula2(jw);
Wherein, UrIt (jw) is the r times input of system, r=2,3,4 ...;Yr-1It (jw) is the r-1 times output of system, ρ
For Difference Terms proportionality coefficient;
Pass through second of output Y of grating scale sensor read-out system simultaneously2(jw), second of output then, is calculated
Speed-error curve Δ Y2(jw)=Y2(jw)-Yd(jw);
Judge that front and back obtains whether speed-error curve vibrates twice, if there is oscillation, is then once obtained rear
It inputs the feed forward input signal as system and otherwise calculates the input next time of system again by iterative learning control law,
And so on, stop iteration when speed-error curve vibrates;
S2.2.3, feed forward input signal is input in the speed outer ring of the bicyclic PID adjusted in step S2.1,
Complete iterative learning feedforward+PID/feedback control algolithm parameter tuning;
S3, judge subject current motion state
The realization of the function of motion state judgment module is completed by switch module, as shown in figure 4, to the fortune of subject
Dynamic speed V0First derivative is sought, obtains the acceleration a of subject, then by acceleration a compared with given threshold value ε, when | a | > ε
When, there are the errors outside an allowable error range for scanned object, and subject is in variable motion state at this time;When | a |
When≤ε, the acceleration of scanned object drifts about in zero crossings, and subject is in uniform speed motion state at this time;
Switching and handover optimization between S4, different motion state
In order to guarantee that the stability of system is not influenced by the handoff procedure of the Controlling model of system, the present invention devises one
A handover optimization module.The design of handover optimization signal is as shown in figure 5, in order to avoid feed-forward signal is when reaching switching critical points
It is unexpected that zero setting lead to the mutation of system model, to influence the stability of system.It is excellent track must to be carried out in the switching initial stage
Change.In view of two basic demands of handover optimization signal: the smooth transition of 1. realization switching critical points to zero.2. subtracting as far as possible
Small transit time reduces switching time of the system between two kinds of models.
Therefore the road handover optimization signal switching initial stage under switch module is selected brachistochrone by the present invention, that is,
Cycloid.Brachistochrone is well positioned to meet our requirements to handover optimization signal.By the phase between system critical state ε to 0
Mutual switching state is designed to that brachistochrone can be very good to solve caused system disturbance in System control structures handoff procedure and ask
Topic.The feed forward of acceleration module of handover optimization signal has been added to export as shown in Fig. 6, when system reaches critical switching state ε,
Feed-forward signal drops to zero along brachistochrone, until scanning process terminates.At this point, the output of feed forward of acceleration signal is zero.System
System is realized by feed forward of acceleration control to smoothly switching bicyclic PID control.
The detailed process of switching control is described in we below.
S4.1, when subject is in variable motion state, be switched to the control of feedforward control+PID/feedback, feedforward input
The structural block diagram of module is as shown in fig. 7, its basic thought is to be adjusted in an iterative process with the obtained data of preceding k iteration
The input quantity of+1 iteration of kth, specific control process are as follows:
S4.1.1, the initial input U for calculating system under this motion state0;
U0=Kp1*Kp2*Vs(0)+Ur(0)
Wherein, Kp1、Kp2For the proportionality coefficient of position inner ring and speed outer ring, Ur(0) at the beginning for feed forward input signal
The value at quarter, Vs(0) value carved at the beginning for desired rate curve;
S4.1.2, the acceleration feedback signal A that system under motion state is read by grating scale0(t), feedforward is then brought into
Control+PID/feedback control law, calculates the acceleration signal A (t) of system under this motion state;
ev(t)=A (t)-A0(t)
Wherein, Ki2For the integral coefficient of speed outer ring;
S4.1.3, step S4.1.1-S4.1.2 is repeated, real-time tracking is carried out to acceleration signal A (t), keeps system real-time
The rate curve of output reaches desired speed curve, to complete the control under the motion state;
S4.2, when subject is in uniform speed motion state, be switched to bicyclic PID control, specific control process are as follows:
S4.2.1, the initial input U for calculating system under this motion state0;
U0=Kp1*Kp2*Vs(0)
S4.2.2, the acceleration feedback signal A that system under motion state is read by grating scale0(t), it then brings into bicyclic
PID control rule, calculates the acceleration signal A (t) of system under this motion state;
ev(t)=A (t)-A0(t)
Wherein, Ki2For the integral coefficient of speed outer ring;
S4.2.3, step S4.2.1-S4.2.2 is repeated, real-time tracking is carried out to acceleration signal A (t), keeps system real-time
The rate curve of output reaches desired speed curve, to complete the control under the motion state.
In the present embodiment, whole control block diagram of the invention is as shown in Figure 8.By the method for the invention and one group of debugging
Good common bicyclic PID servo control method compares.Fig. 9 is traditional PID control and rate curve pair of the present invention
Than figure, Figure 10 is traditional PID control and speed-error curve comparison diagram of the present invention.As shown in Figure 9 and Figure 10.In variable motion rank
Section, the tracking error of control method of the present invention is significantly less than traditional PID control, and response speed has larger mention
It rises, solves the problems, such as the time lag of traditional PID control.In the uniform motion stage, control method of the present invention with
Track precision is also obviously promoted compared with traditional PID control.The results showed that the present invention passes through above design, motion servo
The dynamic property of system significantly improves, and reduces steady track error, meanwhile, the present invention also dramatically reduces movement and watches
The modeling difficulty of dress system, and disturbance bring model uncertainty can be tracked, tracking accuracy is improved, to make
Motion servo system can not only guarantee stability and corresponding rapidity, also make the output speed of motion servo system any
Moment can farthest reappear plans speed out.
Although the illustrative specific embodiment of the present invention is described above, in order to the technology of the art
Personnel understand the present invention, it should be apparent that the present invention is not limited to the range of specific embodiment, to the common skill of the art
For art personnel, if various change the attached claims limit and determine the spirit and scope of the present invention in, these
Variation is it will be apparent that all utilize the innovation and creation of present inventive concept in the column of protection.