Developer

Improved Altitude Estimate

The barometric sensor alone in most cases provides noisy and drift prone measurements. I have been trying to come up with a simple way to implement a fixed gain filter to utilize the acceleration measurements from the accelerometers to help clean up the noise and also add a sanity check via sensor fusion.


The cool part about the filter is that it also estimates vertical velocity which is useful for altitude damping and control. The basic idea behind the filter is the Z or vertical component of the acceleration is derived using the body rotations to compare with the barometric measurement. The noise of the barometric sensor is rejected whenever the accelerometers disagree. The down side to this approach is it depends upon the accelerometers being less noisy than barometric sensor and also not being on a vibration intensive vehicle. The theory works but actual implementation is somewhat hardware dependant.

The real plus to this filter is the velocity estimate can be used for altitude damping and control. Instead of taking the derivative of the barometric sensor which is going to significantly increase the noise in the derivative term, you get a much cleaner vehicle state estimate with this approach.

The code is fairly simple but may require tuning based on units and hardware. I took the fixed gain approach to keep it simple and as a result looks like the following:

The thing to note here is these are all relative to the NED reference frame (ie: acc_z is not the body z acceleration it is the NED z acceleration)

Enjoy-

-Beall

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Developer
    well it wasn't exactly in NATOPS but yeah in one of the computer based trainings I did today....I kinda lied! NATOPS skirts the top of anything technical but doesn't give indepth reasons for things like collective to airspeed coupling etc
  • Ryan,

    re. in our flight manual

    You talking about a big, thick, blue NATOPS manual?
  • I know. It could a have been a good money maker. I have text books going back a decade or more on these methods.
  • Developer
    I learned something interesting today. I fly the MH60S for the navy and I was looking through the autopilot section in our flight manual. The altitude hold section describes something identical to this method. Guess I was spot on for implemenation. Too bad I wasn't the first one to figure this out I'd be rich.
  • Developer
    Yeah, Brandon is exactly right. It is as simple as adding one extra equation and tuning the gains to set the bandwidth you would expect in the bias. The baro drift is going to be slow, so simply use a low gain on the GPS correction and you are all set.
  • By barometer offset I meant bias. If the barometer has a temperature dependent bias or scale factor that could be accounted for as I mentioned above.
  • There shouldn't be too much re-inventing, Ryan's equations are spot on with GPS measurement just needing another addition term (for example: ... + k_*_gps(h_est - gps_alt).

    The new part is how you choose the gains which are based on the state propagation equations and the amount of noise expected in each sensor which is hardware specific. Fortunately I would expect most ArduPilot Mega sensor boards to have about the same noise so the gains could be hard coded once calculated. Matlab has a function kalman() (http://www.mathworks.com/products/control/demos.html?file=/products...) and Scilab has a function lqe() (http://www.scilab.org/product/man/lqe.html) to calculate these gains.

    You can also throw you're barometer offset into the state and estimate it as well. I'd have to write out state-space equations, but I think it may still remain a steady-state problem.

    This stuff sounds like fun to work on, but I need to get graduation out of the way first. Let me know if anyone has any questions tackling this.
  • Brandon,
    This kind of makes sense. My Kalman knowledge is not deep so I will have to take your word for it on the maths techniques.

    I still get the feeling someone must have done this already. I really dislike re-inventing stuff.
  • This has the same form as a two state (vertical position and velocity) with a single measurement (barometric altitude) steady-state Kalman filter. You can pre-compute the steady-state Kalman gains using the noise properties of your sensors and the Algebraic Ricatti equation. This way you just replace your gains with the steady-state Kalman gains and avoid matrix math and inversion. This approach would also make it easy to add another measurement such as GPS altitude and fuse the IMU, GPS, and barometer together in a Gaussian-ly correct method. I'd be happy to work on this after the semester ends but maybe you guys can get a jump start on it.
  • A problem is barometer gain error.
    Say you are at altitude and make a fast descent.
    The barometer gain error will appear as an offset.
    How do you know if that is gps error or barometric error?

    Someone else must have been through this before.
This reply was deleted.