Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Kalman Filter - Acceleration Measurements

  1. Sep 10, 2013 #1
    I am using a extended Kalman filter for the state estimation of a nonlinear system. The real system has accelerometers, so I need to include the acceleration of the system as part of my measurements with noise added (position and angular rates are other measurements).

    All of the Kalman filter design I've done in the past only had measurements based on state variables. Obviously the acceleration is not a state variable, so I am unsure about how to get my simulated acceleration measurement.

    I can get acceleration since I know what my inputs are, but all of my EKF references don't have inputs as part of the measurement function:

    aDaMpKM.jpg

    That's the only way I can think of getting my acceleration measurements...what am I missing?
     
  2. jcsd
  3. Sep 11, 2013 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Rhetorical question: Why not?

    If you make acceleration part of your state vector, then you should have some means of predicting what acceleration should be. If the control system commanded the object in question (e.g., a vehicle) to accelerate in a certain way, then that commanded acceleration should be incorporated into the predict side of the Kalman filter. Plus some plant noise. When you do have acceleration as part of your state vector, the accelerometer readings are a "measurement". Those measurements, like any other measurement, go on the state update side of the Kalman filter. The uncertainties in the accelerometer readings are measurement noise for those updates.

    If you don't make acceleration part of your state vector, then the fact that the object is undergoing acceleration is a bit of a surprise. The accelerometer readings are not a measurement in the sense of a Kalman update. They instead need to be used in the predict side of your filter. The noise is a bit trickier. You have plant noise plus sensor noise, and the sensor noise is now a random walk (integrated white noise), or integrated random walk if velocity also is not part of your state. You can remove some of the surprise (and hence some of the noise) by accounting for commanded accelerations, but it's still a bit of a surprise.

    One final point on accelerometers: They don't measure acceleration due to gravity. They measure acceleration due to non-gravitational forces only. You need to account for acceleration due to gravity, typically on the predict side of your filter.
     
  4. Sep 11, 2013 #3
    Thanks for the in depth response! The reason I said that acceleration is not a state variable is because by definition, it is not needed to describe the state of the system. But, it would make things much easier if it was included in the state variables for the reasons you mentioned. I thought about this, but I am unsure about how to include it (never had to before). Don't I need to know the behavior of the acceleration derivative is to include it in my state vector? Do I just differentiate the equation I have for acceleration? Or is it simpler than that?

    Your comment about accelerometers...is that true for all accelerometers? If the few that I've worked with they measure absolute acceleration. For example, the single axis accelerometer will measure +/- 1g if it is sitting on the table (depending on if it is upside down or not). Or maybe I misunderstood your comment?

    Thanks again!
     
  5. Sep 11, 2013 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Have you done a literature search on this? This is the reason Kalman filters were invented, to get man to the Moon in the 1960s. There's fifty years of literature on this very topic. Whether to include acceleration in the state -- so do, some don't. It depends in part on what the filter is for (e.g. a black box inertial navigation system that doesn't know a thing about commanded accelerations versus a control system that intimately knows (or thinks it knows) what acceleration is supposed to be), in part on personal preference, in part on trying different approaches and seeing which one works best.


    With regard to my comment on accelerometers not sensing gravity: No local experiment can sense gravitation per Einstein's equivalence principle. An accelerometer is the quintessential local experiment. The only way to sense gravitation is with a non-local experiment. Measure position vector to the planet of interest and numerically differentiate twice, for example.

    So if accelerometers don't measure gravitation, why does an accelerometer sitting on a table sense an acceleration of 1g?

    Draw a free body diagram. What forces act on the accelerometer, and what is the net force? Ignoring acceleration toward external bodies such as the Moon and Sun, the forces acting on the accelerometer are the downward gravitational force exerted by the Earth on the accelerometer and the upward normal force exerted by the table on the accelerometer. The net force: The accelerometer is at rest with respect to the rotating Earth. The net force is that needed to make the accelerometer undergo uniform circular motion about the Earth's rotation axis, one revolution per sidereal day. The distance to the rotation axis is approximately r=Re*cos(latitude). For a latitude of 45 degrees, the accelerometer is accelerating at about 0.024 m/s2. If your accelerometer did sense gravitation, this is the value that it would report rather than 9.8 m/s2.

    So why does an accelerometer sitting on a table sense an acceleration of 1g? Simple: It's senses everything *but* gravitation. In this case, it senses the upward normal force exerted by the table on the accelerometer that is not quite equal to but opposite the downward gravitational force.
     
  6. Sep 11, 2013 #5
    Excellent! Thanks! The bit on the accelerometer makes sense now...kind of mind boggling but I think I have it. So lets say an airplane at steady flight, the accelerometer in the down direction (earth normal) will be reading +1g. But my model is only accelerating due to the uniform circular motion because it is in the absolute frame. This is the difference I must account for.

    I'll search around for info on the Kalman filter issue. I was not aware of this issue until I started revisiting EKF and more complicated models...never came up before with the simple academic problems I've been through. Also, when I've worked with accelerometer measurements before, they were just integrated and compared to the model velocity (this was in a simple PID control case, no state estimation).

    Because I know (ie think I know) what the commanded accelerations are from the model, I will try to get it working first without including acceleration as a state.

    Thanks, you've been very helpful!
     
  7. Sep 11, 2013 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That is *one* of the differences you must account for.

    Here's another: Your velocity vector is expressed in some frame of reference. To predict the velocity at the next time step you need to know the derivatives of the components of your velocity vector. That is not what your accelerometer reports. Suppose your airplane pitches up, or yaws left. Your accelerometer doesn't know that the orientation with respect to inertial has changed. It doesn't know anything about the way it is oriented. Your accelerometer outputs are expressed in the "accelerometer case frame". You need to transform the accelerometer outputs to the velocity vector frame and account for the unsensed gravitational acceleration.

    And yet another: If you are working with an airplane, you may well want position and velocity expressed in a frame that is rotating with the Earth. This is a rotating frame. This means the dynamics include accelerations from fictitious forces such as the centrifugal and coriolis accelerations. Your accelerometer doesn't measure these, either. There's a reason they're called fictitious forces: They aren't real. They are fictions. Extremely convenient fictions, but fictions nonetheless. Accelerometers don't sense fictitious forces.

    And yet another: Your accelerometer has lots of goofy errors. If you have a 3 axis accelerometer, it would be real nice if those measurements represented accelerations in three orthogonal axes. They aren't. The individual single-axis accelerometers are not aligned perfectly. There's always some non-orthogonality error that poisons the accelerometer outputs a bit. It would be real nice if the accelerometer was oriented internally exactly the way the spec says it is, and oriented to your aircraft frame exactly the way you wanted it. It's not. There are instead misalignment errors. It would also be real nice if a reported acceleration of (say) 10 meters/second2 really meant 10 meters/second2, 1 meters/second2 really meant 1 meters/second2. Accelerometers have biases and scale factor errors. Some people make the sources of these errors a part of the state so that they can be estimated.
     
    Last edited: Sep 11, 2013
  8. Sep 11, 2013 #7
    Good points, thanks.

    My model is a simple 3DoF model (can be used for any aircraft/spacecraft) which accounts for the earth rotating frame. So I have my inertial frame (e.g. ECI), my rotating frame (e.g. ECEF), and my body frame. The additional frame that I didn't include would be a frame that is always normal to earth (e.g. NED), but I will save that one for a future 6DoF model. So, my position and velocity state variables are expressed in my rotating ECEF frame.

    My initial thought before you brought up these important points was that my acceleration measurement would just be the acceleration in the rotating ECEF frame, but transformed to the BODY coordinate system. This was because I was thinking the accelerometer was taking 'absolute' measurements. But, looks like I'll have to rethink some of this, especially dealing with the centrifugal and coriolis accelerations.

    I can see how a local normal place (e.g. NED) would be useful in accounting for the gravity bias in the accelerometer measurements.
     
  9. Sep 11, 2013 #8

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    Another way to look at that: accelerometers don't measure acceleration. They measure force (or some proxy for force, like strain in an elastic material), and the force is often the weight of some internal component of the accelerometer.

    The internal dynamics of the accelerometer explains why the output is only accurate (i.e. within the data sheet definition of "accurate") over a restricted frequency range, for example.
     
  10. Sep 11, 2013 #9
    This is how I was thinking about it and it made the concept easier to grasp, at least as far as dealing with the gravity bias.

    Still thinking about the coriolis and centrifugal force and accounting for them. Is it just a matter of subtracting them out, essentially transforming the motion to the inertial frame? Since the accelerometer can't measure them because they are fictitious.
     
  11. Sep 11, 2013 #10

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That explanation fails to describe how an accelerometer in free fall such as on an orbiting space craft reports no acceleration.

    The most accurate model of large scale (non-quantum) phenomena is general relativity, not Newtonian mechanics. In GR, an ideal accelerometer measures proper acceleration, acceleration relative to a (local) co-moving inertial frame. Inertial frames in GR are not the same as inertial frames in Newtonian mechanics. Accelerometers don't measure what we call "weight", gravitational acceleration times mass, because that force is a fictitious force that results from looking at things from the perspective of a non-inertial frame.
     
  12. Sep 13, 2013 #11
    I think I'm pretty close to understanding what an accelerometer is capable of sensing (everything but gravity & fictitious forces), but I just wanted to make sure.

    For gravity (ignoring centrifugal and coriolis for now), considering the FBDs of the two cases of an accelerometer sitting on a table and an accelerometer in an orbiting (falling) satellite makes it easy to convey the idea. For example, the only force on the orbiting satellite is gravity and this is the acceleration that the model reports; however, in real life the accelerometer reports 0 m/s^2, so the model must be biased to remove the acceleration due to gravity (leaving a net force of zero).

    For the fictitious force (centrifugal/coriolis), it is a bit more confusing. If we remove all external forces in the inertial frame (e.g. gravity), a scenario that helps me understand is a mass being ejected into space, away from earth. Remember, no gravity so in the inertial frame the mass just goes in a straight line away from the origin (center of Earth). But, in the rotating frame, due to centrifugal and coriolis accelerations, the mass appears to spiral out around Earth. Of course, in real life, the onboard accelerometer is reading zero. Looking at the model in the rotating frame, we see an acceleration from the centrifugal and coriolis effects. Thus, they need to be removed to make the correct measurement in the model.


    What I am still a little iffy on is the correct transformation from the body frame to the rotating frame. In real life, if I make an acceleration measurement in the body frame, these measurements must be transformed to the rotating frame. This is equivalent to the acceleration in the rotating frame, minus the centrifugal and coriolis effects that are in the model.

    Going the other way, if I take the acceleration in the rotating frame of the model and subtract the centrifugal and coriolis effects, then transform it to the body frame, this is the acceleration that an accelerometer will read (ignoring gravity at the moment). I think that is all correct.

    Is it correct to say that an accelerometer only measures accelerations in the inertial frame (after accounting for the gravity bias)? I mean, once you remove the centrifugal and coriolis forces, that's saying that your acceleration in the rotating frame is equal to the acceleration in the inertial frame.
     
  13. Sep 13, 2013 #12

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Emphasis mine:
    What model are you writing about? A simulation engine that lets one test the filter in a simulated environment? Some onboard software model that processes the accelerometer data? Something else?

    Why do accelerometers report zero acceleration for an object in free fall? I'll look at this from two different perspectives.
    • General relativity.
      General relativity is the most accurate explanation of large scale phenomenon, so it's good to look at this as the premier explanation. An ideal accelerometer is a device that measures "proper acceleration", acceleration relative to a co-located, co-moving, and free-falling test object. That test object defines an inertial frame in general relativity. Note that this general relativistic inertial frame is quite different from a Newtonian inertial frame. In Newtonian mechanics, that free falling frame is an accelerating frame: Not inertial.

      Einstein imagined how a person in an windowless elevator car could make sense of what was experienced locally inside that elevator car. Suppose you are standing on the floor of that elevator car. Everything feels normal. How can you tell whether the elevator car is at rest on the surface of the Earth or have you been kidnapped by bug-eyed monsters and the car is in a spaceship in deep space, accelerating at 1g? Now suppose you feel weightless. How can you tell whether the elevator car is orbiting the Earth or is in deep space and not accelerating at all? The answer in both cases is that there is no way to distinguish between the alternatives. Newtonian mechanics says something rather different. It says the car at rest on the surface of the Earth is close to inertial, the accelerating car in deep space and the orbiting car are non-inertial. The only situation in which general relativity and Newtonian mechanics agree is the non-accelerating car in deep space. Another big difference is that inertial frames are global (span the universe) in Newtonian mechanics but are local in general relativity.

      An accelerometer is very much akin to that person in a windowless elevator car. The accelerometer doesn't know anything about the external environment. It reports acceleration relative to a locally free-falling object, the test mass inside the accelerometer.

    • Newtonian mechanics.
      An accelerometer comprises a test mass that is somewhat free to move with respect to the accelerometer housing. Because the test mass is somewhat free to move, the accelerometer must apply a force on the test mass to keep the test mass stationary with respect to the housing. It is this force that the accelerometer senses and reports (scaled via F=ma) as acceleration. As the accelerometer is small, there is essentially no variation in gravitational acceleration across the tiny expanse of the accelerometer. Acceleration due to gravity affects the accelerometer housing and the test mass equally. No force is needed to keep the test mass stationary with respect to the housing if the accelerometer is in free fall.


    Note very well: I am not advocating that one should use general relativity to solve a robotic car moving along a road problem. That's ridiculous. Use Newtonian mechanics. The reason I invoked general relativity at all is because the equivalence principle and Einstein's elevator car thought experiment helped me gain a solid understanding of why accelerometers behave the way they do. If it doesn't help you, just use the Newtonian explanation.


    Suppose Jim wants to describe behavior from the perspective of a frame rotating with the Earth, John wants to describe behavior from the perspective of a frame rotating at 1000 Hz about the x axis, and Susan wants to describe things from the perspective of an inertial frame (Newtonian inertial frame). How does the accelerometer know who is observing the behavior? The answer is, it doesn't. From Susan's perspective, those fictitious forces do not exist. This is the perspective from which accelerometers measure acceleration.


    Correct. Or, almost correct. Accelerometers measure acceleration with respect to inertial (specifically, with respect to a general relativistic inertial frame, so no correction for gravity bias is needed). The results however are in terms of a frame fixed with respect to the accelerometer (the accelerometer case frame). Velocity is typically expressed in terms of some external frame, so those case frame accelerations need to be transformed to the position/velocity frame to make sense of those reported accelerations.
     
  14. Sep 13, 2013 #13
    The model is simulation engine like you say. It is the 3DoF model that I discussed earlier that describes the motion of the body in a rotating frame. My state variables are the position and velocity in the rotating frame as well as the angular position and velocity of the body in the inertial frame.

    When I make my accelerometer measurements within the model (to simulate my filter), this is where I have to take the acceleration of the body wrt to the rotating frame, remove the centrifugal/coriolis effects, account for gravity, then express the resulting acceleration in the body frame. THIS is what my accelerometer will read in the real world.

    Thanks for taking the time to help me out!
     
  15. Oct 7, 2013 #14
    Conceptually this makes sense, but I am unsure about the implementation. Right now I am not accounting for the commanded accelerations, but I wanted to see if any improvements can be made by doing so. Do you have any recommendations? I haven't been able to come up with any sources that discuss this.

    Thanks!
     
  16. Oct 9, 2013 #15

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    You won't find many sources nowadays that discuss this. Unfortunately, that information has become rather restricted since September 11, 2001.
     
  17. Oct 9, 2013 #16
    I think I have discovered the difficulty in dealing with the accelerometer noise when the acceleration is not made part of the state vector. Since the accelerometer measurements are used in the predict side of the filter, I get the random walk like you were talking about. I end up with state errors that drift.

    IxlMtEGl.jpg

    Top to bottom: Position X, Position Y, Velocity X, Velocity Y

    In the above image, my process noise covariance matrix is set to zero because I was assuming my process was perfect for the moment. But then I got to thinking, and added the accelerometer noise to the the process noise, and I came up with better results:

    o8I9n9Wl.jpg

    I'm not sure if what I did is correct or not, though. It seems like I should not have the accelerometer noise in the process noise of the model, but I should include it in the process noise covariance matrix only when I am propagating/predicting my error covariance matrix, P...

    Can you shed some light on this?

    I am going to try to add my acceleration to my state vector, but it seems like in that case I need to know the derivative of the input...is this right?
     
    Last edited: Oct 9, 2013
  18. Oct 9, 2013 #17

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    You have to have process noise (aka plant noise). If you don't, the covariance matrix will collapse and the filter will reject measurements. Think about it: If the state is known perfectly, why bother with those stupid noisy measurements?

    How much process noise? That's the black art of Kalman filters. It's called filter tuning, and it's usually done empirically. Basically, you want more than enough noise to keep the covariance from collapsing, but too much noise will make the filter outputs become noisy. Your state is staying within the 3 sigma bounds, which is a good start. Fiddle around with your process noise. Scale it up and down (maybe by quite a bit) to see what it does to behavior, repeat these coarse adjustments and then later fine tune until you get the behavior you want.

    Note also that you need to account for behavior when you take your device off the test stand and start driving it with a (noisy) motor (or whatever). This is true plant noise; you'll need to add some of that plant noise to your empirically-based process noise that's needed just to make the filter behave nicely.
     
  19. Oct 9, 2013 #18
    Thanks, that makes sense. I'll just have to experiment with the process noise to see the effect it has on the filter. So really you aren't ever accounting for the accelerometer noise...you just tune the process noise until it works?

    I think adding the acceleration to the state vector would be worth doing, since I have an idea what the commanded acceleration is. But differentiating the acceleration to get jerk means I have to know the derivative of my input, right?
     
  20. Oct 9, 2013 #19

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    With regard to that random walk: The only way to get rid of that is to take other measurements. Cameras. Star trackers. Magnetometers. Lidar measurements. GPS. Radar range/range rate. All kinds of other sensors are used. If you don't, your position will degrade rather quickly. Adding these sensors will of course make your Kalman filter get bigger and bigger.
     
  21. Oct 9, 2013 #20

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    You account for the accelerometer noise in the measurement noise side of the filter. That's the easy part. It's in the spec. Well, not quite. The filter specialists I've worked with always add fudge factors to make the filter work. Tuning is a black art.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Kalman Filter - Acceleration Measurements
Loading...