Fuzzy Quadcopter

Hi!!How are you??Last year, i design a stabilization system for a 3d helicopter, using neuro-fuzzy systems, it worked great!!!now, im designing a quadcopter, just like everyone else, hehehe, but with the same difference, its going to use fuzzy logic to stabilize itself...My hardware is the next:- Leaflabs Maple, Arm Cortex @ 72 mhz- IMU razor 9DOF with the onboard atmega- Hobbyking motors 30amps- Hobbyking ESC 30amps- Xbee pro 900mhz- Aluminum for the chasisMy plan is to first stabilize one axis, and then go the other, thats why in the picture you can see "something" that is holding down the quad, in the other pic you can see the proud owner, heheheheIm using a sugeno inference system, because it requires less computation power than a mandami.I got 5 membership functions, gaussians for more precise control.Its a simple one input (angle) two outputs (motors) system.Yesterday i started to test the stabilization system, but its not working nice... its oscillating, when i move the quad to angles more than -20 or 20 degrees, the control cant stabilize and the system oscillates...Im using the Maple analogwrite feature for writing the pwm to the 2 motors, also im using the 400hz update rate, so it supose to be very fast and smooth...You can see the videos in the next page:http://vargasmoreno.com/aldo/Quad/You can see how it oscilates...Im a little stuck, im thinking to implement a PID system to check is not the maple or the 400hz or another stuff, when i discart the hardware, then i will know that the problem is the fuzzy system, but im almost sure that the 5membership functions of the system is more than capable to do the stabilization task with no problems... so i dont really know what im doing wrong...Anyone has a idea???thanks!!!cheers!!

Quad2.jpg

Quad1.JPG

Quad3.JPG

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • hi Aldo Vargas,

    currently i am doing a project on uav incorporating fuzzy logic. I am using audrino pro mini Atmega 328 board. I am interested to find out how you implement fuzzy logic C codes into your quadcopter. Apart from that, may i ask if does my board support fuzzy logic? Thanks.

  • Hello, 

    I hope u completed your project.... I am also interested in quadcopter stabilization, I developed HefnyCopterFirmware it allows switching from X to Plus mode abd vice versa without board orientation or the need to install any new firmware as well as many features... 

    I came out with a suggested framework for quad control system, it aims to sort different sensors by usage, and clear the gery areas between them. I hope you find it useful

  • Hey Aldo, what kind of input membership functions did you use?

    Trapazoidal, Triangle, or possibly Guassian?

  • Oops! accendentally deleted a reply I didn't want to.

     

    Original reply was to Lew... I did tests on a BP hobbies 18A ESC and came out with a frame rate of 330Hz. I heard that some had achieved a frame rate of 490Hz and I'm considering doing more tests to see if mine cane do that.

  • Hey Lew,

     

    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...

     

  • Hi Allen,
    Do you want to post some code or pseudo code?
    Lew
  • 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).

  • Hi,

    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.

    Lew

This reply was deleted.

Activity

DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Monday
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident: https://t.co/G1pTxQug6B
Oct 23
More…