From the Depths - PID Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings salutations hello hi and welcome to my pid tutorial as usual you can find timestamps pinned in the comments and disclaimer that pids and breadboards will never work the way you want them to if your propulsion has problems which is probably the topic of my next video but for now pids anyway here we go first of all you have two options aip ids and general purpose pids they're found in different parts of the ui so you have aip ids in the ai tab and it's just called pid and it's right next to the mainframe and then you have in control the general purpose pid which is next to the none ai breadboard in the control tab so what's the difference between the two well let's start with the general purpose pid because that's the most simple in a way and that's because it does just what you ask it to do it does not need an ai connection it will just work all the time unless it's destroyed of course now typically you will just want to set up a fake set point and i'll explain this in a minute you just give it the info and it just does that and it does that all the time the aip id can be used in a few different ways however so first of all you need to access it through the mainframe rather than through the pid block itself and you'll notice that i can only enable one axis because i've got only one pid attached to my mainframe now there is nothing stopping you even if you don't enable the controller to go into one axis and set it to none and that in theory you know bugs aside should disable that ai's control over that axis which can be helpful if you're setting up general purpose pids because that prevents the ai from fighting the pid however you can enable the controller in order to change how the ai works how it controls your vehicle because the ai will inherently by default use the pid to control your vehicle and the only way to tweak these numbers on an ai is to attach an iep id now you can also override it by setting up a fake set point to whatever you want but that's a little bit less convenient with aip ids for reasons i'll explain in a minute because the real point of an aip id is to be able to tweak these numbers and the fake setpoint is actually set by the ai which is different from the general purpose pid however you'll notice something if i go back here and enable the fake set point let's just set it to zero and let us yes this is set to zero now you cannot change the fake set point on an aip id using an acb but the ai can control the fake set point on a general purpose pid the ai cannot affect the fake set point but an acb can so if we go in here you'll see under the ai tab you have general purpose pids and at the bottom you have a whole like a ton of options but the main one that i would use personally is a fake set point value and i here have it set to 10. now if i test that and i go back here you'll notice it's now 10. it was zero a moment ago and this here is still set to zero that's the big difference now what usually scares people away from pids is actually setting them up right putting in the right settings in there so that they work and do what you want i'm going to start with a general purpose pid and i actually recommend even if you're getting into breadboards and if you intend to use a breadboard pid to actually mess with this a little bit because the graph here which is also available on aipids by the way is actually pretty useful to troubleshoot pids which i'm going to tackle a little bit later but first how do you set it up right so it's a general purpose pid it doesn't know even what access you want to control by default so unless you know what you're doing you should put an input and an output that match right pitch with pitch um altitude with where is it propulsion vertical and roll with roll and so on right now you don't have to do this with the aip id because well you just saw me click here pitch controller it knows what you wanted to control but the real magic happens afterwards right so you'll want a set point for your general purpose pid you may want to set point for your aip id but not necessarily but what you definitely want is to tweak these values and this is where it gets a little bit complicated but i'm going to try and do my best to make this really simple all right so i switched to something a little bit more you know smaller to illustrate my point very clearly so here is an altitude pid right altitude and propulsion vertical and then we're gonna look at all of the variables so i set up the fixed point to 20. you'll notice i'm not at 20 meters and this is how i'm going to explain to you gain right now if you look at the graph you'll see the blue bar this is how hard my pid is pushing to try to reach my target yeah my target altitude it's just not enough how you increase this you increase gain boom and now you see i'm actually using i'm basically capping out maximum thrust no thrust and wobbling very hard to the point where it's actually losing control but i'm now more or less reaching my altitude now if i put in something a little bit more reasonable and the first thing you need to understand is that reasonable is going to be different for each vehicle depending on how much thrust is available on the axis you're trying to control this is why you need the graph right now you can see that the green line actually probably can't even see the green line because the green the red and the white lines are all on top of each other and that's because i'm at my target altitude and this is yeah it's pointing me a it's pointing out my desired altitude my actual altitude and the integral which we'll get to in a second now it's still wobbling however and that's normal that's because there is no derivative time set right now by default it's 1.5 1.5 should do a decent job right and boom we flatten down the um the curve now derivative should be set pretty low generally speaking because it does i'm gonna say magic right just to simplify things it does magic but basically the higher it's set the more random events could destabilize your pid because derivative is basically looking into the past in order to try to predict the future and the higher the number the further into the past it's looking and that's just unnecessary for most vehicles derivative is just used or should be used mostly to fix regular errors right not random events it doesn't help with random events like say you're firing a very high recoil gun if you're firing that gun very slowly derivative is not going to help you very much if you're firing it regularly it might be somehow now integral this is something that a lot of people especially people who are new to pids leave off right it says time off it's set to 250 setting it to 250 is basically turning it off very high values make integral very unnoticeable it's actually explained down there even though that's a bit opaque and hard to understand in my opinion so what does it do well if we revert back to the very low setting we had earlier which did not let us reach our altitude right it's struggling to get past 9 meters even though our target altitude is 20 meters what happens if we set up an integral of five well the white line's moving and we are rising and eventually it should stabilize we're just staring at the graph and there we go so what just happened integral or actually let me start by explaining gain right gain and that's the p in pid that's proportional right so it's using a fraction of your available thrust to correct an error and the greater the error is the more thrust it's using even for the same gain right so if i'm at 0 meters and i'm trying to reach 20 meters altitude with that gain i'm only making it up to about 9 or 10 meters because by the time i'm only 10 meters away from my target the thrust i'm giving it is not enough to push me close enough because the error is smaller right the difference between 20 and 0 is obviously 20 while the difference between 20 and 10 is just 10. so that's proportional integral is over time basically the higher the integral is the longer the pid will take to ramp up what integral does is the longer you're off your target altitude in this case or you know your fake set point the more it will push and the higher the value the longer it will take to ramp up the lower the value the faster it will ramp up if i make this one actually let's disable it again right so we go back down to whatever now if i set this to 1 we'll see on the graph it ramps up really fast and it actually overshoots and it's going to settle slowly but it's going to settle because it's not going to be able to reach 20 meters without the help of integral the gain is too low but that works it'll work if you set it up to something reasonable and again that's gonna be different for each kind of craft right um but this is extremely useful because even if you set up your vehicle to be stable when it's in perfect condition if you lose some of your thrust in combat then if you don't use integral it will never make up for that loss of thrust which makes integral really really important and that's what it does so now that we've got that out of the way and we have a general understanding of how pids work how do we go about setting up a new vehicle well there's no clear set numbers that will always work and there's two different approaches right you can use a high gain and a high integral or you can use a low gain and a low integral and that will more or less have the same result but generally speaking you want to start with a really low gain so here i'm using a number that's not quite enough to bring me to my target altitude but not so low that i'm actually going down into the water right and i'm going to increase that until i can reach my target altitude not quite there yet it's getting close let's ramp it up a little bit more still not there i think point one was just about the break point we're keeping an eye on the graph especially the blue line let's go a little bit overboard right so we're now reaching our altitude and that's actually something you'd want to do you want to start with a little bit overkill and you'll gonna you're gonna see that wobble on the graph and then you wanna take it down a notch and then you wanna set integral let's say to 20 or so and you'll want to use a derivative i typically default to 0.5 most values under one are pretty good you can go up to about four or five depending on your vehicle it's a little bit risky weird things can happen when you use a high derivative but generally speaking you won under one second it's just something i found to work best in my experience so now i'm at my target altitude and i'm not jumping around it's perfectly stable i could leave it like that now some considerations you might want to think right now i'm using jets just above the water so if i lose some thrust and fall into the water that's it i'm immobilized and that is why you often want to use a lower integral because that will cause the vehicle to ramp up faster if it ever loses some of its thrust and you'll see it'll stabilize again it should work just fine if you see there's some weirdness go back from the top play with your gain play with your integral and make sure your derivative is set to something that's reasonable and that's it that's pids in i believe less than 20 minutes so if you liked if that helped you if you like me or whatever please consider subscribing commenting and liking the video thank you for watching and i'll see you in the next one bye bye
Info
Channel: Ohm is Futile
Views: 1,889
Rating: 4.9674797 out of 5
Keywords: ftd, FTD, tutorial, tips, tricks, pid, PID, From the Depths, gaming
Id: mY59zlPUlIQ
Channel Id: undefined
Length: 16min 47sec (1007 seconds)
Published: Tue Jun 02 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.