Reply by JCH June 25, 20102010-06-25

"raffaello" <rbrondi@n_o_s_p_a_m.gmail.com> schrieb im Newsbeitrag
news:xYidndsSFurZ0b7RnZ2dnUVZ_t6dnZ2d@giganews.com...
> 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 &ndash; K_k H)P_k^- > > > Using this model i got a result still affected by noise. Did i make some > mistakes in the model? >
Maybe this could solve your problem: a = acceleration v = velocity p = position a = dp^2/dt^2 Numerically change to difference equation a_i = (p_i+1 - 2 * p_i + p_i-1) / h ^ 2 h = dt EXAMPLE << Solved by Gaussian Method >> 8 Equations: ((p_2 - 2 * p_1 + p_0) / h ^ 2) - a_1 = 0 ((p_3 - 2 * p_2 + p_1) / h ^ 2) - a_2 = 0 ((p_4 - 2 * p_3 + p_2) / h ^ 2) - a_3 = 0 ((p_5 - 2 * p_4 + p_3) / h ^ 2) - a_4 = 0 ((p_6 - 2 * p_5 + p_4) / h ^ 2) - a_5 = 0 ((p_7 - 2 * p_6 + p_5) / h ^ 2) - a_6 = 0 ((p_8 - 2 * p_7 + p_6) / h ^ 2) - a_7 = 0 ((p_1 - p_0) / h) - v_0 = 0 Known Values a_1 = 10 a_2 = 50 a_3 = 70 a_4 = -90 a_5 = -45 a_6 = -30 a_7 = 80 h = 1 p_0 = 0 'Start Values v_0 = 0 Solution p_1 = 0 p_2 = 10 p_3 = 70 p_4 = 200 p_5 = 240 p_6 = 235 p_7 = 200 p_8 = 245 JCH
Reply by Tim Wescott June 25, 20102010-06-25
On 06/24/2010 07:09 PM, Randy Yates wrote:
> Tim Wescott<tim@seemywebsite.now> writes: > >> 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. > > Right - you need rate sensors as well as linear.
And -- unless you're going to subject the thing to some pretty odd gyrations -- much better rate sensors than you'll find in a cruddy old phone. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by Randy Yates June 24, 20102010-06-24
Tim Wescott <tim@seemywebsite.now> writes:

> 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.
Right - you need rate sensors as well as linear. -- Randy Yates % "She has an IQ of 1001, she has a jumpsuit Digital Signal Labs % on, and she's also a telephone." mailto://yates@ieee.org % http://www.digitalsignallabs.com % 'Yours Truly, 2095', *Time*, ELO
Reply by Tim Wescott June 24, 20102010-06-24
On 06/24/2010 03:52 PM, pnachtwey wrote:
> On Jun 24, 10:04 am, Tim Wescott<t...@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.
It has three states, arranged as a cascade of three integrators. If you're modeling motion with an acceleration for an input then you probably do want two states -- but that's not what this model has. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by pnachtwey June 24, 20102010-06-24
On Jun 24, 10:04&#4294967295;am, Tim Wescott <t...@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) > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; |p| > > xhat_k = |v| > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; |a| > > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;|1 &#4294967295; dt &#4294967295;dt^2/2| > > phy_k = |0 &#4294967295; 1 &#4294967295; &#4294967295; dt &#4294967295;| &#4294967295; \\updated with the time delta > > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;|0 &#4294967295; 0 &#4294967295; &#4294967295; 1 &#4294967295; | &#4294967295; \\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
Reply by Tim Wescott June 24, 20102010-06-24
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
Reply by raffaello June 24, 20102010-06-24
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.

Reply by Tim Wescott June 24, 20102010-06-24
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 &ndash; 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
Reply by raffaello June 24, 20102010-06-24
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 &ndash; 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!