top of page
Search
Writer's pictureDeviation Robotics

Error correction with PID!

What is PID?

PID stands for proportional, integral, derivative. It is commonly used in industrial control systems as a feedback mechanism because it calculates the error value of a system so it can make adjustments to return to normal.

What is Proportional?

The proportional part of PID calculates the difference between the current value the device is reading and the expected value and makes adjustments based on how large that difference is. For instance, if a robot wanted to travel straight (IMU sensor value would be = 0) but the IMU read 100 the robot would correct itself more harshly than if the IMU value only read 10.

What is Integral?

The integral part of PID adds every error value together. For every repetition of the loop that the PID code is contained in, integral is set to integral + error. At the start of the code, integral is set to 0. If the robot’s integral is = -5, then the robot on average is more to the left so the robot would slowly turn right.

What is Derivative?

The derivative part of PID anticipates the next error. In each repetition of the loop that the PID is contained in, the derivative is set to error minus last error. This informs the PID of how much it is adjusting to predict what the next error will be. It then adjusts itself based on this predicted value.

How does it all come together?

Each of these different values of correction is multiplied by a constant. The constant for proportional is called Kp, the constant for integral is called Ki, and the constant for derivative is called Kd. Kp is usually much greater than the other constants. Then all of the values after being multiplied by their respective constants are added together and, in the case of using PID with an IMU to go straight, set how much the robot should turn.


Exactly what was explained above except with fancy symbols to explain what each part of the PID does.

14 views0 comments

Recent Posts

See All

Comments


bottom of page