A kind of processing method and system of smoothed data
Technical field
The present invention relates to technical field of robot control, more particularly to a kind of processing method and system of smoothed data.
Background technology
The smoothing processing of data, for the digital display circuit with the presence of interference is very important, is the premise of data statisticss and analysis,
It is a most loaded down with trivial details link in information system.Existing hardware is smoothed, as the elements such as resistance to be used, electric capacity, inductance come
Circuit is built, the problems such as considering impedance matching is needed, and limited precision, element used is to voltage, temperature, noise-sensitive.
Hardware element intercouples, and produces interference signal, unfavorable to original signal.
The content of the invention
For the deficiencies in the prior art, the present invention provides a kind of processing method and system of smoothed data.A kind of place of smoothed data
Reason method includes:Gather and preserve the operational factor of motor;The operational factor of motor is carried out into smoothed data process, obtains new
Sampled value;New sampled value is sent to into motor after the calculating of three rings, the closed loop control to motor is realized.
Preferably, the operational factor includes the positional value of current value, velocity amplitude and the code-disc of motor feedback.
Preferably, the operational factor of motor is carried out into smoothed data process, obtains new sampled value, specially:The electricity that will be preserved
The maximum of machine operational factor and minima are deleted;Adjustment filter factor;Judge the change of gathered data whether towards same side
To;When the change of gathered data is towards same direction, judge difference between this sampled value and last time filter result whether
More than the threshold value for arranging;If greater than the threshold value for arranging, then when filter factor and Filter Counter increment and be more than enumerator
After maximum, wave filter maximum is taken, obtain the filter factor after data processing;Obtain new according to the filter factor after process
Sampled value.
Preferably, whether the change for judging gathered data is specially towards same direction:If double sampling knot
When fruit is big than previous filter result, then it is assumed that the change direction of gathered data is consistent twice, now Filter Counter
Value Jia 1.
Preferably, when whether the difference between this sampled value and last time filter result is more than the threshold value for arranging, then wave filter is counted
The value of device adds 2.
The present invention also provides a kind of smoothed data processing system, including control module, data acquisition module, drive module, coding
Device, motor, data acquisition module is for the velocity amplitude from motor and encoder collection motor, positional value and current value;The control
Data after process for being smoothed to the signal that data acquisition module is collected, and are carried out three ring calculating by molding block,
Result is sent to into motor by drive module;
Preferably, the control module includes memory module, coefficient adjustment module and computing module, and the memory module stores number
Maximum in module and minima are cast out after data receiver by the data collected according to acquisition module;Coefficient adjustment module is used for root
Filter factor is adjusted according to the result of data sampling, obtains new sampled value;Computing module is for new sampled value is carried out
Three rings are sent to motor by drive module after calculating, and realize the closed loop control to motor.
Beneficial effects of the present invention are:Adopt with the aforedescribed process, the electric current of motor collection, position, velocity information are carried out into data
Control module is passed to after smoothing processing carries out closed loop control, can effectively reduce the disturbing signal that hardware interference brings, filter nothing
Burr, makes sampled result closer to the control more excellent to motor when true, is reached, improves motor operation performance, increase
Traveling comfort.So that robot can run it is more stable.
Description of the drawings
Process flow figures of the Fig. 1 for a kind of smoothed data of one embodiment of the invention.
Methods of adjustment of the Fig. 2 for one embodiment of the invention filter factor.
Fig. 3 is a kind of smoothed data processing system structure chart of the embodiment of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawings the specific embodiment of the present invention is described further.
Embodiment one
The present invention provides a kind of processing method of smoothed data, comprises the steps:
S10:Gather and preserve the operational factor of motor.
The motor code-disc operational factor includes the positional value of current value, velocity amplitude and the code-disc of motor feedback.
S20:The operational factor of motor is carried out into smoothed data process, new sampled value is obtained.
S30:New sampled value is sent to into motor after the calculating of three rings, the closed loop control to motor is realized.
Embodiment two
The present invention provides a kind of processing method of smoothed data, comprises the steps:
S10:Gather and preserve the operational factor of motor.
The motor code-disc operational factor includes the positional value of current value, velocity amplitude and the code-disc of motor feedback.
S20:The operational factor of motor is carried out into smoothed data process, new sampled value is obtained.
Specifically include:
S201:The maximum and minima of the motor operating parameter for preserving are deleted.
The memory space of one regular length is set, for caching the motor operating parameter of collection, casts out the maximum in memory space
Value and minima, are considered as interference signal.
S202:Adjustment filter factor.
Filter factor is calculated according to formula (1).
In above-mentioned formula, α is filter factor, and span is 0-1, and T is delay time, TsFor the sampling period.
S203:Judge the change of gathered data whether towards same direction.
First, it is determined that whether the change of the motor operating parameter of collection is towards same direction, if double sampled result
When big than previous filter result, then it is assumed that the change direction of gathered data is consistent twice, and the weights of new sampled value are improved,
The value of Filter Counter adds 1, continues executing with step S24.Otherwise it is assumed that change direction is inconsistent, show that gathered data has shake,
The technology of wave filter is reset, new sampled value is ignored.
S204:Judge the difference between this sampled value and last time filter result whether more than the threshold value for arranging.
When whether the difference between this sampled value and last time filter result is more than the threshold value for arranging, show that data variation is very fast,
Now, filter factor is improved, the value of Filter Counter adds 2.
S205:When filter factor and Filter Counter increment and after more than enumerator maximum, take wave filter maximum, obtain
Obtain the filter factor after data processing.
S206:New sampled value is obtained according to the filter factor after process.
Specific formula for calculation is:
Yn=αXn+(1-α)Yn-1 (2)
In above-mentioned formula, α is filter factor, and span is 0-1, XnIt is new sampled value, Yn-1It is last time filter result,
YnFor this filter result.
It should be noted that filter factor determines the shared weight in this filter result of new sampled value.When filter factor it is less
When, the algorithm of data smoothing process can filter some accidental interference, and filter result is highly stable, but sensitivity is low, when
When input data occurs very fast change, filter result needs progressively keep up with the change of input through repeatedly filtering, thus, with
Die down with performance.When filter factor takes intermediate value, the result of data smoothing process and sensitivity take intermediate value, and performance is common,
Filter result is more smoother than sampled data, but can not eliminate the impact of interference value.When filter factor takes it is larger when, data put down
The sliding result for processing is with no longer obvious.
Because sensitivity and smoothness are conflicting, need to find a balance, in the system acceptable range of sensitivity
It is interior to obtain smoothness as well as possible.When data quickly change, filter result is required to track input signal in time, sensitive
Degree is even more important;When data input variation tendency is steady, when a fixing point is fluctuated up and down, filter result is preferential with smoothness.
For more preferable smoothed data, design dynamic adjustment filter factor, and the number of significant digit of growth data.Adjustment principle is:
When data quickly change, filter result can track input signal in time, and the Significant Change of input data is faster, system
Sensitivity also should be increased therewith, take sensitivity preferential principle;When data tendency it is steady, and in upper and lower certain particular range
During fluctuation, filter result needs to tend to be steady, with smoothness preferential principle;After data stabilization, filter result can be approached simultaneously
Eventually equal to sampled data, eliminates because decimal casts out the error brought.
S30:New sampled value is sent to into motor after the calculating of three rings, the closed loop control to motor is realized
Embodiment three
Present invention also offers a kind of processing system of smoothed data, as shown in Figure 3, the system includes control module 10, number
According to acquisition module 20, drive module 30, encoder 40, motor 50.Communication connection between each module.
Wherein, data acquisition module 20 is for from motor 50 and the collection velocity amplitude of motor of encoder 40, positional value and current value,
And by the data is activation of collection to control module 10.The data acquisition module 20 is a FPGA.
The control module 10, for being smoothed to the signal that data acquisition module 20 is collected.And by after process
Data carry out three ring calculating, and the result of calculating is sent to motor 50 by drive module 30.Wherein, control module 10 includes depositing
Storage module 11, coefficient adjustment module 12 and computing module 13.11 data storage acquisition module 20 of the memory module is collected
Data, the data include positional value, current value and the velocity amplitude of code-disc.By maximum in module and minimum after data receiver
Value is cast out.
Coefficient adjustment module 12 is adjusted to filter factor for the result according to data sampling.The coefficient adjustment module 12
Including walking direction module 121, difference judge module 122, numerical value judge module 123 and sampled value acquisition module 124.Direction
Whether judge module 121 is used for the data variation for judging double sampling towards same direction, if double sampled result
When big than previous filter result, then it is assumed that the change direction of gathered data is consistent twice, and the weights of new sampled value are improved,
The value of Filter Counter adds 1.Difference judge module 122 is for when the data variation direction of double sampling is consistent, judging to adopt
Difference between sample value and last time filter result, during if greater than the threshold value for arranging, shows that data variation is very fast, now, will filter
Wave system number is improved, and the value of Filter Counter adds 2.Numerical value judge module 123 is used to judge filter factor and Filter Counter
Increment and whether be more than enumerator maximum, such as larger than then take wave filter maximum, obtain the filter factor after data processing.
Sampled value acquisition module 124 is for according to the new sampled value of the filter factor acquisition after process.
, for carrying out being sent to motor 50 by drive module 30 after three ring calculating new sampled value, it is right to realize for computing module 13
The closed loop control of motor 50.
Merely illustrating the principles of the invention described in above-described embodiment and description and most preferred embodiment, without departing from essence of the invention
On the premise of god and scope, the present invention also has various changes and modifications, and these changes and improvements both fall within this claimed
In bright scope.