DSPRelated.com
Forums

Kalman Filter to recover the Accelerometer Bias

Started by arvkr March 18, 2009
Back at the kalman filter again. This is what i am trying to do. I have
accurate distance measurement and i differentiate it with respect to time
twice to get Acceleration. Now i add a scale factor and bias to this
acceleration. I am able to recover scale no problem using kalman filter but
 bias of 0.09mg screws up the filter big time. Any idea what i am doing
wrong?
My State Variables are
x = [acc
     bias]
A = [1 0
     0 1]
H = [scaleFactor 1]

my measurement model i am assuming 
Measured Acc = True Acc * ScaleFactor + bias
u = 0
hence B doesn't matter

R = var(acc)
Q = lower than R



arvkr schrieb:
> Back at the kalman filter again. This is what i am trying to do. I have > accurate distance measurement and i differentiate it with respect to time > twice to get Acceleration. Now i add a scale factor and bias to this > acceleration. I am able to recover scale no problem using kalman filter but > bias of 0.09mg screws up the filter big time. Any idea what i am doing > wrong? > My State Variables are > x = [acc > bias] > A = [1 0 > 0 1] > H = [scaleFactor 1] > > my measurement model i am assuming > Measured Acc = True Acc * ScaleFactor + bias > u = 0 > hence B doesn't matter > > R = var(acc) > Q = lower than R > > >
The measurement function looks incomplete, since it only models the accelerometer but not the distance measurements. I am not sure what are you really doing there but a complete state model would also include the velocity and the distance. And you have to model the variance of the distance measurements as well. Sebastian
>The measurement function looks incomplete, since it only models the >accelerometer but not the distance measurements. I am not sure what are >you really doing there but a complete state model would also include the
>velocity and the distance. And you have to model the variance of the >distance measurements as well. > >Sebastian >
My assumption is i only have acceleration data and want to remove bias and scale from it. I am trying to duplicate what i get out of an accelerometer and hence no velocity and position in it
On Wed, 18 Mar 2009 13:31:05 -0500, arvkr wrote:

> Back at the kalman filter again. This is what i am trying to do. I have > accurate distance measurement and i differentiate it with respect to > time twice to get Acceleration. Now i add a scale factor and bias to > this acceleration. I am able to recover scale no problem using kalman > filter but > bias of 0.09mg screws up the filter big time. Any idea what i am doing > wrong? > My State Variables are > x = [acc > bias] > A = [1 0 > 0 1] > H = [scaleFactor 1] > > my measurement model i am assuming > Measured Acc = True Acc * ScaleFactor + bias u = 0 > hence B doesn't matter > > R = var(acc) > Q = lower than R
Try modeling your system with velocity, position, and accelerometer bias. Then just follow one of the Kalman recipes step-by-step. Remember, the idea is to take a model of your idealized system (which does _not_ have acceleration as a state!!) and compare it to actual measurements (the position), and use that to update your state estimates. The only trick is that you have to take the accelerometer output as an input to your system model. -- http://www.wescottdesign.com
>Try modeling your system with velocity, position, and accelerometer >bias. Then just follow one of the Kalman recipes step-by-step. > >Remember, the idea is to take a model of your idealized system (which >does _not_ have acceleration as a state!!) and compare it to actual >measurements (the position), and use that to update your state
estimates.
> >The only trick is that you have to take the accelerometer output as an >input to your system model. > >-- >http://www.wescottdesign.com >
My actual measurements are not position but acceleration. Hence i was trying to do what i did. Assuming i only have acceleration measurements,i am trying to remove the bias and scale factor i added to it before the kalman filter. I don't want to include position or velocity since i won't have an accurate measurement of them in my live system, hence i am trying to create a similar scenario
On Thu, 19 Mar 2009 07:17:47 -0500, arvkr wrote:

