DSPRelated.com
Forums

Kalman filter to smooth accelerometer signals using rotation matrix

Started by sia4uin April 20, 2015
Hello All

First post to this group!

I have 3D accelerometer signals which are obviously noisy. I want to use
Kalman filter to remove the noise.

I can also use a moving average filter and it will be fine but how can I
use Kalaman filter to smooth these signals?

regards

sia


---------------------------------------
Posted through http://www.DSPRelated.com
On Mon, 20 Apr 2015 14:43:49 -0500, sia4uin wrote:

> Hello All > > First post to this group! > > I have 3D accelerometer signals which are obviously noisy. I want to use > Kalman filter to remove the noise. > > I can also use a moving average filter and it will be fine but how can I > use Kalaman filter to smooth these signals?
If your question makes just as much or more sense when you replace the word "Kalman" with the word "magic", then it is based on a deep lack of understanding of what Kalman filters do. Kalman, and similar state-estimation filters are based on using knowledge about the behavior of some system, plus measurements of the system's output, to estimate the states of the system. At the very minimum, before you can use state estimation techniques you have to understand what your system is and at least have a general idea of what it does. If you want a sensible answer, please include some information about your system, perhaps including why you think that using a rotation matrix will be of help and, indeed, just what the rotation matrix is supposed to represent (and a response of "well, rotation of course!" is totally inadequate -- in case you were wondering). -- www.wescottdesign.com
Hello Tim,

Thanks for your reply. I am currently working on an Android application
for tracking a user.

I joined the project team late (this is not an excuse though :) ) and the
idea is that the rotation matirx is available to us from the device itself
which provides accurate orientation information. 

Now, this is the first time I will be working with Accelerometers and
Gyros. The acceleration signals look noisy, so the boss asked me to use
Kalman filter and use Rotation matrix as an extra input to the Kalman
filter. (I only know that Rotation matrix is used to convert signals from
Device frame to World frame).

So I thought to use a moving average filter or an auto-regressive filter
to remove high frequency component.

The ultimate goal is to filter acceleration signals and remove any drift
or bias from it.

I would appreciate if you could please point me in right direction.

regards

Sia 

>If your question makes just as much or more sense when you replace the >word "Kalman" with the word "magic", then it is based on a deep lack of > >understanding of what Kalman filters do. > >Kalman, and similar state-estimation filters are based on using >knowledge >about the behavior of some system, plus measurements of the system's >output, to estimate the states of the system. At the very minimum, >before you can use state estimation techniques you have to understand >what your system is and at least have a general idea of what it does. > >If you want a sensible answer, please include some information about >your >system, perhaps including why you think that using a rotation matrix >will >be of help and, indeed, just what the rotation matrix is supposed to >represent (and a response of "well, rotation of course!" is totally >inadequate -- in case you were wondering). > >-- >www.wescottdesign.com
--------------------------------------- Posted through http://www.DSPRelated.com
On Tue, 21 Apr 2015 04:13:01 -0500, sia4uin wrote:

(top posting compulsively fixed)

>>If your question makes just as much or more sense when you replace the >>word "Kalman" with the word "magic", then it is based on a deep lack of >> >>understanding of what Kalman filters do. >> >>Kalman, and similar state-estimation filters are based on using >>knowledge about the behavior of some system, plus measurements of the >>system's output, to estimate the states of the system. At the very >>minimum, before you can use state estimation techniques you have to >>understand what your system is and at least have a general idea of what >>it does. >> >>If you want a sensible answer, please include some information about >>your system, perhaps including why you think that using a rotation >>matrix will be of help and, indeed, just what the rotation matrix is >>supposed to represent (and a response of "well, rotation of course!" is >>totally inadequate -- in case you were wondering). >> > > Hello Tim, > > Thanks for your reply. I am currently working on an Android application > for tracking a user. > > I joined the project team late (this is not an excuse though :) ) and > the idea is that the rotation matirx is available to us from the device > itself which provides accurate orientation information. > > Now, this is the first time I will be working with Accelerometers and > Gyros. The acceleration signals look noisy, so the boss asked me to use > Kalman filter and use Rotation matrix as an extra input to the Kalman > filter. (I only know that Rotation matrix is used to convert signals > from Device frame to World frame). > > So I thought to use a moving average filter or an auto-regressive filter > to remove high frequency component. > > The ultimate goal is to filter acceleration signals and remove any drift > or bias from it. > > I would appreciate if you could please point me in right direction. > > regards > > Sia >
Hi Sia From the information that you're giving, the best thing you can do is to rotate the accelerometer data into the would frame (if that's not how you get it already), and low-pass filter it. Without having more data you don't really know enough to construct a Kalman filter. I would suggest that you try low-pass filtering the data with a 1st- or 2nd-order IIR low-pass rather than a moving-average. Depending on what you're using the data for, you may get better information. (Because you'll be using minimum-phase, or close to minimum-phase filtering, as opposed to moving average, which is most certainly not minimum phase). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
>Hi Sia > >From the information that you're giving, the best thing you can do is to > >rotate the accelerometer data into the would frame (if that's not how >you >get it already), and low-pass filter it. Without having more data you >don't really know enough to construct a Kalman filter. > >I would suggest that you try low-pass filtering the data with a 1st- or > >2nd-order IIR low-pass rather than a moving-average. Depending on what > >you're using the data for, you may get better information. (Because >you'll be using minimum-phase, or close to minimum-phase filtering, as >opposed to moving average, which is most certainly not minimum phase). > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com
Hello Tim, Thank you, I think that would just work fine. I implemented a test code in Matlab and keeping the tuning parameter alpha = 0.1. This provides good filtering. regards sia --------------------------------------- Posted through http://www.DSPRelated.com
On Monday, April 20, 2015 at 3:43:52 PM UTC-4, sia4uin wrote:
> Hello All > > First post to this group! > > I have 3D accelerometer signals which are obviously noisy. I want to use > Kalman filter to remove the noise. > > I can also use a moving average filter and it will be fine but how can I > use Kalaman filter to smooth these signals? > > regards > > sia > > > --------------------------------------- > Posted through http://www.DSPRelated.com
Be aware of a pitfall in your operation. Your statement that "the rotation matrix is available to us from the device itself which provides accurate orientation information" is only half true ("available" -- yes; "accurate" -- not as much as you'd like) -- and the ramifications are enough to cause you to fail in your objective. An accelerometer senses the component of instantaneous NONGRAVITATIONAL acceleration along the instantaneous direction of its sensitive axis. Drop it in a vacuum and it reads zero, not 1-g downward. SO: to know the acceleration vector you have to add in the gravity vector yourself. To do that right, you have to know that instantaneous direction of the sensitive axes of all three accelerometers. In fact, you have to know the continuous time history of that throughout the duration of your intended tracking operation. That's where the need for your "accurate orientation information" is not adequately satisfied, for multiple reasons, especially in today's handheld devices. Volumes have been written on this and tons of money have been spent on inertial systems with filters for updating. Even much of that work is done without accounting for inertial instrument errors that are sensitive to motions (see http://jameslfarrell.com/gyro-mounting-misalignment/ for a tip of the iceberg). Many of the error sources produce errors that grow with time, until they are (partially) counteracted by the updates -- so the updates have to be repetitive. There's a LOT to this.