# Accelerometer question for IMU Experts

I'm sure there's plenty of experienced IMU builders on this board who can resolve this question (see here: http://www.diydrones.com/forum/topics/gyrospes-vs-acceleometers?x=1... (starting at the 5th comment) and here: http://www.rcgroups.com/forums/showthread.php?t=1066119&page=30 (starting at post #443) for more discussions). In fact the question may even have been answered here earlier (in which case I apologize for re-asking it, but I couldn't find it). The question has both a practical aspect in terms of IMU component & s/w design and a theoretical one in terms of trying to understand the relevant physics. Read carefully, because I don't think this is a noobie question.

Assume a 3-axis accelerometer is mounted close to the center of gravity of a quadrotor with the Z axis of the sensor aligned reasonably well with the thrust axis of the rotors and the X and Y axes aligned with 2 of the arms of the quad. If the flying quad is at a non-zero bank angle (i.e. is rotated about the x-axis from a level hover), what will the Y axis accelerometers read? In this case, the vehicle will be accelerating laterally in the earth axes (and possibly vertically depending on the magnitude of the thrust vector compared to the gravitational one). One school of thought claims that the Y accelerometer in this case should read effectively zero (assuming that aerodynamic drag, vibration due to rotors, noise, errors due to sensor misalignment, coriolis and centripetal forces, etc. are either negligible or accounted for). The reasoning is that all the forces should be coming from the rotor thrust, which is always in the Z body axis for a quad. By a similar argument, the X axis accelerometer should also read zero for any pitch angle. (I think the argument holds to some extent for helicopters as well, but the force vector will not always be in the Z body axis direction due to rotor flapping.)

The opposing argument is that there are plenty of quadrotors out there that use accelerometers to self-level, perhaps as part of a Kalman or complementary filter algorithm. It would seem unlikely for them to work as well as we know they do if the X and Y sensors were reading zero regardless of the vehicle tilt. How do we resolve this conundrum? Is the model of how accelerometers work flawed? I believe it is valid to model the resultant output of any accelerometer by determining the net force and subtracting the gravitational force vector. This works if the sensor is stationary (it will read as if it were accelerating away from the ground at 1 g), or if it is in free-fall (reads zero). Is this model correct in general for arbitrary motion? Are these other forces on the quad that I'm ignoring important somehow?

I'd prefer if your answer includes one or more of the following: time history graphs of a FLYING vehicle (we know we can measure tilt of a stationary sensor), or a free body diagram, or a set of equations, or a reference to a textbook or paper. As I said, I'm trying to understand the physics of the situation.

Here's a picture, if it helps: http://www.diydrones.com/forum/attachment/download?id=705844%3AUplo... This shows the forces in the earth vertical axis as being balanced, but I don't think that condition is necessary for the X body axis accelerometer to read zero.

- Roy

Views: 3090

Comment by Tom Yochum on August 7, 2009 at 2:21pm
Quote: "What is not known (at least not by me) is what the on board accelerometer would sense."
The accelerometers will measure the accleration caused by any external force EXCEPT gravity. If you ignore aerodynamic effects like drag, then the only thing the accelerometers will measure is the total acceleration of the thrust. Since the thrust is only in the body Z direction, and without any aerodynamic forces, the X and Y accelerometers will never register anything.
Comment by Roy Brewer on August 8, 2009 at 6:37am
Tom,

You said "When the forces are balanced, the gravity vector shows up very nicely and the pitch and roll components are easily computed."

I don't see this. Put a drag force vector on your drawing or mine opposing the actual motion. It should be small compared to the other forces, but even if it isn't, I don't see how this makes the gravity vector show up.

You said "This is where gyros come into play. The gyros provide an estimate of the angle rotated through during the dynamic portions. The tricky part is how you blend the static and dynamic data."

I'm not saying it trivial, but there are plenty of algorithms that do just that: Kalman filters, complementary filters, etc. But none of them should work if the accelerometers read zero all the time.

You said "The other option is to create a full inertial navigator, but that has its own set of (major) headaches."

Well, yeah that's the point, isn't it? At least understanding how to accomplish it.

- Roy
Comment by Roy Brewer on August 8, 2009 at 6:40am
Tom,

You said "The accelerometers will measure the accleration caused by any external force EXCEPT gravity. If you ignore aerodynamic effects like drag, then the only thing the accelerometers will measure is the total acceleration of the thrust. Since the thrust is only in the body Z direction, and without any aerodynamic forces, the X and Y accelerometers will never register anything."

I think I agree with this (even if it contradicts your earlier statement). But then how do the accelerometer based auto-level functions work on the quads that use them?

- Roy

T3
Comment by Brian Wolfe on August 8, 2009 at 2:18pm
I'm a little confused about the steady state conditions and what every bodies assumption are so let me start with a well defined situation and we can go from there.
First some definitions.
I'll call the earth frame the NED frame for North, East, Down. Gravity always acts in the down axis of the NED frame. If an object is sitting on a table (Or suspended from a string or thrust from a prop) such that it is not moving along the Down axis the measured acceleration do to gravity will be -1G (-1 because I define the positive direction of the Down axis as down).
I'll call the quadrotor frame that contains the accelerometers the Body Frame. Positive X will be forward, Positive Y off the right side and Positive Z down. Both of these coordinate frames obey the right hand rule for convenient use of matrix manipulation.
Accelerometers can be a little confusing as to what they measure in the presence of a gravitational field. One way I like to look at them is that they measure the difference between what the body is doing and free fall. If the body is in free fall, the accelerometer will read 0. If the body is sitting on a table such that it is not accelerating the accelerometer will read 1G in the up direction.
I think everybody is already OK with all this, I just wanted to define it to make sure.

Now if we assume the body is rolled a few degrees, and that the thrust is such that it is maintaining a fixed altitude (ie no motion along NED_Z) then the acceleration measured in NED_Z will be -1G. Our Body frame is no longer aligned with the NED frame since we're rolled, so this is not the Body_Z acceleration. We'll get there.

The thrust is always in the Body_Z direction, and since we're rolled and we've defined that the forces in the NED_Z axis are balanced (No motion in NED_Z) There must be some residual thrust in the NED_Y axis. This force will cause an acceleration in the NED_Y axis until it is balanced with the force of drag. So our next assumption is that the body has reached equilibrium. It is traveling along the NED_Y axis at a constant speed that generates enough drag to counter the force of the thrust along the NED_Y axis. In this situation the NED_Y acceleration is 0.

Under these conditions we have NED_Z acceleration = -1G and NED_Y acceleration = 0; Since the accelerometer sensors are in the body frame we need to rotate these NED accelerations into the Body frame. Since we have said nothing about pitch angle, we'll simplify this to a simple 2D rotation.
The Body_Y acceleration = Sin(Roll Angle)*NED_Z acceleration + Cos(Roll_Angle)*NED_Y acceleration.
The Body_Z acceleration = Cos(Roll Angle)*NED_Z acceleration - Sin(Roll_Angle)*NED_Y acceleration.
Since we've said the NED_Y acceleration is 0, those terms drop out. We're left with a vector of magnitude 1G that can easily be used to determine the orientation of the Body in the NED frame.

The next step is to look at what happens when the NED_Y forces are not yet balanced. I'll go there next based on feedback, but I will say that the NED_Y accelerations are generally short lived before equilibrium is reached and can often be ignored. I should also mention that this situation is different than the error caused by centripetal force as would be experienced in a long turn. In this case there is no body rotation and such no centripetal force.

What say ye,

Brian
Comment by Xander on August 8, 2009 at 4:24pm
Brian, you're correct so far, but I think too quick to dismiss the non-steady-state case. At low speeds drag is pretty low, meaning reaching steady state probably takes a little time. The best way to keep this quad level is to react quickly, not wait until steady state is achieved. Pretty sure it couldnt handle that sort of lag well.

When you assume that drag is negligible, the two components of the Body_Y acceleration end up canceling out.
Comment by Xander on August 8, 2009 at 4:51pm
The equations that get me there:
Body_Z*cos(angle)=NED_Z (1)
Body_Z*sin(angle)=NED_Y (2)
Body_Y=NED_Y*cos(angle)-NED_Z*sin(angle) (3)
sub eq (1) and (2) into (3)
Body_Y=Body_Z*sin(angle)*cos(angle)-Body_Z*sin(angle)*cos(angle)=0
Comment by Roy Brewer on August 8, 2009 at 5:06pm
Brian,

OK, I think I buy your argument that if the vehicle is not physically accelerating, the X and Y (body axis) accelerometers will not read zero and we can therefore use them (along with the Z axis sensor) to determine tilt. I realize now that this is what Tom was trying to say as well (sorry about the mis-understanding. I should have followed my own advice and drawn the drag on the free-body diagram).

I'm not sure I agree that the NED Y forces are short lived. Unless all the quad is doing is moving purely vertically (in the NED sense), there will be significant NED X and Y accelerations, both commanded and due to winds. If there's any hope of building a position-hold IMU, those accelerations have to be sensed.

Please go on and discuss your thoughts on the un-balanced NED-Y force case.

- Roy
Comment by Daniel Dyer on August 8, 2009 at 5:24pm
Roy,

You're certainly correct in that in the unbalanced force case (when the vehicle is still accelerating and drag forces are negligible), the accelerometer will measure an acceleration along the body-z axis of a magnitude (g / cos(theta)). Therefore, lateral acceleration while maintaining altitude is indistinguishable from pure vertical acceleration (at least using only an accelerometer).

This is why I wouldn't use an accelerometer to measure tilt on an unstable platform like a helicopter. Kalman filters can't magically make dynamic effects like this disappear, and misinterpreting the accelerometer reading in this way and combining it with gyro or magnetometer measurements will actually make the attitude estimate wrong in the accelerating case. I guess this is why you don't see many (any?) hobby helicopter autopilots doing aerobatics yet!

- Daniel
Comment by Xander on August 8, 2009 at 5:31pm
But you do see quads doing flips, and supposedly stabilizing better with the assistance of accelerometers. Which does not at all agree with the physics and leaves me (and Roy I believe) a bit baffled.
Comment by Roy Brewer on August 8, 2009 at 5:52pm
Xander,

The flips don't bother me - you can always ignore the accelerometers based on estimated attitude being too far from zero and/or the Z_axis accelerometer too far from 1 g. Its the near-hover leveling / gyro bias compensation that baffles me.

- Roy

Comment

Join DIY Drones

1

2

3

4

5

6

7

8

9

10

## Groups

784 members

1337 members

362 members

2838 members

• ### ROS User Group

154 members

Season Two of the Trust Time Trial (T3) Contest
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here