Sorry if I fail to follow some of the social graces of posting stuff ..... I don't post very often.
I can't see the video .... all I get is single frames in the avi(s).
What do you have by the way of fuzzy logic?????
Sounds like you need more of something like this. (a fuzzy suggestion)
If the rotation around the axis is high towards the target and the target is close then slow the rotation down.
My guess is that the output for the "over 20 degrees" range is too much, and when the quad approaches the "Stable" area, the quad does not attempt to slow itself down and instead perpetuates.
How are you treating the output of the fuzzy compensator? are you saving the differences to an accumulator (think of a capacitor) first, or are you directly changing the output?
You may also need to add another set of input membership functions to handle rate error, or the rate the sensed angle is moving away or toward the desired angle.
I'm actually having a similar problem myself using fuzzy logic... but with a more 16-bit solution. Found out my test rig wanted to make the quad an inverted pendulum, so I can't tell if my problem is due to that or what your having (...or had).
Had a successful test run just a few minutes ago, the new deadweights moved the center of mass close enough to the test rig's pivot so that the controller can work now. Had a few moments where the thing got itself nice and level, but more tweaking is needed to make the operation smooth and steady.
As for the pseudo code.. well, the rule table itself is pretty straight forward, problem is adjusting the input and output membership distributions.
EN2 EN1 EZ EP1 EP2
ERN: TP3 TP1 TP1 TZ TN2
ERZ: TP3 TP1 TZ TN1 TN3
ERP: TP2 TZ TN1 TN1 TN3
Uh, one of these days I need to learn how to do HTML tables..
Anyway, this form of a rule table is read by going through the rows and columns to find the output. All letters on the top row and leftmost column are accronyms for the membership names . For example, EN2 is Error Negative level 2, ERZ is Error Rate Zero, and EP2 is Error Positive level 2.
The output fuzzy variables are in a similar fashaion, ex: TP2 is adjust Thrust by Positive level 2.
This is an And table, so you read it by doing so: If (error level) AND (error rate level) THEN (Output). Example:
If EP2 And ERN Then output is TP3.
For those of you wondering "why the fudge would anybody want to do THAT??" I say, Fuzzy Logic controllers are far more mathmatically simpler and have the potential to execute far faster than traditional controllers such as PID, PD^2, and robust controllers. Additionally, they are "guess and check" friendly for any unknown system, and can control very high order systems with ease (and with fewer math).
Downside is... the membership functions can take a while to get properly set up, also some of the nicer membership functions (gausian) are too CPU hungry to use in formula form... but you can use a tabulation method if you really wanted gausian (trapazoid's and triangles do just fine).
Anyway, back to the rule table... my partner was the one who came up with that awhile back and I haven't had a chance till today to really test it out. And yes, the rule matrix should probably be a 5x5 square...
That all sounds right.
I am sure that a 5x5 matrix will do the trick.
Looks like Aldo has it sorted.
May I ask what board you are using?
I will be starting with a KK multicopter board (hobbyking version).
I am currently finishing an FPV plane.
Can't wait to see the video.
Glad you got it to work! Any wobbles?
I'm using the MicroDragon board from EVBplus.com. It's just a pinout board for the Freescale MC9S12DG256 along with a crystal and other basic components to get it running. It doesn't have a voltage regulator... which is a good thing because you can make your own power board and use it off of almost any battery.
I chose the 9S12 chip because I knew a good portion of the assembler language for that chip, plus it has built-in support for fuzzy logic.
Why not use the BEC on your speed controller?
Your board needs a 5V VCC line so that should be a good fit.
If your going to add FPV later, just get a 5V camera and transmitter and you can run the whole lot from your BEC.
eg. TURNIGY Plush 12amp (2A BEC) BESC
The original MiniDragon board that I was using needed an input of 9 to 12V because its onboard regulator needed it. I didn't see any good way of bypassing it, so I just used a seperate 9V regulator to pass power to it.
When the new MicroDragon board was installed on the new quadrotor, I had forgotten that the ESC's can provide up to 2A with 5V. Since we're using 4 ESC's, the maximum 5V ampherage we can use would be 8A... way plenty for anything.
I'll have to look at that sometime later, thanks Lew!
Are your ESC's anything special?
I saw a video on youtube with a quad where the guy re-programed the esc's to have really fast responses. This helped with stability.