PDA

View Full Version : Discussion gyro vs accelerometer vs magnetometer


jetheller
Oct 10, 2007, 02:06 PM
For developing aircraft attitude (orientation), If you have a 3 axis magnetometer, why would you need the gyro and accelerometer? Could you find the delta in between samples to derive rotation direction and rate?

Is the answer as simple as the combined data is used in a Kalman filter to get a more precise result?

Unterhausen
Oct 10, 2007, 04:30 PM
magnetometers are not very good. They are best used to correct the gyro and accelerometer errors, because the error in the magnetometer reading doesn't grow with time.

So you are correct that magnetometers are best used in some kind of Bayesian filter to correct the errors that you see with inertial measurements.

semak
Oct 11, 2007, 03:40 AM
can i use only accelerometer for attitude control.i have adxl202 and it can be used as a tilt sensor.so i want to use it for roll and pitch control.

m1tch37
Oct 12, 2007, 12:05 AM
I originally wanted to do just what you thought and use a magnetometer from OceanServer, but as they put it:

Aircraft Note: Most electronic compasses use gravity to detect level and tilt with accelerometers to measure tilt (including OceanServer compasses). The tilt angles are determined by measuring the earth’s static gravitational vector. Since, dynamic and static acceleration are indistinguishable when used in aircrafts with high acceleration and banking turns, the dynamic acceleration will introduce an error in both roll and pitch angle reported by the compass as well as heading errors. Only level headings will be accurate when aboard a plane and vibration needs to be considered. Strong vibration also applies acceleration to the compass and can cause errors if the amplitude of the acceleration is significant as compared to the earth’s 1G acceleration due to gravity
so it appears best not too... and most commercial products that dont suffer from such errors cost a fortune.

jetheller
Oct 12, 2007, 09:15 AM
m1tch37,

Have you looked at Sparkfun's Magnetometer (http://www.sparkfun.com/commerce/product_info.php?products_id=244)? It measures the x,y,and z access using only the magnetometers aligned orthogonally on the chip. It even has several modes for polling the data. You can pull filtered pitch and roll and get then find yaw by polling the compass. Or you can poll the filtered x, y, and z axis. You can poll the raw data. And you can poll the temperature (which is used in internal filters). As with most magnetometers, its .1 degree accuracy is probably only true with yaw. But if I could get pitch and roll within ten degrees I would be happy, as finer corrections could be derived using altitude delta and speed for pitch and the finer yaw could be used to refine roll.

At this point I'm just musing. I'll be ordering parts within the next month to start playing and see what the realities are.

Cheers.

d_wheel
Oct 12, 2007, 09:20 AM
can i use only accelerometer for attitude control.i have adxl202 and it can be used as a tilt sensor.so i want to use it for roll and pitch control.

The simplest way to detect bank (tilt) in an aircraft is to use a rate gyro in the yaw axis. If the aircraft is turning (yawing), then it is most likely banked in the direction of the turn. Correct until there is no turn and you are level. This is how it is done in most light (full size) aircraft autopilots and has worked well in several experiments I have carried out in model aircraft as well.

Sensing pitch is not quite as easy. If you are simply attempting to use pitch to control altitude, then using a pressure sensor works fairly well. When the pressure is falling, you are going up and vice-versa. However, if you are trying to avoid a stall attitude, you will have to use some kind of angle of attack sensor. I haven't done any experimenting in this type of sensing so can't be of any help.

Later;

D.W.

m1tch37
Oct 12, 2007, 10:08 AM
jetheller,

Wrong person to ask as i am in the same position as you but from my research they are not accurate when turning. However, the 6DOFs from sparkfun would work.

Mitch

Unterhausen
Oct 12, 2007, 01:28 PM
I have played with the Sparkfun magnetometers, they don't seem too bad. My experience with them is such that I would never use a magnetometer as the only sensor in a feedback control. For example, the magnetometer in the XBow uNav will radically change directions depending on how close it is to the ground

clolson
Oct 12, 2007, 02:13 PM
Let me add to Unterhausen's comments based on my experience with the Xbow uNav and the Microbotics MIDG-II. Both of these units combine gps + 3 axis gyro + 3 axis accelerometer + 3 axis magnetometer.

The conclusion is that it's really hard to get a quality estimate of your roll, pitch & heading, even with a full sensor suite like this. The math is complex and hard to derive. The results are very sensitive to tuning, it's very easy to have subtle bugs, and it takes a fair amount of cpu power to crunch out a full solution ... this is especially problematic if your code uses floating point math which often isn't available on low power embedded cpu's.

The MIDG provides a pretty high quality full IMU/INS/GPS solution, but it is all closed source and relatively expensive $5-6k range.

You can get the uNav up and running for somewhere in the $2k range with open source sensor integration code, but the quality of the open-source code is on the low end. You have to buy Xbow's higher end products to get something bundled with their quality math routines (but then those are all closed source.)

Just to give you an idea of how much fun this all is, the uNav code uses the gravity vector to estimate pitch and roll, but this is combined with gyro data to try to keep some sensibility in the solution when you are moving and accelerating. The roll estimate seems like it tracks pretty good, but I've seen up to 30-45 degrees of pitch error during steep turns where you are pulling > 1 G.

The attitude estimate is used to interpret the magnetometer data to get a heading estimate, but if pitch is 45 degrees off, the heading estimate is going to be way off as well. I've seen heading errors as high as 180 degrees ... in other words, as wrong as they can get, and I've seen the heading estimate be pretty close ... all within a single flight.

The good news is that these errors combined with a reasonably tuned flight control system seem to yield a system that will converge to the right answer ... in other words, you can get usable uav flight out of this, it's just not always nearly as nice as you'd like.

So essentially you have a situation where you are pretty ecstatic if your pitch and roll estimates are with in 10 degrees of the truth and you need to be able to live with maybe 20 degree errors and survive 30-45 degree errors.

That said, I've been able to go out on calmer days with my xbow unav based system, fly a closed loop pattern, and get pretty repeatable flight paths. So my summary would be that you are going to get *way* more errors in your sensors than you'd expect by reading the specs and dreaming about algorithms. But if you are careful and understand the systems, the sensors, and their limitations, you can still use them to build pretty functional systems. And the hope is that as time goes forward, the sensors and the publicly available math routines will continue to improve so life will hopefully continue to get better (but maybe not at the pace we'd like to see) :-)

m1tch37
Oct 12, 2007, 07:34 PM
The MIDG looks great, but is far to expencive for me :(

So are you saying they are so highly priced because of the difficulty to create or because of high price components?

clolson
Oct 12, 2007, 09:20 PM
My guess is they are "high" priced due to the effort they've put into their math and programming, not so much the cost of the compenents. But count up the cost of building something of similar capability/performance yourself from scratch, even if you only charge $1/hr of your own time and after that it probably won't seem nearly as high priced. :-)

Curt.

gael.desilles
Oct 17, 2007, 03:37 PM
The cost of an Inertial Measurement Unit such as MIDG is essentially due to the so-called "stability" of the sensors : these might be of poor pure performance, but once calibrated the measurement errors remain close to their calibrated values a pretty long time. The biases, scale factors and misalignments are therefore easy to estimate through a Kalman filter or any calibration procedure that fit, and compensated.

Lower-end units are less stable in time, making them hard to trust.

Hope this helps.