PDA

View Full Version : Help! Help on PID values for mini UAV


Mel Duval
Sep 07, 2006, 08:37 PM
Hello again, as usual I am asking for help. I was over at a friend's and he was working on a v-tail mini-UAV. Basic spec's are about 36" span single engine puller with a V-tail, fairly short coupled and no ailerons. He is programming his own autopilot and is having trouble with initial values for the PID constants (not 100% what that means, but that is what he was mumbling about...). He knows full scale very well, but it does not seem to be translating. Is there a range that he could use to start? Or something that is a "standard" set of values? I am an EE not an aero, so I just told you more than I know :rolleyes: :rolleyes: and probably don't know how to ask the question right....

Can anyone help?

THX!!
Mel D.

Unterhausen
Sep 08, 2006, 01:02 AM
there are rules of thumb, but the trick is the scaling factor between the sensors and the actuators. I always figured I'd fly under rc control and take data first and try to design a controller from that basis. I'm embarrassed I can't help more, but I'd have to futz around for a while before I could answer this question.

Ailuropoda
Sep 08, 2006, 02:11 AM
PID stands for proportional, integral, derivative. It's a combination of three different controller types. Lets just use cruise control as an analogy.

A proportional controller would try to set your throttle to something like (target speed - current speed) * proportionality constant. When you're way far off, such as when your current speed is zero, you'd have a high target speed multiplied by your proportionality constant and you get very high acceleration to try to get you close to your target speed quicker. Though notably when you're traveling at your target speed, (target speed - current speed) is zero, which tends to be problematic if you absolutely need to go that speed. There'll always be some error.

For anyone reading this without an understanding of calculus, (the wright brothers managed to fly without understanding aerodynamics so not neccisarily a prerequisite) an integral is basically a summation. For instance, if we integrated speed with respect to time, it's the same thing as measuring the distance traveled. An integral controller would set your throttle to (target speed * time traveled - current distance traveled) * integral constant.
Notably when you start traveling, you've been traveling for zero seconds and you've covered no distance, so your integral controller will wait a bit and slowly step on the gas as you start falling behind. There'll also come a time when you reach your target speed, but since you spent some time accelerating, you won't have gone the same distance as you would have if you were just traveling at a constant speed. The integral controller will keep accellerating and the police will pull you over for speeding.
If you don't get pulled over, you'll eventually settle at a point where you'll be going the speed you want, but you'll always be slightly behind the constant speed distance.

Hmm, what to say about a derivative controller? It's a bit of goofy one to think of in isolation. Once again for anyone who just doesn't get along with calculus, a derivative is the opposite of an integral, it is the rate of change. The derivative of speed with respect to time is accelleration. Notably, you can try to tweak your cruise control now without knowing calculus, though I wouldn't recommend it.
A derivative controller will try to set your throttle to something like
[(target speed - current speed) - (target speed - speed a little while ago)]/time between now and a little while ago * derivative constant
If we reduce this a bit, you get (speed a little while ago - current speed)/length of time * some constant. The derivative controller will step on the gas when the speed drops, ease off the gas when you start speeding up, but won't care how fast you want to go and will refuse to start your car. You wouldn't want to use it alone.

A PID controller just takes the sum of what each of the parts wants to set the output to and sets the output to that. Now that that's clarified and hopefully anyone looking at this understands what we're talking about, it's time for the hard part of trying to be helpful.

I suppose the questions to ask are what is the controller connected to for a sensor input and an output? What is it trying to control? What are the calibration constants for the sensor? What is the input range of the actuator? Then I'm kind of stuck. My tentative plan for when I got to this point was to glide a scale model down the basement stairs, where I've got two floors of height and some distance, and see how poorly I do at estimating my aerodynamic coefficients. Maybe I'll come up with something better later on when I've gotten around to building something.

Unterhausen
Sep 08, 2006, 10:32 AM
Your post brings up a good point, what's the level of experience of this person?

gliding a scale model down the steps gets you past the first crash right away, that's for sure. On my plane, you can switch back and forth between autonomous and manual by toggling a switch. So it makes sense to try to come up with something reasonable and just fly it. Low gains are usually a good place to start.



Some things about the gains: Proportional gain is usually the dominant term, since it represents the correction for the error between where you are and where you want to be. The derivitive gain usually adds stability, at the cost of adding noise. It's usually fairly limited. The integral gain is destabilizing, but if you are worried about errors, such as a heading error, it is useful.

My experience playing with PIDs in simulation is that if stability is a problem, I want to add derivitive. In real systems, the derivitive term is often zero due to the noise.

Mel Duval
Sep 08, 2006, 09:49 PM
Thanks, guys. Now I have better questions to ask. Maybe I can get lucky....

later!
Mel D.

Mel Duval
Sep 10, 2006, 02:41 PM
Well, brute force has one redeeming feature. It works. After a LOT of trial and error including toggling back and forth many times (as was suggested...), it is working. (My friend also called the guy who made the autopilot board....).

Thanks!

Mel D.