From: raffaello on
Hi

The problem i'm trying to face is to filter the accelerometer noise using a
kalman filter without any other input. I'm new to kalman filter and i don't
know exactly how to model and develop such a filter. As a first attempt i
tried to describe the problem as follows:

(p = position, v = velocity, a = acceleration, dt = time delta)
|p|
xhat_k = |v|
|a|

|1 dt dt^2/2|
phy_k = |0 1 dt | \\updated with the time delta
|0 0 1 | \\between two sensor readings

H = |0 0 1|

Q = process model covariance matrix

R = measerement covariance matrix

\\a priori estimate
xhat_k^- = phy_k-1 * xhat_k-1 \\a priori state
P_k^- = phy_k-1 * P_k-1 * phy_k-1^t + Q \\a priori covariance matrix

\\measurement update
z_k = measured acceleration
K_k = P_k^- H^t (H P_k^- H^t + R)^-1


\\a posteriori estimate
xhat_k = xhat_k^- + K_k(z_k - Hxhat_k^-)
P_k = (I – K_k H)P_k^-


Using this model i got a result still affected by noise. Did i make some
mistakes in the model?

Thanks for your help!




From: Tim Wescott on
On 06/24/2010 05:15 AM, raffaello wrote:
> Hi
>
> The problem i'm trying to face is to filter the accelerometer noise using a
> kalman filter without any other input. I'm new to kalman filter and i don't
> know exactly how to model and develop such a filter. As a first attempt i
> tried to describe the problem as follows:
>
> (p = position, v = velocity, a = acceleration, dt = time delta)
> |p|
> xhat_k = |v|
> |a|
>
> |1 dt dt^2/2|
> phy_k = |0 1 dt | \\updated with the time delta
> |0 0 1 | \\between two sensor readings

This is the model for a 3rd-order system, which presumably takes jerk as
an input.

> H = |0 0 1|

And acceleration as an output, with velocity and position being clearly
unobservable.

> Q = process model covariance matrix
>
> R = measerement covariance matrix
>
> \\a priori estimate
> xhat_k^- = phy_k-1 * xhat_k-1 \\a priori state
> P_k^- = phy_k-1 * P_k-1 * phy_k-1^t + Q \\a priori covariance matrix
>
> \\measurement update
> z_k = measured acceleration
> K_k = P_k^- H^t (H P_k^- H^t + R)^-1
>
>
> \\a posteriori estimate
> xhat_k = xhat_k^- + K_k(z_k - Hxhat_k^-)
> P_k = (I – K_k H)P_k^-
>
>
> Using this model i got a result still affected by noise. Did i make some
> mistakes in the model?

At best what you are going to get with this construction is a 1st-order
lowpass filter of your accelerometer output, that wastes a bunch of
computation time on two states that it never uses.

So back off a bit, and tell us more: What are you _really_ doing? Why
do you want to filter your accelerometer output? What information do
you want to end up with?

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: raffaello on
Hi,

thanks for your reply. What i want to do is to track the position of a
smartphone. I have a Motorola Milestone(this is the model
http://developer.motorola.com/products/milestone/ ) which contains a
LIS331DLH 3-axes accelerometer.
I tried to use the pure accelerometers output to estimate the position of
the device but there is to much noise and, if i leave my phone motionless
on the table, the accelerometers give me a non zero value.

How should i use the sensors of the smartphone to track its position?
How should i correct my kalman filter to filter the accelerometers noise
and to estimate the correct position of the phone?

Thanks!

R. B.

From: Tim Wescott on
On 06/24/2010 11:32 AM, raffaello wrote:
> Hi,
>
> thanks for your reply. What i want to do is to track the position of a
> smartphone. I have a Motorola Milestone(this is the model
> http://developer.motorola.com/products/milestone/ ) which contains a
> LIS331DLH 3-axes accelerometer.
> I tried to use the pure accelerometers output to estimate the position of
> the device but there is to much noise and, if i leave my phone motionless
> on the table, the accelerometers give me a non zero value.
>
> How should i use the sensors of the smartphone to track its position?
> How should i correct my kalman filter to filter the accelerometers noise
> and to estimate the correct position of the phone?

There was a long thread on this topic recently; just replace "iPhone"
with "Motorola Milestone" and you'll get the gist of it.

http://www.dsprelated.com/showmessage/127160/1.php

I don't think you can get there from here with the sensors you have
available -- but all the arguments have already been hashed out there.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: pnachtwey on
On Jun 24, 10:04 am, Tim Wescott <t...(a)seemywebsite.now> wrote:
> On 06/24/2010 05:15 AM, raffaello wrote:
>
> > Hi
>
> > The problem i'm trying to face is to filter the accelerometer noise using a
> > kalman filter without any other input. I'm new to kalman filter and i don't
> > know exactly how to model and develop such a filter. As a first attempt i
> > tried to describe the problem as follows:
>
> > (p = position, v = velocity, a = acceleration, dt = time delta)
> >           |p|
> > xhat_k = |v|
> >           |a|
>
> >          |1   dt  dt^2/2|
> > phy_k = |0   1     dt  |   \\updated with the time delta
> >          |0   0     1   |   \\between two sensor readings
>
> This is the model for a 3rd-order system, which presumably takes jerk as
> an input.
This looks like a second order model to me.
Examples can be found in you Dan Simon book.

Peter Nachtwey