## Help for Kalman filter to combine encoder and delayed gyrometer measurements

Started by 5 years ago2 replieslatest reply 5 years ago220 views

Hi,

I am currently working on a direct drive haptic pedal project which requires real time position and velocity measurements.

To reach highest rate, I am currently using TI Tiva-C 123gxl launchpad which has quadrature encoder interface. I am using encoder to measure angular position of the pedal and MPU6050 gyroscope for angula velocity.

Even though the measurements are consistent with encoder and gyroscope, I have read from the datasheet and realized that there is 2ms delay in the gyroscope measurements, which corresponds to 2 samples of delay in my case.

I am trying to combine these measurements using Kalman filter. I have tried the measurements for different models, and effect of the delay can be seen on them. I am trying to achive minimum delay.

My question is that, is there a way to handle the delay in real time or should I look for another gyroscope IC which causes less delay in the measurements?

[ - ]

Hi,

For what it is worth find comment below...

I happened to have the spec sheet for the MPU9250 lying around.  The accelerometer and gyro parts are quite similar to the MPU6050 I believe.

I understand you are operating at 1 kHz rate.  You can switch off the anti aliasing filter have low delay (0.17 ms) at the cost of the aliased noise.  Maybe you can use the Kalman filter to recognise actual signal content from noise by combination with the encoder sig. I expect that will pose some delays as well.

Other option is to increase your sampling speed.  The MPU9250 can operate up to 32 kHz with bandwidth of 8800 Hz.  Delay 0.064 ms.  The low delay goes at the cost of the higher number of samples.  You would still need to some filtering if you want to run main processing loop in lower speed. It will cost CPU load for the processor.  But you have more freedom to choose in comparison to the options provides by the MPU.

Cheers,

Jk

[ - ]
Model the delay in your Kalman filter.  If it's really exactly two samples, it should be easy -- just put two stages of pure delay into the system model (your $$A$$ matrix or $$F$$ matrix, depending on whose text you're reading), then turn the crank on your Kalman calculations.  I suspect it'll be more complicated -- but if it's linear, then you still ought to be able to model it in your system model.
Alternately, if you can crack the gyro speed up like joko37 says, you can sample at 32kHz, then sum up 32 samples for each $$1 \mathrm{ms}$$ interval of your "real" sampling.  You'll still need to model this in your Kalman system design, but it may end up with better overall performance.