Using GPS to Measure Attitude and Heading


Earlier, we talked about a simple way to measure attitude using accelerometers and rate gyros (you can refresh your memory here, if needed).  The gist of the idea is that you can use rate gyros to estimate attitude in the short-term, and then make long-term corrections using the accelerometers.  This gives you an attitude estimate that is resistant to vibration (because of the gyros) and immune to long-term drift (because of the accelerometers).  This is basically the method used on the UM7 Orientation Sensor and the UM7-LT.


The UM7 measures gravity using accelerometers.

The problem with that approach is that it assumes that the accelerometers usually measure gravity.  If you put the sensors on something that is often accelerating aggressively, like an airplane, then the "accelerometers measure gravity" assumption is no longer valid.  The more acceleration, the worse the angle estimates can become.

So what can you do?  If you are using the UM7, you can tune the filter so that the gyros are "trusted" more by the filter.  This minimizes the impact of unwanted acceleration.  But the problem is still there, and tuning the filter might not be enough.

This is where the GP9 GPS-Aided AHRS comes in.   The GP9 makes no assumptions about the platform it is mounted on.  It intelligently combines data from accelerometers, rate gyros, and GPS to measure its attitude and heading - and unlike the UM7, it actually performs better on platforms that accelerate aggressively.

How Does it Work?

In a previous article, we talked about how accelerometers can be used to measure position and velocity.  The problem is tricky because accelerometers don't just measure their physical acceleration, they also measure gravity (sort of... see our discussion about accelerometers for more details).  If you want to measure physical acceleration, you must first remove gravity-related measurements from the data.

But to remove gravity from the accelerometer measurement, you need to know the attitude (pitch and roll) of the accelerometer.  For example, if the sensor is sitting flat and level on your desk, the z-axis accelerometer will show 9.8 m/s/s of acceleration from gravity.  If the sensor is rolled 90 degrees, the gravity measurement is on the y-axis instead.

This is one of the principle problems that make it difficult to use accelerometers to estimate position and velocity: attitude errors make it difficult to remove the gravity component of the accelerometer measurement.  Attitude error causes the device to erroneously interpret gravity as physical acceleration.  In fact, even small attitude errors cause very large errors in accelerometer-based velocity estimates.

While this makes it difficult to build a sensor that can track position and velocity, it actually helps us measure attitude on the GP9.  Attitude measurement error produces very predictable errors in position and velocity estimates.  If you can measure velocity and position errors (say, with GPS), then you can figure out your attitude error using a combination of GPS and inertial sensors.

A Solution

The GP9 GPS-Aided AHRS uses its attitude estimate in conjunction with accelerometers to measure changes in velocity.  It then compares those changes in velocity to what is reported by the onboard GPS.  An Extended Kalman Filter is then used to take the velocity error and figure out attitude error.

The result is a sensor that actually benefits from aggressive dynamic acceleration instead of being hurt by it.