Forums

Multiple Sample Rates

Started by Unknown October 7, 2018
I have a Kalman filter which estimates pitch and roll for a stabilised platform. It is a steady-state kalman filter so no great computational overload - I calculate the gain matrix first and then go into the while loop forever. In the loop there is also controllers Lag lead PI type. To get a high bandwidth I sample at 10kHz overall but I am finding that the Kalman filter doesn't need anything like this rate. Therefore could I have a concurrent loop with it running ad just use the pitch and roll estimates to feed into a second faster loop? I was thinking that this doesn't make sense but might if it were the other way around ie the KF fast and the main loop slower - but I cannot do that. The reason for a slower sample rate on the KF is that its poles are dangerously near the edge of the unit circle. I haven't had instability from it due to rounding but to be safer I would like to run it ta a lower sampling rate. I think this is possible because the KF does not depend on the load dynamics or mechanical system, it's just a means of getting pitch from a 6 axis gyro and accelerometer.
IIRC it is possible to run multiple prediction steps and then run one update steps.

So basically, you would predict at 10 kHz but update the kalman filter at say 1 kHz. However, if you think you have quantization issues with your poles, it might not help you...

Have you analyzed if your matrices are ill-conditionned in Matlab/Octave/Python/etc. ?
On Wednesday, October 10, 2018 at 2:50:32 AM UTC+13, benjamin....@gmail.com wrote:
> IIRC it is possible to run multiple prediction steps and then run one update steps. > > So basically, you would predict at 10 kHz but update the kalman filter at say 1 kHz. However, if you think you have quantization issues with your poles, it might not help you... > > Have you analyzed if your matrices are ill-conditionned in Matlab/Octave/Python/etc. ?
It's because of the sample rate. If I reduce the sample rate the poles become manageable. At high sample rates they migrate close to the unit circle. Yes, in Matlab. ikHz sampling is fine for the Kalman filter I suppose but it is practicalities - that means I am getting only one sample instead of 10 for an angle measurement per one sample of the control loop.
Le mercredi 10 octobre 2018 00:00:01 UTC-4, gyans...@gmail.com a écrit :
> On Wednesday, October 10, 2018 at 2:50:32 AM UTC+13, benjamin....@gmail.com wrote: > > IIRC it is possible to run multiple prediction steps and then run one update steps. > > > > So basically, you would predict at 10 kHz but update the kalman filter at say 1 kHz. However, if you think you have quantization issues with your poles, it might not help you... > > > > Have you analyzed if your matrices are ill-conditionned in Matlab/Octave/Python/etc. ? > > It's because of the sample rate. If I reduce the sample rate the poles become manageable. At high sample rates they migrate close to the unit circle. Yes, in Matlab. ikHz sampling is fine for the Kalman filter I suppose but it is practicalities - that means I am getting only one sample instead of 10 for an angle measurement per one sample of the control loop.
What makes you think your pole are not manageable? Just being close to the unit circle does not mean it is not manageable.
On Thursday, October 11, 2018 at 2:08:18 AM UTC+13, benjamin....@gmail.com wrote:
> Le mercredi 10 octobre 2018 00:00:01 UTC-4, gyans...@gmail.com a écrit : > > On Wednesday, October 10, 2018 at 2:50:32 AM UTC+13, benjamin....@gmail.com wrote: > > > IIRC it is possible to run multiple prediction steps and then run one update steps. > > > > > > So basically, you would predict at 10 kHz but update the kalman filter at say 1 kHz. However, if you think you have quantization issues with your poles, it might not help you... > > > > > > Have you analyzed if your matrices are ill-conditionned in Matlab/Octave/Python/etc. ? > > > > It's because of the sample rate. If I reduce the sample rate the poles become manageable. At high sample rates they migrate close to the unit circle. Yes, in Matlab. ikHz sampling is fine for the Kalman filter I suppose but it is practicalities - that means I am getting only one sample instead of 10 for an angle measurement per one sample of the control loop. > > What makes you think your pole are not manageable? Just being close to the unit circle does not mean it is not manageable.
Well, they do appear to be stable at least. Maybe you are right. I have to use double precision to see them however in Matlab otherwise it thinks they are unstable. Gd = c2d(Gc,Ts)
>> pole(Gd)
ans = 0.996844980367785 + 0.000119621398273i 0.996844980367785 - 0.000119621398273i
>> abs(pole(Gd))
ans = 0.996844987545069 0.996844987545069