>>Try modeling your system with velocity, position, and accelerometer >>bias. Then just follow one of the Kalman recipes step-by-step. >> >>Remember, the idea is to take a model of your idealized system (which >>does _not_ have acceleration as a state!!) and compare it to actual >>measurements (the position), and use that to update your state > estimates. >> >>The only trick is that you have to take the accelerometer output as an >>input to your system model. >> >>-- >>http://www.wescottdesign.com >> >> > My actual measurements are not position but acceleration.
"I have accurate distance measurement" Make up your mind.
> Hence i was > trying to do what i did. Assuming i only have acceleration > measurements,i am trying to remove the bias and scale factor i added to > it before the kalman filter.
Then you're screwed. If you have N sensors, you'll get N independent measurements, and you want to know 2 * N values. Can't be done. Go back to square one. Get more sensors. Etc.
> I don't want to include position or > velocity since i won't have an accurate measurement of them in my live > system, hence i am trying to create a similar scenario
Perhaps it is time to stop consulting engineering types, who, after all, can only do the physically possible, and go looking for magicians? -- http://www.wescottdesign.com
> >Perhaps it is time to stop consulting engineering types, who, after all,
>can only do the physically possible, and go looking for magicians? >
Alright, i guess i wasn't clear or you didn't understand my problem. What i am trying to do is simulate what i will get from an Accelerometer which say has scale,bias error + noise. I was trying to do reverse ENGINEERING to see if kalman filter will identify and remove the added bias and scale factor. For the simulation, i have a distance measure ( from a distance sensor i have now but won't have in the future when i only have accelerometer), so i differentiated w.r.t twice to get acceleration, then added scale factor and a bias + assumed noise as the variance of this simulated scale factor and bias added acceleration to make it similar to what i will get from an accelerometer which has white noise . Now i have a simulated acceleration measurement which has scale and bias and i want to use kalman filter to remove them, isn't that still engineering? The measurements are the simulated measurements. hence state vector x = [ acc bias] my h(x) = scaleFactor * acc + bias my H matrix the partial differentiation would be H = dh(x)/dx = [ scale Factor 0] A = [1 1 0 1] R = var( simulated acc) Q = some value lesser than R Starting Values of State vector = [0 sensor's bias from the datasheet] starting covariance Psub0 = Q Why can't i do this?
arvkr wrote:
>> Try modeling your system with velocity, position, and accelerometer >> bias. Then just follow one of the Kalman recipes step-by-step. >> >> Remember, the idea is to take a model of your idealized system (which >> does _not_ have acceleration as a state!!) and compare it to actual >> measurements (the position), and use that to update your state > estimates. >> The only trick is that you have to take the accelerometer output as an >> input to your system model. >> >> -- >> http://www.wescottdesign.com >> > > My actual measurements are not position but acceleration. Hence i was > trying to do what i did. Assuming i only have acceleration measurements,i > am trying to remove the bias and scale factor i added to it before the > kalman filter. I don't want to include position or velocity since i won't > have an accurate measurement of them in my live system, hence i am trying > to create a similar scenario
There is no way to remove the bias without estimating its magnitude. That in turn requires at least periodic knowledge of location. You want to do magic; science is no help. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On Mar 19, 7:54&#4294967295;am, "arvkr" <krarv...@gmail.com> wrote:
> >Perhaps it is time to stop consulting engineering types, who, after all, > >can only do the physically possible, and go looking for magicians? > > Alright, i guess i wasn't clear or you didn't understand my problem. What > i am trying to do is simulate what i will get from an Accelerometer which > say has scale,bias error + noise. I was trying to do reverse ENGINEERING to > see if kalman filter will identify and remove the added bias and scale > factor. > > &#4294967295;For the simulation, i have a distance measure ( from a distance sensor i > have now but won't have in the future when i only have accelerometer), so i > differentiated w.r.t twice to get acceleration, then added scale factor and > a bias + assumed noise as the variance of this simulated scale factor and > bias added acceleration to make it similar to what i will get from an > accelerometer which has white noise . > > Now i have a simulated acceleration measurement which has scale and bias > and i want to use kalman filter to remove them, isn't that still > engineering? The measurements are the simulated measurements. > > hence state vector x &#4294967295;= [ acc > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; bias] > &#4294967295;my h(x) = scaleFactor * acc + bias > my H matrix the partial differentiation would be > H = dh(x)/dx = [ scale Factor 0] > A = [1 1 > &#4294967295; &#4294967295; &#4294967295;0 1] > R = var( simulated acc) > Q = some value lesser than R > > Starting Values of State vector = [0 > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;sensor's bias from the datasheet] > starting covariance Psub0 = Q > > Why can't i do this?
In kalman filtering, the H matrix is the observation model and contains only things you know. It can't contain things you are trying to estimate. To convince yourself on this point, look at the Kalman update equations, and you will see that the H matrix only appears on the right-hand side, and that there is no equation which provides an updated value for the H matrix. Here, your H matrix contains the accelerometer's scale factor, which is one of your unknowns. This seems wrong. Frankly, I don't see how you are able to "recover" the scale factor using Kalman filtering and the equations you have showed. Maybe you are doing something extra that you have not yet told us about. As one pointer, and as others here have stated, you need to model your system's state more completely. A typical model here would include all of position, velocity and acceleration. Everyone here understands that your measurement is position (or you are simulating this) and that you are not measuring acceleration (which is the conceptual direction that you are headed towards). You misunderstand the function of the state model is to interrelate the true system state (which is hidden) from observable measurements. You are therefore trying to manufacture faked measurements of acceleration from actual measurements of position, using double differentiation. That's wrong. Don't manufacture measurements. Use your actual measurements of position as input to the Kalman filter, without modification. Design your state model so that the model performs integration for you, from acceleration up through position. One informative example of this is found in the Wikipedia article, which gives the example of a position measurement to estimate both position and velocity. See http://en.wikipedia.org/wiki/Kalman_Filter#Examples In your case, if you try to model your system as including all of position, velocity, acceleration, scale factor and bias, you will end up with a model that is non-linear. Plain-vanilla Kalman filtering can't solve that. You can try the non-linear extension, but this is probably more complicated than the effort is worth. Instead, you might try a two-step process. In the first, pre- operation there is a calibration phase, where you calibrate scale factor and bias using known accelerations, e.g., standing still on an inclined plane gives bias plus scale factor, standing still on the same inclined plane but facing the other direction gives bias minus scale factor. A Kalman filter might not be needed here. In the second phase, you use these derived values as constants, in a Kalman filter that models all of position, velocity and acceleration, based on measurements of position data and measurements of accelerometer data. The latter have been corrected by the calibration constants derived in the calibration phase.
>In the second phase, you use these derived values as constants, in a >Kalman filter that models all of position, velocity and acceleration, >based on measurements of position data and measurements of >accelerometer data. The latter have been corrected by the calibration >constants derived in the calibration phase.
Yes if you do the above, what would the matrices be would it be A = [1 &Delta;t &Delta;t^2/2 0 1 &Delta;t 0 0 1 ] H = [ 1 0 1] x = [ pos vel acc] Q = [nonZero 0 0 0 nZ 0 0 0 nZ] Z = [ measDist 0 callibAcc]