PDA

View Full Version : Need help with autopilot design (sensors)


JeffElecRC
Oct 26, 2005, 12:23 AM
Hi,

About me:
I'm an electrical eng student at Carleton U in Ottawa, Canada. I'm interested in making my own autopilot from the ground up (starting with the stability and control portion, then moving up to the navigation functions). I've been doing alot of research on the sensors and control loop aspect. I'm a capable programmer in ASM and C, and I can do circuit design; however, my control loop theory is a bit lacking (especially the practical implementation thereof). I was hoping you guys could help me out here.

My question:
I originally planned to use two SMM gyros from analog devices for the roll/pitch axis. My research indicated that a gyro alone would result in drift over several minutes due to integration error. Is it possible to increase the sampling rate to completely eliminate this? i.e. assuming I'm using 8-bit microcontrollers, use a stand-alone uC for each gyro, sample and integrate it as fast as possible, and return the integration sum to the autopilot processor?

If I incorporate an acceleromter to measure tilt in the same axis as the gyro to "realign" the gyro integrator to center... how do I incorporate the accelerometer into the feedback loop without it feeding incorrect readings during a coordinated turn?

My other thought was to use differential accelerometers, one on each wingtip, and a double integrator to measure roll of the aircraft. I presume that gravity and centripedal force during a coordinated turn will be the same on both wingtips therefore integrating the difference between the two of them should give you roll. Is there any problem with doing this? Or do I face the same problem of gradual integration sampling error? Could this be compensated for by adding a condition that says if the aircraft is "approximately" flying straight-and-level according to the integrator, and the values of the accelerometers are the same, then reset the integrator to zero.

Anyway. My last question is could you guys give me some links to good PRACTICAL information about autopilot control loops and implementing them in code?

Thanks alot. Sorry for the wordy post!

Unterhausen
Oct 26, 2005, 05:37 PM
I originally planned to use two SMM gyros from analog devices for the roll/pitch axis. My research indicated that a gyro alone would result in drift over several minutes due to integration error. There is a fairly constant bias in the gyro output. It can be gotten rid of by estimating while the aircraft is stationary. This may be sufficient for short flights. Or it can be gotten rid of more reliably through redundant sensors. It seems like the combination of 3 axis each of accelerometers, gyros, and magnetometers in addition to gps probably works very well. Less than that and you may be better off with thermopiles.

If I incorporate an acceleromter to measure tilt in the same axis as the gyro to "realign" the gyro integrator to center... how do I incorporate the accelerometer into the feedback loop without it feeding incorrect readings during a coordinated turn?

The answer to all your questions is probably "Kalman Filter" -- a commonly used method of correcting for biases is to treat them as an extra state in the filter. Then the residuals of the Kalman filter estimates the bias states. The idea is that you need to know what the aircraft is doing in order to know what the sensors are going to tell you. I'm sure you could do it without a Kalman filter, but it may not be robust.

Vindication
Oct 26, 2005, 05:49 PM
Yes the Kalman filter does an interpolation between your sensors and your expected state(using physics/math from your last state). You can then use this to compensate for drift etc.

JeffElecRC
Oct 26, 2005, 08:48 PM
Thanks for the replies. I read a bit about Kalman filtering from the "Autopilot" project on source forge. They argued that Kalman filtering would not be feasible on a small 8-bit controller. I probably should have stated that I want to use Atmel 8-bit RISC controllers. I'll read up more on the topic. Thanks guys.

Unterhausen
Oct 27, 2005, 01:17 PM
what did autopilot use?

A Kalman filter does an update cycle that is very expensive because it is propagating the error covariance matrices and then calculating the kalman gain. You could use a least squares filter that probably will be just as effective. The point is that you need to figure out the relationship between your control states and the sensor readings. Once you do that, you'll have the answers to your questions in the form of equations. But I would start out from a kalman filter perspective and figure out how to set my gains through experimentation.

moon-dawg
Oct 28, 2005, 12:42 PM
The autopilot project used a Kalman filter in the INS code. They inlined the code so that it was compact and quick. So far it is the only complete C source code for a Kalman filter that I have found on the web.

moon-dawg
Oct 28, 2005, 01:09 PM
If you want to play with a Kalman Filter there is demo programmed in Matlab 7.0. Look up Help | Demos then Matlab | Toolboxes | Control Systems | Case studies | Kalman Filter.

Part of the algorithm requires a matrix inversion. If you keep the size of the matrix small then you should be able to use an 8 bit processor. One trick is to keep track of the position error (instead of position, velocity) then you only have to invert a 3x3 matrix.