Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

how to decimate encoder derivative velocity

Hello, I'm working with a Maxon quadrature encoder and an E-series PCI card.  Due to the limited capabilities of my hardware for motion control, I am counting encoder pulses and estimating velocity from the derivative of the pulse count.  I would like to deal with the significant quantization error of this calculated velocity (see rawVel.jpg).  Rather than lowpass (or other) filtering, I would like to downsample or decimate the array of calculated velocities, perhaps by as much as a factor of 100.  Simply decimating the array leaves zero values, however, as you can see in the attached image (Decdzeros.jpg).  I think I would like to fill these zero values with an average of the leading and trailing velocity values.  In other words, if the decimated array looks like:

 

3000000004000000005

 

I would like

 

3 3.5 3.5 3.5 3.5 3.5 3.5 3.5 3.5 4 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 5 

 

or something like this, maybe even a more sophisticated averaging or weighting scheme.  Am I describing some other filtering scheme that is easily implemented?

 

Please see the attached VI.  Eventually, this velocity is going to be the measured variable in a PID control loop, so I would like to clean up the signal as much as possible.  I would also like the loop to run as quickly as possible because of the PID control.  Problem is, I just don't need to sample my velocity at such a high frequency.

 

I know that I could use the measure period VI to detect velocity from my encoder with this e-series board, but I would also like position, and I haven't been able to simultaneously count pulses and measure pulse period, I believe because of the STC counter on this E-series board.

 

Any help is appreciated!

Download All
0 Kudos
Message 1 of 2
(6,212 Views)

Hello Brian,

 

I'm a little confused on your question, especially the quantization error. Quantization error normally deals with converting an analog signal to a digital signal and the error the is induced there. I was wondering if you could give me a little more information about that. Also I think your best bet might just be to average out your values that you have. So you could use shift register to average every 5 values. Have a great day!

 

Best Regards,

 

Adam G 

National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(6,188 Views)