# How to detect orientation with accelerometer while vehicle has variable acceleration?

According to my research I saw that, in order to detect the angular orientation AHRS uses gyro and accelerometer. Only gyro does not work well because of integration drift. Only accelerometer also does not work because of vibrations and vehicle accelerations. That's why sensor fusion algorithms like Kalman filter are used to have a better guess.

What if we have a fighter jet that operates at excessive acceleration? In this case is it possible to extract gravitation vector from the accelerometer data? If we can't, that it means that at that operation we only rely on gyro which will drift after a while.

What kind of algorithms are used in these vehicles to fix the issue?

• Same algorithms, better sensors :) Commented Nov 1, 2022 at 8:42
• Noting first, that everything, including acceleration and angular orientation, is relative, not absolute, all these algorithms require establishing a baseline "acceleration" and "orientation" to compare with. Generally, the system has to first be "aligned" while at rest, (or injected with alignment data from an external source, for it to work properly. Commented Nov 1, 2022 at 14:28
• Commented Nov 1, 2022 at 18:19

You are right, an AHRS does have difficulties differentiating centrifugal accelerations from acceleration due to gravity. That is why in pretty much all higher-performance aircrafts utilize so called Inertial Navigation Systems coupled with GPS receivers. The advantage of these systems is that you now can measure/estimate the velocity of your aircraft. This does not sound like much, but it is! Because with the addition of this measurement/estimation you can calculate the centrifugal accelerations (which is a function of rotational rate and velocity) which then allows you to deconstruct your measurement into inertial and gravitational components. With the help of this, your algorithm is then able to compute your navigation state (rotational and translational) completely.

I write measurement/estimation, because in pretty much all applications I am aware of, a Kalman filter is used (as you correctly observed) to combine all available sensor data.

Some side note on AHRS units:

• Typically, a modern AHRS unit will use a combination of Gyrometers, Accelerometers and Magnetometers, simply because by combining these sensors you can alleviate the weaknesses of each of the sensors.
• Higher grade sensor do not make the problems dissapear, they are just weaker. For example drift is present in every single gyro, however with the most expensive FoGs, drift is very very low. But you still need to handle it (for example with the help of other Sensors and a Kalman filter), because even though it is low, it will add up given enough time.
• Kalman filters pretty much always try to eliminate the gyro drift by explicitly estimating it. They even go so far to heat the gyroscope to some constant temperature, just so that the gyro drift remains constant (which is of course easier to estimate)

I find this website of an AHRS manufacturer to provide a good read. (I am not affiliated, before anyone asks...)

• And, related: aviation.stackexchange.com/questions/86279/… Commented Nov 2, 2022 at 13:00
• I looked closely at the link (last sentence of answer) was surprised to see no reference to GPS (GNSS) in the basic explanation of the AHRS. Based on some previous research, I thought that that usually played a key role-- Commented Dec 2, 2022 at 15:49
• @quietflyer No, in my experience if a GPS-unit is added such a system would normally be advertised as an INS (although that might differ from the classical definition of an INS depending on how you view things). Looking at the same website, you might find this link helpful: vectornav.com/resources/inertial-navigation-primer/…. The AHRS can be useful in GPS-denied environment. Otherwise you would of course go for an INS with GPS, as it makes things a lot easier... Commented Dec 2, 2022 at 19:19
• Btw I'm certain that the description for one particular, add-on system that I read about 5 years ago did describe how GPS data was used to help keep a AHRS system calibrated-- without making any reference to "INS"-- but perhaps this wasn't standard terminology-- I'm not that deeply familiar with the literature on the subject-- Commented Dec 3, 2022 at 0:39

What if we have a fighter jet that operates at excessive acceleration? In this case is it possible to extract gravitation vector from the accelerometer data? If we can't, that it means that at that operation we only rely on gyro which will drift after a while.

A key point is that GPS and magnetometer data is used to understand the trajectory of the aircraft and allow the gravitation vector to be extracted from the linear accelerometer data.

As the original question rightly implies, if the rotational accelerometers were perfectly accurate, and if their outputs could be perfectly integrated over long periods with no computational errors (i.e. no computational "drift"), then this wouldn't be necessary-- in such a case, we wouldn't need need to make any reference to linear accelerometers at all, except during the initial start-up with the aircraft at rest. We could note which way was "down" before beginning the flight, and simply "remember" that direction throughout the flight by continually integrating1 the output from the rotational accelerometers. But that doesn't work in the real world. We need to "help" things out by trying to also observe the direction of the gravitation vector in actual flight, and that's where the linear accelerometers come into play.

Here's a crude (oversimplified) analogy-- imagine that we have a mechanical artificial horizon gyro that for some reason drifts off from "true" rather quickly, and so needs to be mechanically reset to "level" now and then. Imagine that we also have a simple pendulum (such as a weight hanging from a string, with some effective damping mechanism to prevent oscillations) that tells us the apparent direction of "down". If we have a GPS, we can use the GPS track data to decide whether the flight path is linear or curving.2 If we only look at the pendulum when the flight path is linear and the G-load3 is exactly one, then we can sure that at that instant the pendulum is actually aligned with the real direction of gravity. That's the instant that we want to re-set our mechanical artificial horizon to align with the apparent direction of "down".

Obviously, in the real world, it's a lot more complicated than that-- the correction is applied more continually, and lots of mathematical filtering is involved.

Note also that in theory, any "drift" in the integration routine for the rotational accelerometers could be corrected without any reference to GPS information. After all, that's exactly how a mechanical artificial horizon works. In that case, the principle is that the drift correction (to align the gyro with the position that a pendulum would take) is only applied to a very slight degree, so that during 90 or 180 degrees of turn, only negligible error has accumulated. And once the aircraft has turned past 180 degrees, the additional "corrections" are in the opposite direction as the earlier "corrections", so after a full circle, the slight error induced by the "correction" to align the gyro with the position that would be taken by a pendulum4, has been fully removed. But in actual practice, the computational "drift" involved in keeping track of orientation by continually integrating the output from a set of rotational accelerometers, is large enough that this would not be practical without some additional method of cross-correction, especially during vigorous maneuvering.

Footnotes:

1. Actual, a double integration is involved-- integrating rotational acceleration gives rotational velocity, and integrating rotational velocity gives the orientation of the aircraft in space.

2. It's inherent in the nature of GPS measurements, that it will be easier to detect curvature in the flight path in the horizontal plane (e.g. conventional "turns") than in the vertical plane (e.g. loops).

3. Here we mean the three-dimensional G-load, i.e. the net vector sum of the output from a set of three linear accelerometers. As opposed to simply the reading on a simple mechanical G-meter (or a single-axis linear accelerometer) mounted on the aircraft's instrument panel.

4. See for example the reference to "pendulous vanes" at 4:01 to 4:12 in this video. Food for thought: what erroneous "correction" would the pendulous-vane system apply to the mechanical artificial horizon, if the aircraft somehow accelerated horizontally at a very high rate for many minutes on end?

• U_flow's answer is good too-- not sure why no u'vs in over a month. Commented Dec 2, 2022 at 14:38

It's fairly simple:

1. If you integrate acceleration over time, you get velocity.
2. If you maintain substantial acceleration, you get ever-increasing velocity.
3. Aircraft have a maximum velocity. It cannot increase forever.

Conclusion: Aircraft cannot maintain substantial accelerations for extended periods of time. At some point, the aircraft must stop accelerating or turn around and accelerate in the other direction. If you average acceleration over a long enough period of time, it must vanish. What remains is gravity.

Example calculation:

Your aircraft has a mechanical attitude indicator. The time constant of the erection mechanism is 5 minutes. The maximum speed of your aircraft is Mach 0.9, around 300m/s.

What is the maximum turning error?

The maximum change in velocity is 600m/s (full speed in one direction to full speed in opposite direction) and we have to average that over 5 minutes. Even if you perform multiple turns during those 5 minutes, the change in velocity from the beginning of the first turn to the end of the last is never more than 600m/s. Whether you fly these turns at 2g, 10g, or 100g is utterly irrelevant, the change in velocity is still only 600m/s. The calculation is:

$$a_{max} = \frac{2\cdot v_{max}}{T} = \frac{600\frac{m}{s}}{300s} = 2\frac{m}{s^2} = 0.2g$$

The maximum acceleration that doesn't vanish is 0.2g, which translates to an angular error of:

$$\arcsin\left(\frac{0.2g}{1.0g}\right) = 11.5°$$

A turning error of 11.5° is still substantial, but at least you know which way is up (and the error goes away if you fly straight for 5 minutes). You can reduce the turning error by using a weaker erection mechanism, but even with 10 or 15 minutes time constant the turning error is still 4-6° in the worst case. Larger time constants are problematic because earth turns with 15°/h, so during your 10 minutes of averaging the real gravity vector turned by 2.5°. The choice of time constant is a tradeoff between different kinds of errors. If you use cheap gyros with a drift rate of more than 15°/h, you have to consider that rate for making tradeoffs rather than the rotation of earth.

• So the essence of this answer is that by simply making the time constant of the correction algorithm sufficiently large, it works just fine to "correct" to the apparent direction of gravity (as would be sensed by linear accelerometers)-- even for systems based not on physical gyros, but on integrating the outputs of rotational accelerometers? So GPS input is un-necessary to a well-functioning AHRS system? I sense another, more specific ASE question in the making here-- Commented Dec 2, 2022 at 15:15
• @quietflyer - Yes, mechanical attitude indicators work well without GPS or magnetometer, but they have substantial turning errors. You can get the same behavior with a strap-down setup. You cannot make the time constant too large because the rotation of earth is 15°/h and the erection mechanism must follow that rotation without too much lag. You also have gyro drift if you have cheap gyros and longer time constant means that drift can accumulate. Commented Dec 2, 2022 at 15:19
• Hmm, considering asking a ASE question as to how quickly (and how large) errors would develop in actual practice in the event of permanent GPS signal loss to various types of actual real-world AHRS systems-- note these systems vary widely, starting with simple units intended to be plugged into your cell phone to allow better functioning of an artificial horizon app, to the most sophisticated military-aviation-grade units-- Commented Dec 2, 2022 at 15:25
• @quietflyer - I could give you some interesting input here. I've built an attitude indicator (for a drone) around a cheap ISM330DLC IMU, deliberately without GPS (unreliable) or magnetometer (you have to calibrate it first). The "simple averaging" approach works well, but you can do much more with just an IMU, including suppression of turning errors (but not acceleration errors from changes in thrust) and velocity estimation. The quality of cell phone gyros varies widely, some of them are okay-ish (ISM330DLC again), but others just suck (MPU-9250). Commented Dec 2, 2022 at 16:11
• Fascinating -- may have some more questions later; this may end up going to a chat window-- thanks. There was a time when I was actually extremely interested in making a very simple, light, portable, emergency attitude indicator for use in the event of accidental cloud entry in sailplanes, hang gliders, etc. I ended up "addressing" the problem in other ways but still am rather interested in the topic-- Commented Dec 2, 2022 at 19:05

It is not possible to extract the gravity ('downward') vector from accelerometers. It's a fundamental principle that acceleration and gravity are indistinguishable. If you place an accelerometer in a bucket and whirl it round your head it will tell you that the "downward vector" is outward from the circle. This is true of anything that measures only acceleration, no matter how sophisticated.

Other devices determine "down" by either maintaining a constant reference frame (a physical gyro) or very precisely measuring turning in all axes (laser gyro).

We have a Physics site where they can probably give you more details.