ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
Creating and Tuning a PID controller with Python Simulation
ฝัง
- เผยแพร่เมื่อ 16 ส.ค. 2024
- The long-awaited PID Part 2 video!
As mentioned this video was recorded in one 4 hr session where Luke and I sat down and recorded until it was done. Github: github.com/Jma...
Music thanks to Noise Boise (@Noise Boise on Spotify)
********
Discord: orionaerospace...
********
TimeStamps
00:00 Setup
04:53 Creating a simulation class
09:10 Rocket class
15:33-PID class
20:01 PID loop
28:02 PID Tuning
29:20 Plotting results
36:28 Conclusion
---------------------------
Thanks for watching!!!!!!!!
So you find the self.error at 20:51 by subtracting where the rocket isn’t from where it is. Therefore the missle knows where it is from where it isn’t
🤢
Great video guys! I can tell a lot of effort went into this :)
This is actually gold.
Correction: diamond ♦💎👍
Very nice video!
This is so valuable for someone who just wants to see a practical intro to pid control !!!
Thanks you guys! I found this very useful. It gives a better understanding about PID and how to tune it :)
Very cool
Attitude control for a typical rocket only needs a proportional + derivative term. Lack of integral on attitude can be compensated by an outer guidance loop.
Man great video! I was looking at BPS space and his videos but he doesn't go into the software stuff as deep as you guys do. Are you going to make a video about 3D orientations and quaternions? Or maybe your arduino code?
Check out the wiki at r/amateurTVC and read the Madgwick paper on quaternions until section 3.1.
very true. I really like that they do that here.
Nice simulation 👍🚀😁
That's a _very_ good explanation of pid controllers imho. Didn't know how to tune them and I like your approach of quickly designing a simple simulation to get some numbers.
Don't know how I ended up here, but I like it in this rabbit-hole ;-)
Oh, I remember now. Maybe I'll revisit this coding challenge.
The 2nd part now seems doable, but I still have no idea how to make a rocket follow a path, which is the problem in the 3rd part.
2nd part: www.codingame.com/training/medium/mars-lander-episode-2
3rd part: www.codingame.com/training/expert/mars-lander-episode-3
Thank you so much for sharing this!
YAAAAAAAAASSSSSSSSSS.
Great video guys! thank you
Really cool channel, keep going, subscribed!)
this is a whole vibe
nice vid! very informative..thank you!
Great video! Would it be worth writing a flight computer in micropython so you could use the actual flight module in the simulation?
Hi guys!!
Absolutely loved this video, and thinking about joining your Discord.
I have a question about PID controller algo's in Python. Aside from the obvious issue of most microcontrollers needing code in C++ or C, would Python code even run fast enough to really be of any use in an actual thrust vectoring system?
The flight software is still written in c++. This simulation is just to show how similar steps could be taken to attain PID gains that would then be implemented in C++ flight software :) hope that helps and would love to see you on the discord :D
@@OrionAerospace Gotcha! Would it be fast enough at all though if you were to magically run the code on the controller?
Yess, probably will be seeing me soon haha. Quite intrigued by the rapid progress you guys have made!!!
@@milindsharma8106 You can program all of your flight software in python (micropython or circuit python) In general python is pretty slow but on an embedded system like a rocket flight computer it might be fast enough-- i would stick to c++ though. We have some c++ on our discord that might help give you a good starting point! Theres also more info on our website
@@OrionAerospace Once again, y’all are wonderful! Thanks a lot for all your help! I Gotta deal with a simpler problem first - finding my lost password to my PayPal account to make that donation
@@milindsharma8106 glad we could help :)
Please make more videos like this
hey, why not use matLab's simulink for the simulation instead of python?
what do you guys personally feel is the advantage of python in this situation?
Simple. Mathlab require licences while python is free. My work doesn't pay for Mathlab so this tutorial is extremely valuable
Is the Ziegler Method appropriate in this sort of application? I read somewhere that it's mainly useful when you have a slow process. Isn't a rocket launch an inherently fast process?
adamdude yeah it works best for a slower plant or process. However from some simulations we did it’s passable. There are other versions of the ziegler Nichols however that are better suited :)
@@OrionAerospace ok thanks! Any tips with dealing with quaternions? I'm writing my own simulation with a buddy of mine and we're trying to get the thrust angles calculated and such. Do you have a discord to chat?
adamdude yep! Our discord is available here: orionaerospacelift.wixsite.com/orionaerospace/please-help we are thinking about releasing our custom quaternion library to the server as well! So that may help you out as well :)
@@OrionAerospace awesome! Donated!
which development board you are using????
teensy 3.5 i think
Thought you were going to use state space?
Umm my country isnt supported in your donation on the website.......
Shouldn't 'def set_dy(self): self.dy += self.ddy' be 'def set_dy(self): self.dy += self.ddy * TIME_STEP'? Same for 'def set_y'. As you are integrating acceleration over time to get velocity and integrating velocity over time to get your position.
You are 100% correct! I’ll change that and upload it to the GitHub. Great catch!
@@OrionAerospace Here some sane'ish values for that setup:
'Kp':[1.3], #_Proportional_Control_Coefficient
'Ki':[0.02], #_Integral_Control_Coefficient
'Kd':[1.8], #_Derivative_Control_Coefficient
'dt':[0.01], #_Sampling_period
How did you get the desired gains? This can’t be just trial and error right? Or did you use AI to compute the ideal gains?
Its not trial and error! check the end of the video and we use a method called Ziegler nichols method to tune the system mathematically its faster than using AI although people have used genetic algorithms to tune similar systems :D
Orion Aerospace my bad i asked my question before i finished watching haha, i made a function to auto tune the gains based on the Ziegler-Nichols method you talked about. It works good enough for me, if you want to I can send you my version of the code :)
@@b5nj1m9n feel free to add a pull request on the gituhub! that way anyone else who checks out the video in the future will also be able to see your fork!
Orion Aerospace I am pretty new to the github community so I have no idea how to do that haha
@@b5nj1m9n ahah if you want you can send an email to us orionaerospace.liftoff@gmail.com and i can credit you in the commit :) not to worry if not! glad you found the video useful
Seems like massive effort when you could have got something similar with Matlab in a few minutes
MATLAB is pretty expensive by a lot of standards, still, hats off to these guys
Podcasts comming?
What is this turtle library?
hello what IDE do you use
He used sublime text, don't know what version though...
@@siliconnitride7029 thank you
Is that the full code?
VENTANIA 72 yep! GitHub link is in the description ;)
Can you please make a video with the full software??
You really ought to read PEP8. Your style is both in defiance of convention and inconsistent.
do not use Python, use C.
this is just a simulation :) the actual flight software is written in C/C++
@@OrionAerospace that's good.
As a java programmer, python makes me want to puke