Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

PID control is a way for a robot to correct its motion by constantly comparing where it is to where it should be. In a wheeled robot driving toward a target line, the controller uses the error between the desired path and the actual path to decide how strongly to steer or adjust motor power. This matters because real robots slip, drift, and respond with delays, so they need feedback rather than a fixed command.

A visual PID diagram makes it easier to see why different control terms can cause overshoot, remove bias, or smooth motion.

Understanding PID Control Made Visual

A PID controller runs as a repeating loop, often many times each second. On each loop, the robot reads a sensor, calculates a new motor command, and waits for the next reading. The time between readings matters.

A slow loop can miss a fast change in direction. A very fast loop can react to tiny sensor fluctuations. The robot itself cannot respond instantly either.

Motors need time to build speed, wheels have grip limits, and the chassis has mass. These physical delays mean a correction that looks sensible at one moment may be too strong by the time the robot moves.

The shape of a robot's path depends on inertia and delay as much as on the gains. Imagine a robot turning toward a line. It may still be rotating after its steering command has been reduced.

This is why a controller with only proportional correction often crosses the line, then turns back, then crosses again. The derivative part helps because it notices that the error is shrinking quickly. It reduces the command before the robot reaches the line.

In this sense, derivative action acts like braking. It does not stop motion directly. It makes the controller less eager when the current motion is already carrying the robot toward the target.

Integral correction is useful when a small problem pushes the robot in one direction all the time. One motor may be slightly stronger. A wheel may rub against part of the frame.

A robot may drive uphill or carry an uneven load. Proportional correction can leave a small remaining error in these cases because a small error produces only a small command. Integral correction keeps accumulating that leftover error until the controller supplies enough extra effort to overcome the bias.

This creates a risk called integral windup. If the motors have reached their maximum power, the stored integral value can keep growing even though the robot cannot respond further.

When it finally can move again, the stored correction may cause a large overshoot. Good controllers limit the stored integral value or pause its growth while output is saturated.

Students usually tune a PID system one part at a time. Start with integral and derivative gains at zero. Raise proportional gain until the robot responds firmly, then reduce it if repeated weaving appears.

Add derivative gain in small steps to calm the weaving. Add integral gain last, only when a consistent offset remains after the robot has settled. Sensor quality is important during this process.

Derivative correction is especially sensitive to noisy measurements because noise can look like rapid motion. Filtering the sensor reading can help, but too much filtering adds delay.

A useful test is to change one condition at a time, such as speed, battery level, surface, or load. A set of gains that works on a smooth floor at low speed may behave poorly on carpet or during a fast turn.

Key Facts

  • Error is the difference between the target value and the measured value: e = setpoint - measurement.
  • PID control law: u = Kp*e + Ki*integral(e) + Kd*de/dt.
  • The proportional term Kp*e gives a correction that grows as the robot gets farther from the desired path.
  • The integral term Ki*integral(e) adds up past error to remove steady-state error caused by bias or friction.
  • The derivative term Kd*de/dt reacts to how fast the error is changing and helps damp overshoot.
  • Too much gain can make a robot oscillate, while too little gain can make it slow or unable to reach the target accurately.

Vocabulary

Setpoint
The desired value the controller is trying to reach, such as the target line or desired path.
Error
The difference between the setpoint and the robot's measured position, speed, or direction.
Proportional control
A control action that makes the correction directly proportional to the current error.
Integral control
A control action that corrects for accumulated past error so the system can eliminate steady offset.
Derivative control
A control action that responds to the rate of change of error to reduce overshoot and oscillation.

Common Mistakes to Avoid

  • Using only a large Kp to make the robot respond faster is wrong because too much proportional gain can make the robot overshoot the path and oscillate.
  • Forgetting the sign of the error is wrong because reversing e = setpoint - measurement can make the robot steer away from the target instead of toward it.
  • Adding too much integral gain is wrong because accumulated error can build up and cause a large delayed correction called integral windup.
  • Treating derivative control as a cure for all noise is wrong because derivative action can amplify noisy sensor readings unless the measurement is filtered.

Practice Questions

  1. 1 A robot is 0.12 m to the right of its desired path, so e = -0.12 m. If Kp = 4.0, Ki = 0, and Kd = 0, what is the control output u?
  2. 2 For a PID controller, let e = 0.20, integral(e) = 1.50, de/dt = -0.40, Kp = 3.0, Ki = 0.8, and Kd = 0.5. Calculate u = Kp*e + Ki*integral(e) + Kd*de/dt.
  3. 3 A robot using P control reaches the target line but repeatedly overshoots left and right. Explain which PID term could help reduce the oscillation and why.