what is pid controller

What is a PID controller and how it works?

The whole FPV hobby, and especially multirotor drones, work only thanks to control theory and PID controllers. They are the only thing that separates chaos and immediate flip-over from a stable flight. A regular multirotor has at least 3 PID controllers. If you enable any mode with self-leveling, the number goes to 6. Any GPS assisted mode increases the number to at least 12.

Of course, the PID controllers we think when we think about when we say about multirotors, are Rate PID controllers. They keep our drones stable by keeping angular velocity at desired levels. And usually, they are the ones that have to be tuned to achieve a nice, smooth and stable flight.

Read More

How to setup INAV 2.2 on 7-inch quads – PID tuning

INAV 2.2 is with us and it brings a series of cool improvements that should make all owners of mini quads very happy. Those are:

  • Improved Airmode that is more suited for small and powerful drones
  • Iterm Relax that allows getting rid of bounceback at the end of flips and rolls
  • D-Boost allows having cold motors and a lot of Dgain when doing fast maneuvers. It's an equivalent of D_Min from Betaflight
  • Configurable gyro stage 1 filter type: PT1 or BiQuad
  • Faster D-term filtering
  • and a few other goodies
    In this video, I will show you how to set up INAV 2.2 for 7-inch quads to get the best flying experience possible.

INAV fw_iterm_limit_stick_position – keep the Iterm under control

PIFF controller in INAV is with us for quite some time now. And it’s working just fine, much better than classic PID when it comes down to airplanes. There is, or rather was, a small problem tho: Iterm. When P and FF components of the controller are not tuned, Iterm might do crazy things that will surface themselves when you release the stick: airplane might either roll-back or do a follow-through.

In this video let’s discuss why this is happening and what INAV 2.1 did to mitigate this problem. Because it did and it’s called fw_iterm_limit_stick_position

What is Betaflight 3.5 Feedforward and how to use it

Betaflight 3.5 is just around a corner and it brings new cool things. There is no more Dterm setpoint weight and Dterm setpoint transition (relaxation ratio). They all were replaced by easier to understand Derivative and Feedforward (Feed Forward when you refer to the control theory tho).

Betaflight Derivative and Feedforward parameters are the new way of controlling "damping force" of the Dterm and responsiveness of a drone. The more Derivative gain you set, the more "damped", "delicate" and "swooshy" drone will be. The more Feedforward gain you apply, the more responsible to the sticks it will be. It's almost the same as with Dterm setpoint weight, but in my opinion, made simpler and can be set separately for each axis.

Betaflight 3.2 Dynamic Filtering Explained

With upcoming Betaflight 3.2, we will be given a new, outstanding, new feature: dynamic filtering. An belive me, it was worth waiting for Betaflight 3.2 only to get it. I do not care much about other changes that happened with version 3.2 but dynamic filtering it the thing! In this post I will explain, in simple words, what is dynamic filtering and how to enable it.

The problem of noise

Gyro has a nasty tendency to pick up a lot of noise. Vibrations. After all, there are a lot of things that can vibrate (motors, propellers) and resonate (frame). Without a good way to filter all that noise out, our racers would not fly as good as they fly now. And you would be replacing motors and ESCs even more often. I you want to know more about gyro noise sources and filtering, please watch my Gyroscope and filtering series on YouTube.

Read More

Understanding Dterm: how Dterm really works

I will be very honest: until very recently I did not really understood how PID controller’s Dterm really works. Yes, something with dampening, something with “looking into future”, bla bla bla. But the reason for not understanding was because I was overthinking it. There is no “magic” only simple mathematics and few basic concepts which I will now explain.

Setpoint

Setpoint is the value which we request from our system. In case of multirotors, PID setpoint will be a rotation speed around axis given in degrees per second [dps]. Setpoint 0 means we do not want to rotate (keep current attitude) and setpoint 200 means we want to rotate at 200dps

Measurement

Measurement the value that represents actual state of the system measured by some kind of sensor. In our case, it will be the gyroscope and rotation-around-axis speed measured in degrees per second

Error

Error the difference between Setpoint and Measurement computed as Error = SetpointMeasurement. In our case, when Error is above 0, that means drone is rotating too slow and should speed up. If Error is below 0, drone is rotating too fast and should slow down

Understanding Dterm - setpoint measurement and error Read More

INAV 1.6: Fixed Wing PIFF Controller

Another new feature of upcoming INAV 1.6 (BTW, INAV 1.6 ALPHA-1 has just been released) is brand new PID controller for fixed wings. I repeat: this new controller is used only on fixed wings, multirotors are not affected.

So, what is new about this new PID controller? First of all, it is no longer a PID (Proportional, Integral, Derivative). It is a PIFF (Proportional, Integral, Feed Forward) controller. What is the difference?

Traditional PID controller computes error between setpoint and measurement and feeds it to 3 modules: P, I and D.

PID controller

Read More

JavaScript PID controller

I suppose this is the first time programing topic came up on this blog. Probably not the last time, since this is what I do most of the time.

While working on serial port usage balancing for INAV Configurator I’ve quite accidentally created a PID controller in JavaScript. Maybe it’s not the most advanced PID controller ever, but has all the things required:

  • computes P-term
  • computes I-term
  • computes D-term
  • has output limiting
  • has I-term accumulator limiting

Read More