YMFC-3D part 5 - Quadcopter PID controller and PID tuning.

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

ความคิดเห็น •

  • @manoelguidialvares6903
    @manoelguidialvares6903 5 ปีที่แล้ว +8

    I am a control and automation engineer, who just finished a master in mechatronics. I am a true passionate to control engineering, and since 2013 when I was first introduced to control systems,i have NEVER EVER seen such a good simple explanation to a PID, specially regarding the derivative part. Actually, I only could reason about it by thinking about poles or spectral analysis. But your simple yet extremely clever explanation and demonstration gave me a new light on this subject and gave me a more 'physical' feeling about it, which IMO is essential to an engineeer.
    I also want to build a drone from scratch a a hobby, and your YMFC serie is simply tailormade to my needs. I am infinetely grateful for your contribution, and hope you keep posting such good videos and projects. Keep on the AWESOME work, you are an inspiration !!!
    Best regards !!

  • @mickcooper8605
    @mickcooper8605 7 ปีที่แล้ว +3

    Having never flown a quad or any other RC model before I have watched these videos over and over again then took the plunge. I purchased some secondhand 2830 motors from ebay, made up a 450(ish) frame from upvc pipe fitted it with 30A esc's one of which was Faulty ! I used a "Beestore" pro mini which is fitted with an AMS1117 voltage regulator supporting up to 800mA for the controler. I loaded and ran the setup and calibration sketches and all worked fine. This evening I loaded the controller sketch and she flew straight out of the box even with an "odd esc". My activity's were cut Short by the weather but with a bit of tinkering (and four matching esc's) I'm going to have hours of fun. Thanks Joop for all your hard work and the many hours you have put into these videos, your explanations and demonstrations of how it all works are second to none. I just wish I were better at the coding side but I fear age is not on my side. LoL

  • @siddhantchaudhary4946
    @siddhantchaudhary4946 5 ปีที่แล้ว +13

    You're the inspiration of millions of future engineers..... Respect

  • @tacpreppers4906
    @tacpreppers4906 6 ปีที่แล้ว +14

    Hands down, the best PID explanation I've seen so far, and being a quad/fpv pilot, I've seen many, . Joop, you're an ace, thanks for taking the time to do this. It's on the shoulders of "giants" like you that we build. Keep up the excellent work.

  • @blrcnc9848
    @blrcnc9848 8 ปีที่แล้ว

    Hi, I am a CNC hobbyist. I am absolutely a novice to Audrino. Your video series is an inspiration for me to explore the audrino world. I have already place an order for UNO after seeing your video. I may not understand everything right away. But your explanation breaks down everything and logical to understand. Thank you so much for putting together this wonderful video series. I am excited as hell to start with this Quadcopter project.
    Thank you,
    Nave

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      Thank you for taking the time to write this positive comment.

  • @karnikram
    @karnikram 9 ปีที่แล้ว +39

    Hello, thanks a lot for this much needed video series!
    Just want to point out a slight error in one of the equations at 3:36.
    It should be,
    D-output = (gyro - receiver - gyroprev + receiverprev)*Dgain
    and not,
    D-output = (gyro - receiver - gyroprev - receiverprev)*Dgain

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว +9

      Karnik Ram Hi, gyro - receiver is the error and represents the 'e' in the equation at 1:51. The error is always calculated the same. In your line the previous error is calculated different than the actual error.

    • @karnikram
      @karnikram 9 ปีที่แล้ว +16

      Previous error = gyroprev - receiverprev
      Current error = gyro - receiver
      Current error - previous error = (gyro - receiver) - (gyroprev - receiverprev) = gyro - receiver - gyroprev + receiverprev
      Negative sign negates the negative sign.

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว +26

      Karnik Ram Yes, you are right! I should have added brackets in the presentation sheet. +1 for you sir!

    • @warren1192
      @warren1192 3 ปีที่แล้ว

      thank you sirs to both of you for pointing out a bracket error... and at the same time confirming there was an error

  • @wanderreels7385
    @wanderreels7385 3 ปีที่แล้ว +1

    I was lookign for someone who could teach every bit of coding that was necessary for building the drone . And I am very happy with the content you have posted. Thank you so much.

  • @MrFlashgrenade
    @MrFlashgrenade 9 ปีที่แล้ว +3

    I find this is the first video that actually explains in detail what PID settings do. Thank you very much!

  • @MrHristoB
    @MrHristoB 4 ปีที่แล้ว +1

    I'm new to the multirotor business and this must be one of the BEST and clear PID explanation!!!! Bedankt Joop!!!

  • @tamasgiraszi7449
    @tamasgiraszi7449 7 หลายเดือนก่อน

    This is an amazing series! I started to create my own drone, with some knowledge which I never use before. This series helps to the whole knowledge in context and make my understanding deeper.

  • @VincentArdolino
    @VincentArdolino 8 ปีที่แล้ว +9

    Your explanation and test models are awesome. The best explanation of what P & I & D actually are as demonstrated with physical models.
    Keep up the good work

  • @samantareboredo7665
    @samantareboredo7665 ปีที่แล้ว +1

    thank you. I just wanted to thank you for the enormous professional work you have done. My drone flies wonderfully thanks to you. I congratulate you immensely.

  • @mcynelly1637
    @mcynelly1637 8 ปีที่แล้ว +9

    The best tutorial about PID that I have ever seen.

  • @evgenyyakimov7779
    @evgenyyakimov7779 4 ปีที่แล้ว +1

    This video is Excellent! I found it very easy to pick up this complex topic with very little background in the area. Thank you for your efforts!

  • @pricedempler
    @pricedempler 3 ปีที่แล้ว +1

    Thank you for showing the code AND the resultant behavior on the quad. Big help!!!

  • @JuanAriasArias
    @JuanAriasArias 8 ปีที่แล้ว +8

    Very good job. The best tutorial about PID that I have ever seen. Thank you so much.

  • @nikodembartnik
    @nikodembartnik 8 ปีที่แล้ว +1

    Hi
    I am working on my own flight controller I almost finished it. Currently I am working on stabilization. I saw your code and I don't know how you can use deg/sec as input for PID. Let's say that your quad isn't moving and it is tilted 45 deg, your program wouldn't see that. In my program I use degrees as input for PID but I have some problems with tunning. You can see my quadcopter at my chanel. I want to ask how big should gains be for degrees input. Thanks!

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      This is the 3D version. So the PID will try to match the gyro and receiver input.
      The YMFC-AL however has an auto level feature. It's explained in this video:
      th-cam.com/video/DYpHB-LfloI/w-d-xo.html

    • @nikodembartnik
      @nikodembartnik 8 ปีที่แล้ว

      Thanks for quick answer. I know but I can't understand how you can use deg/sec for PID input in auto level version, how is it possible. And can I use degrees instead of deg/sec?

  • @CRAhome
    @CRAhome 5 ปีที่แล้ว +1

    Excellent explanation. Very good introduction for newbies (and probably more advanced users). Thanks a lot!

  • @lard_dork
    @lard_dork 9 ปีที่แล้ว +23

    D output = ((Gyro - Receiver) - (Gyro Prev- Receiver Prev) ) * D gain

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว +7

      +Brian Boozebacon Not many people have seen / noticed this typo in the presentation ;-) +1 for you!

    • @GOLDFINGER412
      @GOLDFINGER412 8 ปีที่แล้ว

      +Brian Boozebacon just noticed the same error.

    • @rohanselvan4339
      @rohanselvan4339 6 ปีที่แล้ว

      Thanks for clarifying!

  • @theconcerned9113
    @theconcerned9113 7 ปีที่แล้ว +1

    Thanks, Joop, you have done the best drone tutorials I've ever seen.

  • @imranzahoor4407
    @imranzahoor4407 8 ปีที่แล้ว

    I'm really out of compliments this time because every compliment is less worthy than your work. Brilliant work I've ever seen. Thank you so much. Your videos helps me a lot in my final year project of electrical and control engineering.
    bundle of thanks and salutes for you.
    regards.

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว +1

      Thank you for taking the time to write me this message. Really appreciate it!

  • @somiprakash1347
    @somiprakash1347 4 ปีที่แล้ว +1

    Excellent video , going into the practical approach to designing PID loop into mcu ..

  • @subhadeepchowdhury5244
    @subhadeepchowdhury5244 2 ปีที่แล้ว

    Very useful videos for those who are building their own flight controller. Special thanks to mention that D gain should be fixed first.

  • @freddiesnijman
    @freddiesnijman 9 ปีที่แล้ว +32

    Excellent! PID, make more sense to me. Besides that I admire your teaching/coaching talent.

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว +2

      Freddie Snijman Thanks for the compliments!

    • @a_aron30490
      @a_aron30490 8 ปีที่แล้ว +5

      You are a brilliant person, your videos really help me out in my computer programming class and our arduino projects

  • @CineSoar
    @CineSoar 8 ปีที่แล้ว

    I've been watching with interest. Thank you so much, for a well annotated sketch, as I will be doing this project with my son and it is a great help, to see each line described so well. When I saw your excel spreadsheet for PID, I decided to duplicate it, so I could play with the values myself. What I found very interesting, was to calculate and graph the PID Output, as well. I found this very useful, to show how changing the gains from 'neutral' (all = 1), to your actual flight values, dramatically changes the PID Output, from something that is dominated by I, to a shape that looks much more like D, with a trendline influenced by I. I also found that the graphing the effects of over and under tuning each value in turn, allows you to see how that behavior exhibits itself in the reaction. There were a few 'aha' moments, as I began to visualize how a large change in value for a certain gain, changes the response profile. Combining this with the airframe behavior (from watching your's and other's tuning videos) is pretty powerful. You might consider a supplemental video, exploring this in more detail.

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      Thank you for your reply and that this video was educational.

  • @HanSolo1
    @HanSolo1 7 ปีที่แล้ว +1

    Thank you for the build tutorial, after a couple months this semester research project for me just flew a few minutes ago, after some pid tuning frustrations!!!

  • @fifaham
    @fifaham 2 ปีที่แล้ว

    @3:39 Is there a mathematical error in the D calculation ( (error) - (previous error) ) or am I wrong? Just curious. I am talking about the signs in the equation.

  • @avacomputer2819
    @avacomputer2819 6 ปีที่แล้ว +3

    Hello, thanks a lot for this much needed video series!
    The best tutorial about PID that I have ever seen!

  • @MilanKarakas
    @MilanKarakas 9 ปีที่แล้ว +1

    Excellent tutorial, and the best explanation what (the hell*) is PID or PI on my KK2 board (there is no derivative, or D setting). At first it looks incredible complicated, but in your series of videos - if explainded as you just did - now it look much more clear and easy to understand.
    Thank you very much.

  • @claudiofe8318
    @claudiofe8318 9 ปีที่แล้ว +1

    as you may know that the maximum output is 400 pid?
    float pid_p_gain_yaw = 4.0; //Gain setting for the pitch P-controller. //4.0
    float pid_i_gain_yaw = 0.02; //Gain setting for the pitch I-controller. //0.02
    float pid_d_gain_yaw = 0.0; //Gain setting for the pitch D-controller.
    int pid_max_yaw = 400; //Maximum output of the PID-controller (+/-)

  • @elliotg8403
    @elliotg8403 3 ปีที่แล้ว +3

    I'm confused why you've used gyro deg/s as your set point. Surely it would make sense to use the actual deg value otherwise the quadcopter could stabilise its gyro angle rates without actually being level itself?

    • @shahidanaznin5809
      @shahidanaznin5809 8 หลายเดือนก่อน

      Yes, these angel mode flight controllers perform better but I guess the reason of using a rate mode flight controller is that the calculations are simpler. So the required time for one cycle is low. Note The flight controller needs to run at least at 250 hz.

  • @InnosWei
    @InnosWei 6 ปีที่แล้ว +2

    Hello Joop, your videos are great, I am wondering about one thing though. What do you need total angles from gyro+acc if you only use the gyro angular rate for your PID control? Is using angles and assumming the transmitter stick position inputs desired angle of the quad is a wrong approach?

  • @a..d2062
    @a..d2062 5 ปีที่แล้ว +3

    QUESTION:
    Dear Joop Brokking
    for the PID part,
    (pid_error_temp = gyro_roll_input - pid_roll_setpoint;)
    why are you subtracting a mixed (accelerator and gyro) value with a purely Gyro value to find the error.
    As you have stated that the Gyro value on its own is not accurate hence we must use a mixed (accelerator and gyro) value as it is accurate.
    I thought you would have used a mixed (accelerator and gyro) value and subtracted it from another mixed (accelerator and gyro) value.
    hence giving us a accurate pid_error_temp value.
    I am really confused about this matter please can you help. thank you

    • @donyip9674
      @donyip9674 ปีที่แล้ว

      poor child, it has been 3 yrs, Mr. Joop still didn't answer u

    • @a..d2062
      @a..d2062 ปีที่แล้ว

      @@donyip9674 One day my brother, one day he will.

  • @qmu2
    @qmu2 8 ปีที่แล้ว

    Hello +Joop Brokking
    how u decide to use this equation for the complementary filter? and why 80% 20%? and why do you divide the gyro roll output by 57.14286?
    why did you subtract 8 from 500? and why did you divide by 3 at 10:35 ?
    thanks

  • @yusufaksel2516
    @yusufaksel2516 4 ปีที่แล้ว

    Hey! Great tutorial series, thanks. I wondered something, what is the working principle of your test setup at 1:00 ?

  • @RSP13
    @RSP13 5 ปีที่แล้ว

    PID is now much cleaner for me. Thanks

  • @CountDownToDisaster
    @CountDownToDisaster 9 ปีที่แล้ว +1

    Hey, Joop, how is it that we can control two of the ESCs through D7 and D4, even though they aren't PWM pins (they don't have the ~ thing by the number)? Isn't PWM required to send pulses to an ESC?

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว +2

      I don't use the hardware PWM function for this project. Watch part 4 (ESC) on how I created the pulses for the ESC's.

    • @sandervanleeuwen9395
      @sandervanleeuwen9395 8 ปีที่แล้ว

      +CountDownToDisaster He doesn't use PWM, but he uses PPM, this way the ESC's only have to be updated once in a cycle. This is faster because the processor won't have to switch the port from time to time as you have with PWM

    • @nemobondt9117
      @nemobondt9117 7 ปีที่แล้ว +2

      don't listen to sander. he doesn't use ppm.

  • @bogdannica79
    @bogdannica79 7 ปีที่แล้ว

    Joop , it is a little hard to understand the units of measurment for the variables.
    1. For example at 9:21 you say that the gyro and reciever inputs are in deg/s and then you divide the gyro_roll so as to get the deg/s but the gyro already gives angular velocity measured in deg/s ?
    2. It's not really clear to me how exactly you transfer the reciever input(wich is in pulse length) tu deg/s and viceversa for esc commands.
    Ido not get this here ,please enlighten me .
    Thanks

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      Maybe this video will give you some more insight:
      th-cam.com/video/DYpHB-LfloI/w-d-xo.html

  • @tarekelmanshawy9201
    @tarekelmanshawy9201 6 ปีที่แล้ว

    Please ,enable subtitle option in all your videos to make more people who aren’t fluent in English,understand what you talk about.
    Thanks for efforts.
    Follower from Egypt.

  • @joeprince7509
    @joeprince7509 9 ปีที่แล้ว +1

    I've watched this video many times now (which is great by the way), but there's one fundamental thing that I'm not understanding in regards to the rate mode.
    If the error is the difference between the gyro reading and the user's input (in deg/s), then when the quad starts rotating and approaches the desired rate won't the error decrease to 0, meaning there is no correction factor and just the throttle value is written to the motors? Perhaps I'm missing something?

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว

      +Joe Prince Yes, the error will decrease to zero. But the pid-controller will work on it to keep the desired rate.
      So my input is 20deg/s and the quad rotates 20deg/s. The error is zero and only the throttle will drive the motors.
      But when the quad rotates 19deg/s the error is 1deg/s and the motors are corrected.
      In practice the error is never zero. The controller is constantly correcting the multicopter. It goes so fast that it looks steady. But in fact the multicopter is very unstable.

    • @joeprince7509
      @joeprince7509 9 ปีที่แล้ว +1

      +Joop Brokking I appreciate the insight and information. I have a question in regards to this line: "The error is zero and only the throttle will drive the motors."
      If the error is zero and only the throttle is driving the motors (let's say 50% throttle or 1500µs), then how is the quad rotating? Don't we need a difference in motor speeds in order to obtain rotation? That's kind of what my first question was referencing, the fact that if our error is zero then we're writing the same value to the motors (in this case the throttle) which in my mind means the quad is not rotating. Am I completely misinterpreting this?

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว

      Joe Prince
      As I wrote, in practice the error is never zero. And if it becomes zero during rotations the I-controller is 'loaded' and will make the quad rotate.
      But you are right about the fact that the multicopter does not rotate that well with all the 4 motors spinning at the same speed.

    • @joeprince7509
      @joeprince7509 9 ปีที่แล้ว

      +Joop Brokking Does that mean it wouldn't be possible to write a "P" only controller for rate mode, since there is no "I" term to build up?

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว

      Only a p-controller will not work. You need at least p and d to make it fly. If you look @14:00 in the video you see that I fly the multicopter with only the p and d controller. It fly's but does not feel locked in. The i-controller makes the multicopter locked in.

  • @carlscrivener2462
    @carlscrivener2462 5 ปีที่แล้ว +1

    Great video! Can I ask why the roll limit is set to 400? Is this an arbitrary number?

  • @kripeshram4781
    @kripeshram4781 6 ปีที่แล้ว +1

    Hey Joop, my quad is yawing violently when I use the pid-i as in your code
    -> pid_i_mem_pitch += pid_i_gain_pitch * pid_error_temp;
    The i - gain seems to happen even when the quad is stationary and there is no change in angle!
    But when I changed it to -> pid_i_mem_pitch = pid_i_gain_pitch * (pid_i_mem_pitch + pid_error_temp);
    It worked fine. Have I made an error elsewhere in the code which could have led to this?
    Thank you for the amazing videos! I have learnt so much from them.

  • @a..d2062
    @a..d2062 7 ปีที่แล้ว

    I am confused please help at 10:10 in the video.you talk about the degrees per second. Where does the ((500-8)/3)=164d/s come from.where does the 500 and -8 come from.

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      500 is the receiver signal and 8 is the used dead band.

    • @a..d2062
      @a..d2062 7 ปีที่แล้ว

      sorry to ask again
      you mean the maximum receiver signal is 500-8 therefore the max dps is 164 when divided by 3.
      what do you mean exactly when you say 500 is the receiver signal ?
      how does 500 relate to the degrees per second.?
      sorry for this daft question. I am just a bit confused.
      Thank you for answering so quickly.

    • @a..d2062
      @a..d2062 7 ปีที่แล้ว

      so do mean the maximum right(or left etc) stick push on the controller is 500. this hence represents the maximum dps.

    • @a..d2062
      @a..d2062 7 ปีที่แล้ว

      also how do you know that 500 is the maximum dps of the quadcopter. did you measure this somehow before and realise that 500 exactly from the control is also the maximum dps at 500 for the quadcopter.

  • @bogenriederlukas
    @bogenriederlukas 8 ปีที่แล้ว

    Great video. I thought it was gonna be super hard to understand but you explained it soo well :)

  • @MrFlashgrenade
    @MrFlashgrenade 9 ปีที่แล้ว +1

    I'm the eight viewer. I must call that a victory and take this opportunity to congratulate you on your wonderful project.

  • @usamasadiq8991
    @usamasadiq8991 8 ปีที่แล้ว

    You have done fabulous work here and really simple
    and it helped me a lot in my FYP. so hat's off for you thanx.

  • @bask185
    @bask185 8 ปีที่แล้ว +1

    I have a question: you only use the gyroscope values and not the accelerometer data right? The gyroscope only gives information about change of movement but not about the actual current position. How does the quadcopter knows when it is leveled if it only responds to movement? If you tilt the Qcopter 1 degree before power up, won't it drift by 1 degree all the time?

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      The YMFC-3D need manual leveling. The YMFC-AL is auto level.

  • @saswatds
    @saswatds 8 ปีที่แล้ว

    How did you come up with the constants for the complementary filter you used for finding battery voltage at 8:40 ?

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว +1

      I used these values before and they give a usable result. So it's just experience / trial and error.

  • @sardarhasseb8330
    @sardarhasseb8330 9 ปีที่แล้ว

    Finally a best video for understanding multirotor pid :)

  • @suhasrx100
    @suhasrx100 9 ปีที่แล้ว

    First of all, Great Video Tutorial Series Joop, Hats Off!!!!!
    What I noticed is, you have mounted the gyro underneath the right arm [During PID demo 5:24...], will correction be much more accurate if gyro has been mounted towards or at the center.

    • @Joop_Brokking
      @Joop_Brokking  9 ปีที่แล้ว

      Thanks for the compliment! The gyro only detects angular motion. Perpendicular motion will not affect the gyro's output. The best location for mounting the gyro is away from vibrations. This usually means in the center of the frame.

  • @MEGAZSTUDIOS
    @MEGAZSTUDIOS 9 ปีที่แล้ว +1

    Amazing piece of work, excellent control and response. Well done mate keep it up. ^_^

  • @robokishan
    @robokishan 7 ปีที่แล้ว +1

    sir i still dont understand why you are dividing it by 57. bcz its already has 17.mdps
    then your equation should ne x. * 57 =1

  • @joh1ish
    @joh1ish 7 ปีที่แล้ว

    Hey Joop, superb video! I wanted to bring something to your attention about the Arduino servo library. In your videos you went to a great trouble in order to make the refresh rates of the Arduino faster for the ESCs, hence better PID control, but I found that
    with one single change to the Servo header file, you can have the Arduino servo library refreshing at the interval you want. You
    may do this by changing the #REFRESH_INTERVAL value. Simply copy the file to the desktop, change the value, and copy the file back to the servo folder. I am going to check this out with an oscilloscope tomorrow.
    Just wanted to let you know for less headache in the future :D

  • @matiasbrollo6871
    @matiasbrollo6871 ปีที่แล้ว

    Le devo mucho a esta serie de videos. Muchas gracias.

  • @ambujjain212
    @ambujjain212 3 ปีที่แล้ว

    Thanks Joop, for this amazing video series. I have a question regarding the base throttle signal for quad-copter hovering. How do make sure that when throttle stick is in the middle, i.e. transmitting 1500us pulse the drone hovers?

  • @abdullahagcayazi7581
    @abdullahagcayazi7581 7 ปีที่แล้ว +2

    Hey Joop!
    First off, great project. I understand the concept of PID stabilization now but being an aerospace major, my programming skills are still a bottleneck. I'm using an MPU-9250 for my gyro board, and currently i'm just trying to get the PID code to work. I've changed up the registers and everything for it to work properly, but the PID outputs on the serial monitor are giving me just the top results, like only 400, or -400. Why could this be? I've changed the sensitivity, do I need to change the numbers that the raw data gets divided by somewhere?
    Thank you!

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      In the code the PID controllers are limited by this line:
      int pid_max_roll = 400;

    • @abdullahagcayazi7581
      @abdullahagcayazi7581 7 ปีที่แล้ว

      Yeah I know that but the only thing I was getting was either +400 or -400. Nothing in between. It was because I wasnt using an RX so I had to change up the code a bit, thanks either way!

    • @MixalisXaxalios
      @MixalisXaxalios 7 ปีที่แล้ว

      where can i find the pid arduino code?

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      It's in the YMFC code: www.brokking.net/ymfc-al_main.html
      Or you can check this page: brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

  • @sergior496
    @sergior496 6 ปีที่แล้ว

    I do not understand the spoken English but the written yes, someone can explain me what it says about the tunning of the pid.
    From minute 12:55 to the end.
    I need to configure my quadcopter

  • @mcebisisolilo3714
    @mcebisisolilo3714 5 ปีที่แล้ว

    Hi Joop, Thanks a lot for this video, you have made this very clear for me. Your explanation and major part of your code has allowed me to build my own UAV (Unmanned Aerial Vehicle), one problem i am facing is that the structure of my drone is a Hexacopter (runs with 6 motors). For a Quadcopter, the ESC equations are as follows:
    pulse_length_esc1 = instruction[THROTTLE] + roll_pid + pitch_pid - yaw_pid;
    pulse_length_esc2 = instruction[THROTTLE] - roll_pid + pitch_pid + yaw_pid;
    pulse_length_esc3 = instruction[THROTTLE] + roll_pid - pitch_pid + yaw_pid;
    pulse_length_esc4 = instruction[THROTTLE] - roll_pid - pitch_pid - yaw_pid;
    what will these equations be if i have 6 ESCs instead of 4, your assistance would be greatly appriciated

  • @rtdave6982
    @rtdave6982 7 ปีที่แล้ว +1

    I have learned many many things from you...Thank you.

  • @khalidMohsin
    @khalidMohsin 3 ปีที่แล้ว

    Hi sir i ask u why multiple (angle_pitch Or angle_roll) by 15 to find level_adjust. why this number (15)?
    please help

  • @muhammadqasim401
    @muhammadqasim401 7 ปีที่แล้ว

    awesome project.
    but i have question.
    I would like to see the error value, PID values, as well as its PID chart. how do I get to see its. as in this video, at minute 4:50. thanks Joop Brokking.

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      You have to use Serial.print to output the values.

    • @muhammadqasim401
      @muhammadqasim401 7 ปีที่แล้ว

      thanks joop brokking.
      in the code your upload,
      where I use serial.print if I want to see the final value of the PID, time (us), receiver (dps), gyro (dps), the value of P, the I and D?
      because I want to see a graph of PID to determine its stability.

    • @muhammadqasim401
      @muhammadqasim401 7 ปีที่แล้ว

      and if i starting the motor, value of throttle not on 0%. it abuout 10%. whats happen?

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      It's normal that the motors start spinning when you start the quadcopter. You can see the same here: th-cam.com/video/gz-Mywo7bGc/w-d-xo.html

    • @muhammadqasim401
      @muhammadqasim401 7 ปีที่แล้ว

      I see joop brokking. Thanks.
      How about.
      in the code your upload,
      where I use serial.print if I want to see the final value of the PID, time (us), receiver (dps), gyro (dps), the value of P, the I and D?
      because I want to see a graph of PID to determine its stability.

  • @dhrubajyotigogoi7685
    @dhrubajyotigogoi7685 4 ปีที่แล้ว

    Hello Joop, been following for over a year. Very thankful for such an elaborate guide. My query is are we using position/angle data in the PID controller or is it just the angular speed as the set point. I mean are we controlling roll/pitch speed or the roll/tilt angle. Using speed as the set point my P control behaves a like a D control (just damps motion)

  • @vishnukartha47
    @vishnukartha47 4 ปีที่แล้ว

    There will be precedence issue in the calculation of Derivative out put i think. The video is very informative. Thanks for sharing.

  • @TheMrAlextbo
    @TheMrAlextbo 7 ปีที่แล้ว +1

    Great Job excellent video! but there is some think i don't understands here you choose de maximum command to 164dps (setpoint) how do you know that's not too high and the drone isn't going to fall ? thanks in advance for your answer ^^

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      It's just a trail and error value that works fine for most pilots.

    • @TheMrAlextbo
      @TheMrAlextbo 7 ปีที่แล้ว

      ok thanks but can we consider that the max 164dps command is like we ask the drone to have a 45° angle on the considered axe. Sorry to bother but i'm doing a drone for a study project only using a gyrocope as a capteur and i don't know how to explain how i choose this part of the code (164dps max setpoint) thanks in advance for your answer

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      The 164dps tells the drone that it must rotate 164dps. It's not a fixed angle.
      In this video I explain the auto level function and the angle calculation: th-cam.com/video/DYpHB-LfloI/w-d-xo.html

    • @TheMrAlextbo
      @TheMrAlextbo 7 ปีที่แล้ว

      yes i saw this video but you are using an accelerometre. the thing is i don't understand how to think with speed and not position. Because when you put de joystick to 2000 us (convert in 164dps in the code) if it's the roll you ask the drone to rotate at 164dps to the right, like that it goes to the right. But i don't understand if i keep the joystick to 2000us why the drone just goes to the right and don't rotate on the roll axe indefinitely ? ( i know what i say is stupid because the pid is correcting the thing but that's my problem )

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว +1

      The confusion is probably the difference between rate and auto level. The video that I linked is the auto level that uses an accelerometer and angles. When you release the sticks the quadcopter levels itself.
      If you use only a gyro the quadcopter is flying in rate mode. This means that when you release the sticks the quadcopter will keep it's current position. Then you move the stick full right the PID input is 164 degrees per second. The PID controller will change the motor speed until the gyro detects 164 degrees per second. And it will keep rotating at 164 dps as long as the stick is full right. Meaning that the quadcopter flips upside down proximately 2 times per second.

  • @theodordrymonis6728
    @theodordrymonis6728 9 ปีที่แล้ว

    Very nice tutorial !!! Looking forward for the next video !!!

  • @herrkronen9694
    @herrkronen9694 11 หลายเดือนก่อน

    tHANLS A LOT FOR SHARING YOUR KNOWLEDGE !! COULD YOU PLEASE SHARE WITH ME , THE EXCEL SHEET ? THANKS

  • @hierryh
    @hierryh ปีที่แล้ว

    Hi Joop,
    on the STM32 pid software, I don't understand the following correction ( you don't speak about it on this video):
    roll_level_adjust = angle_roll * 15; //Calculate the pitch angle correction.
    pid_roll_setpoint -= roll_level_adjust; //Subtract the angle correction from the standardized receiver roll input value.
    How have you calculated the value of 15 ?

  • @powderdominic
    @powderdominic ปีที่แล้ว

    if you somehow see this and still respond, could you please answer my question:
    How did you eliminate noise from the MPU-6050 angle readings? Did you use a Kalman filter? Thanks!

  • @ubotics27
    @ubotics27 7 ปีที่แล้ว

    Great video Sir Joop. please I wish to know ,Where is the receiver signal from ?? I'm currently working on a wind pendulum project and I hope to adopt your PID lesson to balance the pendulum at center within the shortest time given , the pendulum has 4dc fans attached to its 4sides .how can I apply your lesson? Thanks for your help in advance

  • @shamssalehin2376
    @shamssalehin2376 6 หลายเดือนก่อน

    Hello Joop, can you share the code for this balance stand project, i also made one to test PID, im confused to how i control the PWM of two ESC to balance the the Rod.

  • @EdCranium
    @EdCranium 9 ปีที่แล้ว

    Fantastic work. PID explained so even I can understand it. Genius!

  • @carlosfreitas4056
    @carlosfreitas4056 5 ปีที่แล้ว

    Thanks for everything. You are brilliant at teaching.

  • @vitaliyd193
    @vitaliyd193 9 ปีที่แล้ว

    DUDE THANKS@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AWESOME!!!
    I remember your 1st soundless videos, and my wish to hear your explanations! AND NOW YOU KEEP MaKING US ENJOYING YOUR VIDEOS!!!!!!!!!!!!!!

  • @mclay2038
    @mclay2038 7 ปีที่แล้ว

    Joop, great video. I've noticed in some of your other videos that you have very good altitude hold. I was wondering what your process is for tuning the PIDs for altitude hold? Thanks.

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      The altitude hold test is form this video: th-cam.com/video/oc8Gv61bfvU/w-d-xo.html
      I'm using my own algorithms to get is stable like that.

  • @victoraugustoimg
    @victoraugustoimg 3 ปีที่แล้ว

    Great video my friend I have a question, how you find the bests values to kp, ki and kd constants?

  • @CHINTUKLApi
    @CHINTUKLApi 4 ปีที่แล้ว

    Hay what do u meant by gyro is this roll, pitch and yaw value also pls tell me how i get more appropriate gyro values
    I have the setpoints and orientation of my drone by which i get the error of (R , P, Y)
    Roll, pitch and yaw and the values of (R, P, Y)
    is (-30.0, -30.0 ,-30.0) at its inital position on ground and throttle is be 00.0
    PLS Help Me 🥺🥺🙏🙏
    Ya one more thing i am using Python

  • @talhayousuf4599
    @talhayousuf4599 6 ปีที่แล้ว

    Excellently explained but where do those 'dt' terms go? (as in pid formula) Don't you need to multiply with the time step in case of integral......?

    • @Joop_Brokking
      @Joop_Brokking  6 ปีที่แล้ว

      The program loop is fixed to 4ms. That is why you don't include time as it will not change.

  • @yogendrakumarpatel8369
    @yogendrakumarpatel8369 4 ปีที่แล้ว

    Can you make a video on concept of choosing pitch and diameter of propeller of drone

  • @longplayernet
    @longplayernet 4 ปีที่แล้ว

    Very Helpfull and cool practical examples!

  • @nelsone.1472
    @nelsone.1472 6 ปีที่แล้ว

    Hi good job,and very good proyect, I have a question about the battery, in the program you put esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500) but whas does mean the 3500?

  • @rje242
    @rje242 8 ปีที่แล้ว

    Hey Joop, I really appreciate this video. I've built my quadcopter and would like to use your formula for tuning my PIDs, however, I'm using Cleanflight as my program. I'm wondering if you or someone could offer ideas of the equivalent rates to use on Cleanflight to start the tune as you did in this tutorial? Thanks

  • @ypenburger
    @ypenburger 8 ปีที่แล้ว +3

    HEY DEAR TH-camRS,
    I hope some of you can help me. I have made a 3D flying quadcopter with this example of Joop Brokking. It flies pretty stable and such, but after some time the quadcopter starts to act weird. I am trying to keep it level, but the quadcopter makes sudden pitch moves and start moving towards me. When I try to push the stick so the quadcopter goes away from me, it obeys. But almost right after, it wants to come back at me. Its almost like it wants to come to his master haha. But with all seriousness, did anybody have such an experience? I dont know if its a problem with the gyro or maybe with the PID controls. Just the be clear, its not a smooth motion like its drifting, but its really like the neighbour has a transmitter as well and tries (after two minutes) to kill me by pulling the pitch stick down for a little moment at a rate of 1 time every two seconds.
    Thanks in advance!

  • @wwilliams3270
    @wwilliams3270 9 ปีที่แล้ว

    Thanks for the Videos. Has made things much more clearer to understand.But I was wondering, could I use the standard Servo.h library to use the ESCs? I checked the cycle rate and its about 3000 Microseconds to complete the Loop once, with the gyroscope, PID calculations and a few more LED signals. Is that too slow?

    • @sandervanleeuwen9395
      @sandervanleeuwen9395 8 ปีที่แล้ว

      +W Williams 3 ms is not slow. This means that your Arduino corrects it position 1 / 0.003 = 333 times in one second. This is more than enough for a steady quadcopter, which needs at least 50 cycles. Sorry, I don't know enough of the Servo library to give you a heads up.

  • @GeraMF
    @GeraMF 7 ปีที่แล้ว

    Friend a correction the PID controller is based on the relative stability therefore the error must be negative by the unitary feedback. Said above: E (S) = R (S) -Y (S)

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      It all depends on how the output is handled. I used the plane as my reference. Therefore the PID controller might be different as in your book-stuff.

  • @ben77100
    @ben77100 6 ปีที่แล้ว

    Est il possible d'utiliser lora esp32 avec sx1276 pour transmettre les commandes de la manette au drone ?

  • @arashabdi4052
    @arashabdi4052 5 ปีที่แล้ว

    hi, i really appreciate about the all tutorials. according to your tutorials, implemented a Drone which flies nice, but when it takes off, immediately stats to go front or left by itself and i don't know why.
    another question is : if i am going to add position controller before rotational PID, how should i measure status of Drone while flying? MPU6050 is a good idea or GPS with arduino UNO?
    thank you so much.

  • @4Dipayan
    @4Dipayan 8 ปีที่แล้ว +1

    Error = receiver - gyro.
    but receiver is a PWM value where as gyro output is a deg/sec value..so what is the dimension of the value that we get by the subtrating them ???
    PWM - deg/sec = ????

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      PWM difference == thrust difference == angular motion == deg/sec.

  • @sardarhasseb8330
    @sardarhasseb8330 9 ปีที่แล้ว

    when will the 6th part will come ,anxiously waiting 4 it ??

  • @manoelguidialvares6903
    @manoelguidialvares6903 5 ปีที่แล้ว

    Btw which tuning method did you use ? I do not know them by heart since I mostly use matlab and simulink in my job, but it looks like those Ziegler-Nichols, Angstrom, AMIGO tunings...

  • @waleedgaming8064
    @waleedgaming8064 7 ปีที่แล้ว +1

    Your videos are awesome! I myself built the YMFC-AL quadcopter and it works well.
    The only problem I am facing is that when I change the value of I, the quad tilt in one direction and I have to use subtrims to level it. It works perfectly fine with I=0;P=1.5 and D=15. Can you guide me how can I tune the value of I to make it more stable. Even at I= 0.01 , the quad tilt in one direction. Waiting for your reply.

    • @Joop_Brokking
      @Joop_Brokking  7 ปีที่แล้ว

      You can use the sliders on the transmitter to level the quadcopter. Make sure that you don't move the quadcopter at startup.

    • @diegochaucagallegos9173
      @diegochaucagallegos9173 7 ปีที่แล้ว

      The same thing happens to me ... always when starting starts to the side, and it is difficult to stabilize it, since the position to self-level will always be to one side

  • @ChaozBoom
    @ChaozBoom 8 ปีที่แล้ว

    Hi Joop, I am doing a similar project, and your work is proving invaluable, so thank you!
    Just a quick question- why is it you use the EEPROM library for your YMFC-AL program? I am fairly new to Arduino, and have not experienced this library before. Could I not convert the receiver channel just using a simple 'map' to an integer for example, instead of an allocated register within the UNO's EEPROM?
    Thanks again, and keep up the good work!

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      Yes that is possible. But you need to modify the code yourself.

    • @ChaozBoom
      @ChaozBoom 8 ปีที่แล้ว

      Thanks for the reply, that's fine as I am writing my own code anyway, I was just wondering what the benefit of using the EEPROM library is?
      Many thanks

  • @shubhobanerjee311
    @shubhobanerjee311 8 ปีที่แล้ว +1

    hi! joop this series has inspired me to build my own arduino quadcopter, however i've made some modifications to the code. i am using a mpu6050. i was thinking, is it possible to use yaw ,pitch and roll angles from the mpu6050 and convert the reciever inputs to the same and then calculate the pid.
    like when the pitch stick is at top the reciever input becomes 15degrees and the gyro pitch angle is taken as the current position.
    thanx

    • @Joop_Brokking
      @Joop_Brokking  8 ปีที่แล้ว

      If you need degrees you also need to use the accelerometer. You can read more about it here:
      www.starlino.com/imu_guide.html
      Please note that the YMFC-3D version 2 supports the MPU-6050.
      th-cam.com/video/CTtLPeJPbXY/w-d-xo.html

    • @shubhobanerjee311
      @shubhobanerjee311 8 ปีที่แล้ว

      Thanx for the reply, i am already able to obtain the yaw pitch and roll angles with the help of example arduino code.

  • @hhotsauce
    @hhotsauce 6 ปีที่แล้ว

    Joop could you please tell me how to balance the motors and props using the program in part 4. how can I test for minimum vibrations in the arms using a program...?

  • @zaki841
    @zaki841 6 ปีที่แล้ว +1

    Thank fo your video
    Sir i built the ymfc 3d but the problem is that my quadcopter doesn't go up it only flip around the right what could be the problem

    • @pinballball5208
      @pinballball5208 6 ปีที่แล้ว

      ahmed mohamadi have u solved the problem yet im also having the same problem qlways flipping towards right

  • @intiazahmed3609
    @intiazahmed3609 4 ปีที่แล้ว

    Which propeller you are using? My BLDC is DJI 2212 920KV.
    While trying to fly Everytime props
    Getting spit out.

  • @denisardelean8067
    @denisardelean8067 4 ปีที่แล้ว

    What should I change to the code if I'm using 1400kv motors with 1045 props?

  • @Dilipkumar-xm3vh
    @Dilipkumar-xm3vh ปีที่แล้ว

    Can I keep modifying pid values in flight controller code without resetting the arduino board? Sorry if my question makes no sense. Iam a beginner

  • @abhishek84215
    @abhishek84215 ปีที่แล้ว

    i tried your code but my drone is not flying. it's flipping. can you please help me?

  • @SKJagan-dh2ft
    @SKJagan-dh2ft 5 ปีที่แล้ว

    How you choose the PID values of yaw to get the PID values of roll?

  • @ehsanhoseini5641
    @ehsanhoseini5641 ปีที่แล้ว

    icant find the arduino code related to this video in your website