{%hackmd theme-dark %} # Engineering Notebook 2 # Programming Update ### What is PID Control? **Proportional Integral Derivative Control** **Proportional** The Proportional component provides the power for controlling your system. The key objective is to give a large amount of power when there is a long way to go, but only a small amount of power when you’re nearly at your setpoint. This results in a smooth deceleration through the movement as you approach the setpoint. **Integral** The integral conponent identifies that the robot stop moving and adds extra power gradually until the robot starts moving again. For example, when the robot hits a mobile goal, it may not have adequate power for it to move forward with the goal. In this case, the integral component adds power for it to be able to move forward with the mobile goal. **Derivative** So far we’ve looked at controlling the output power based on the current error, and past errors. Now, we’re going to look a bit into the future. The idea of the derivative is to look at the rate of change of our error – how fast are we approaching the setpoint? Do we need to slow down a bit? The contribution from the derivative will be in the direction opposite to your current direction of travel, with a larger magnitude for a greater speed. **It typically will be outweighed by the proportional and integral components, but if there’s some deviation from “normal” and the robot is going faster for some reason, the derivative component will become larger and your output power will be reduced. Similarly, if your robot is going slower than normal, the derivative component will be smaller in magnitude and hence the output power will become greater.** ### PID functions :::info Write this after the intro to PID part is written ::: - Developed during last year's season # Problems we've encountered during skills programming Problem 1: The robot doesn't drive straight when it were to drive Solution: For the drive PID control, we also added a P component for turning. We record the initial heading of the robot using the inertial sensor, then as the robot is driving, correct any error from the initial heading using the P loop. We allowed the drive straight PID loop to use 5/6 of the power and the turning P component to use 1/6 of power to correct the heading. Problem 2: The robot doesn't move to specific locations Solution: We incorporated distance sensors in the front and back, and using the P component, the robot can move to specific positions relative to the field rather than to the robot itself. If successful, the robot is able to score 200 points in programming skills!!!!