PID control

Wechseln zu: Navigation, Suche


Ardumower uses a digital PID controller for

  • heading/course tracking
  • perimeter tracking
  • motor speed control
  • ...

A PID (proportional–integral–derivative) controller is a control loop feedback mechanism (controller) commonly used in industrial control systems. A PID controller continuously calculates an error value as the difference between a desired setpoint and a measured process variable.

PID controller

Pid controller.png


  1. Tracking: input sensor is inside/outside, output plant is the left and right motor. Goal is to keep error (inside/outside state time) small.
  2. Motor speed: input sensor is odometry, output plant is the motor. Goal is to keep the error (setpoint rpm - actual rpm) small.

PID settings

A PID controller takes three things into consideration:

  1. error (P): Where you want to be vs. where you are - This is certainly a big factor. If you are at point A and your target is at point B, then the vector from A to B tells you a lot about how you need to steer, but it isn't the only factor.
  2. derivative (D): How fast you are approaching - If you are approaching the target quickly and you are close to it, you actually need to slow down. The derivative helps take that into consideration.
  3. integral (I): Alignment error - Your robot may not actually do exactly what you tell it to do. The integral helps determine how much you need to compensate for that.

The optimal P,I,D parameters depend on the actual hardware. The software default PID parameters are for the Ardumower motors available in the shop. To use your own motors, one method is trial & error (it can be difficult to find the optimum PID parameters):

  1. Increase P until system starts to oscillate
  2. Set I=0.6 * P and D = 0.125 * P

Proportional, Integral and Derivative (PID) controller concept:

P : Determines how aggressively the PID reacts to the current amount of error (Proportional) 
D : Determines how aggressively the PID reacts to the change in error (Derivative) 
I : Determines how aggressively the PID reacts to error over time (Integral)

Velocity PID

The standard form is most used for position control. If you derivate the standard form, you obtain the velocity form:


For interactive learning, you can find a PID simulator here: PID simulator