### PID loops and Tuning

#### Replies

• Developer

Just a little experience advice. You don't need I or D gains on almost anything for basic astable aircraft unless you are looking for rockstar performance that is imperceptable to the eye. IE P gain on roll is all that is required. I use zero derivative gains on any of my controllers and have stellar response. The few integral gains I use are on airspeed and altitude holds and that just because its easier to have the controller find the aircrafts trim point for a given airspeed then it is for me to manually tweek the pushrod in and out flight after flight until its perfect. My altitude/airspeed hold is very unconventional but works on the same classical control techniques. (energy height feedback). So in summary if you cant get basic control with simply P gains to start with you are never going to be able to tweak it out. You will only make it works. The I and D are used to increase performance but if the performance isn't first there based on the P then you will be chaseing a moving target.

*Note attached Google earth file's altitude its on rails with no steady state error

8NOV09.kml

• Here is a PID simulator I through together so you can "See" the effects of the PID loop on an altitude.

• Great post!!!
• I have a similar question to Jason.

I am wondering when, or how, to reset my Integral term.

Currently, I am setting a threshold to reset the integral term, i.e. when the error is suitably reduced, the I term is set to 0.
• Developer
I had a question regarding the I term in PID loops. If I grows over time based on accumulated errors, what mechanism causes it to get smaller? Is it overshoot that reduces it?

For example, if I've taken a long time overcoming a force - like gravity in your example- and my I has grown to its limit, I should be able to reduce my error to 0. But once I've reached 0, isn't my I term still large? Is it D that counteracts it? Or is there another mechanism that does it? Or do I need an opposite error to reduce it until I steadily reach 0?

Thanks, Jason
• 3D Robotics
Great post! Many thanks for the useful advice, which sounds spot on.
This reply was deleted.

### Activity

DIY Robocars via Twitter
15 hours ago
DIY Robocars via Twitter
RT @_JonMyer: 🚨Attention DeepRacer's including #UndergroundDeepRacer🚨 Check our our LIVE stream that including @IAM_dbro Take a few moments…
Aug 5
DIY Drones via Twitter
RT @MarvelmindMaxim: Extreme precision for 60 swarming robots. #marvelmind #autonomousrobotics #robotics #swarmrobotics #rtls #ips #indoor…
Aug 3
DIY Drones via Twitter
RT @MarvelmindMaxim: Precise (±2cm) tracking for racing boats and autonomous boats. Works outdoor and indoor. #autonomous #AutonomousVehic…
Aug 3
DIY Drones via Twitter
RT @MarvelmindMaxim: Helping PixHawk folks to fly autonomous quadcopters using PX4 and ArduPilot. https://marvelmind.com/drones/ Equally suitab…
Aug 3
DIY Robocars via Twitter
RT @chr1sa: The @DIYRobocars @donkey_car virtual AI car race is starting in 15 minutes! Watch it live on Twitch https://www.twitch.tv/mossmann3333 htt…
Aug 1
DIY Robocars via Twitter
RT @chr1sa: Don't miss our monthly @DIYRobocars @donkey_car virtual AI car race tomorrow at 10:00am PT live on Twitch. Head-to-head racing…
Jul 31
DIY Robocars via Twitter
RT @sparkfun: Our completed tutorial on building an @NVIDIA Jetson Nano-powered @Sphero RVR gets your bot up and running via teleoperation…
Jul 30
DIY Robocars via Twitter
RT @SmallpixelCar: Freeway test https://t.co/4V5tV9lhIP
Jul 29
DIY Robocars via Twitter
Very small autonomous cars racing, thanks to an overhead camera: https://control.ee.ethz.ch/research/team-projects/autonomous-rc-car-racing.html
Jul 29
DIY Robocars via Twitter
RT @chr1sa: Don't miss our virtual AI car race this Saturday! Real developers + virtual cars =🏎️🏎️🏎️ Head-to-head battles with thrills, sp…
Jul 28
DIY Robocars via Twitter
RT @usashirou1: Jetson nano by Isaac Kaya #jetson https://t.co/Mu1N0CyQkN
Jul 23
DIY Robocars via Twitter
RT @GPUsolution: JetRacer mady by Iflytek company #JetsonNANO #Nvidia https://t.co/MimTymIwge
Jul 23