Hello All,

Got a new rudder/elevator easystar back in the air today, and when I switched to fly-by-wire it didn't roll-over and dive! Making progress.

The stabilization appears to be working, but it's over-correcting itself. The nose wobbles in a 12" circle when activated.

I've read through the manual, and searched on here, and it appears that I need to learn more about PID gains to reduce pitch and roll.

This is going to be my next stab in the dark. In looking at other *.h files, what I'm trying doesn't appear to be necessary, but it's where the docs seem to be pointing me.

pitch_P, pitch_I
roll_P, roll_I

Do the sensors have to be completely level at startup? ie: can the plane be leaning on a wingtip? I'm using FMA XY sensors for my XY and Z, and they're as level and plumb as I can make them on velcro tape.

Thanks for any tips!

//ROLL GAINS
//5-1
#define roll_abs .2 //Set point absolute...(Not Used)
//5-3
#define roll_P .17 //roll PID proportional .35 stock
//5-3
#define roll_I .17 //roll PID integrator .35 stock
//5-4
#define roll_min -25 //PID output limit in servo degrees
//5-5
#define roll_max 25 //PID output limit in servo degrees
//5-6
#define roll_Integrator_max 10 //Limit the integrator, to avoid overshoots
//5-7
#define roll_Integrator_min -10

//PITCH GAINS
//6-1
#define pitch_P .32 //Pitch Proportional .65 stock
//6-2
#define pitch_I .17 //Pitch integrator .32 stock
//6-3
#define pitch_min -25 //Pitch limits
//6-4
#define pitch_max 25
//6-5
#define pitch_Integrator_max 10 //Pitch integrator limits
//6-6
#define pitch_Integrator_min -10
//6-7
#define PITCH_COMP .30 //<------Very important, Pitch compensation vs. Roll bank angle.

Views: 8

Reply to This

Replies to This Discussion

The sensors do not need to be perfectly level at startup, but the z axis sensor does need to be pointing more or less vertical. Do not stand over the plane during startup or your body IR signature will impact the initial IR calibration....

Yes, you need to play with the 4 PID gains you have listed. Finding the best values for your setup is what you see referred to as "tuning".
I have never used ardupilot, however the gains you have selected seem a bit off. A general rule of thumb is to use no more than half of the P for I

Ex
roll_P = 1;
roll_I = 0.5; //no greater than 0.5

With that being said.....Roll shouldn't need any integral (I) gain or pitch for that matter assuming you have the plane trimmed out (which you should). I don't know why Jordi has these defaults as what they are but I can almost garuntee that the reason your controller is unstable is because of the integral term. I would set it at zero and you should be all set. If you do want to use a little integral keep in around 1/10th of P for almost all applications and never over 1/2

-Beall
Thanks for the information guys. I loaded up what I had above, and it appears that I got some much more controlled response from the servo corrections. Should be able to get it back in the air tomorrow.

Maybe try something like this:
#define roll_P .17 //roll PID proportional .35 stock
//5-3
#define roll_I .0 //roll PID integrator .35 stock

#define pitch_P .32 //Pitch Proportional .65 stock
//6-2
#define pitch_I .0 //Pitch integrator .32 stock

Need to start reading some more on what I'm actually doing with these numbers.

What kind of FOV do the thermopiles have? Laser beams or fans? My XY is mounted pretty close to my ESC, and if it's a wide fan pattern, the ESC may be affecting it.

Thanks again.
FMA states 120° view, thats wide.. I just received a new CoPilot II heres the manual.
The general idea is you want to start with I=0 and D=0 and take at a guess at P. Keep raising P until you get slight oscilations and then lower it back down to about 75-80%. Then I and D are used to fine tune from there on and is mostly not needed (ie pitch and roll).

Integral is used to cancel out steady state error. IE: altitude error if out of trim.
Derivate is used to smooth out oscilating control around the command point. IE: roll from heading

http://en.wikipedia.org/wiki/PID_controller
Hard to grasp from wikipedia because there arn't many examples but if you stare at the graphs long enough you can kinda grasp whats going on
I read through the Ardupilot code...its interesting how it's laid out. Granted I don't know your exact setup and servo calibration, but you should really be looking for a roll_P around 1.0 (for aileron control feedback) or so beings all of the error terms are in degrees. So your gain of 0.17 is probably going to be too low. I am surprised that Jordi's default is 0.35. This is most likely because his default servo calibration is set really high therefore requiring the roll_P to be lower. It really is relative but I like to have things make sense from top to bottom. Because this uses rudder to control roll, it kind of adds a level of ambiguity in the numbers making sense however because roll from rudder is a second order affect you typically would expect that the gain would have to be higher than 1.0 ....something like 1.5 -2.0. This is where I tweak the servo output gains to make these numbers make sense. I'm probably confusing you more but hope this helps.
#define SERVO_AILE_MAX 2400 //Range of Ailerons
#define SERVO_AILE_MIN 600

I would tweak these until the rudder movement looks about right (if I'm understanding the code right) for common sense control. For example. If the aircraft is wings level.....how much rudder movement would it take to get it to quickly get to 30deg angle of bank. Eye ball it and play with the numbers until a max and min setting as well as the roll_p =1.0 start to make sense given the output of rudder diflection.
Got it in the air this morning. Wow, it was really close.

The roll seems fine now, but it still wants to porpoise a bit, I'm going to take the pitch_P to .17 and see what happens.
Does your easystar have the stock rudder and elevator?

Mine, carrying a camera, has a rudder about 25mm wide and extending full height of the fin. I think that, because of this I will need to tweak the gains and your experiments may be a good starting point. Although as I have the rudder and elevator servos in the tail surfaces to balance the weight of the camera the throws may be different to yours.
I cut the rudder joint full length, and then added about 25mm to it, full-height using some balsa.

I'm in the furthest out holes on both the servo arms and the control horns. I guess that's max throw, but I'm honestly not sure.

I can see how the large rudder will affect these gains.

JC
John,
If furthest holes in servo and control horns are used then that would min throw not max throw , outer most holes on servo with inner most holes on control horns> more throw and vice versa combination would give more power(more fulcrum/less throw) ,just a thought
When does it seem to porpoise in pitch? After turns?....Straight and level? If Its after turns I have a sneaking suspision it might be something else.....If it is during straight and level then yeah the gain is too high. It should be pretty obvious though. EX: if you raise the nose up 20 deg the elevator shouldn't really move all that much maybe slightly more than 1/8th of an inch.

For servo stuff..... Out on arm & in on rudder horn = max throw
In on arm and out on horn = min throw
Let me know if you think it is during turns because it may be caused by something completely different

RSS

Groups

© 2012   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service