26 | | In the real world, closed-loop control is tricky: the Talon must account for changing loads on the motor and the inertia of its mechanisms (arm, entire robot, etc.). If motor power is adjusted too quickly, the motor can overshoot its goal; if power is adjusted too slowly, the mechanism may not respond to changes in a timely fashion. |
| 26 | In the real world, closed-loop control is tricky: the Talon must account for changing loads on the motor and the inertia of its mechanisms (arm, entire robot, etc.). If motor power is adjusted too quickly, the motor can overshoot its goal; if power is adjusted too slowly, the mechanism may not respond to changes in a timely fashion. The control loop can even become unstable and oscillate around its target. |
29 | | Closed-loop motor control (including the Talons) typically uses PID control loops to achieve the mechanism's control objectives: balancing responsiveness with stability. PID control considers 3 factors (P, I, D) when deciding how to adjust motor power to balance responsiveness (how fast the motor responds to changes) with stability (not over/under shooting the target). Because motors drive different mechanisms with different loads, inertia, speeds, and responsiveness requirements, you must tune the PID factors properly for each Talon when you configure it for close-loop control; this page discusses in plain language what that means. |
| 29 | Closed-loop motor control (including the software built into the Talons) typically uses PID control loops to achieve the mechanism's control objectives: balancing responsiveness with stability. PID control considers 3 factors (P, I, D) when deciding how to adjust motor power to balance responsiveness (how fast the motor responds to changes) with stability (not over/under shooting the target). Because motors drive different mechanisms with different loads, inertia, speeds, and responsiveness requirements, you must tune the PID factors properly for each Talon when you configure it for close-loop control; this page discusses in plain language what that means. |
32 | | If you want a motor to spin at 100rpm and it was stopped, taking the simplest approach, you might apply full power to the motor and then measure again, but with no load, full power might get it spinning at 2000rpm before you can measure again - severely overshooting your goal. Conversely if the motor is under heavy load and was running a bit too fast (e.g. 110rpm at last measurement), cutting all power to the motor might cause it to drop to 0rpm before you measure again - severely undershooting the goal. A system like this is very responsive to changes but is not stable: it over/undershoots goals by adjusting power too much and can even oscillate (never stabilize on the desired goal). |
| 32 | You might want to move a mechanism to a particular position and then stop and hold it at that position. To move the mechanism, you apply power to the motor, ramping it up until the motor overcomes the mechanism's inertia and starts moving; the trick then is to get the mechanism to stop in the desired position and then continuously adjust power to the motor to hold it there. PID must account for many factors; for example, it can't just cut power to the motor when it reaches the target position because the inertia of the mechanism will carry it past (overshoot). Moreover, in many cases, the motor must have continuous power applied or the mechanism will backdrive and fall away from its target position. PID control must ramp power to the motor so the mechanism quickly reaches the target position, but ramp down the power as it approaches the target position and then continuously adjust power to maintain position. It's tricky. |
| 33 | |
| 34 | Similarly, if you want a motor to spin at 100rpm, taking the simplest approach, you might apply full power to the motor to get it started and then measure again, but with no load, full power might get it spinning at 2000rpm before you can measure again - severely overshooting your goal. Conversely if the motor is under heavy load and was running a bit too fast (e.g. 110rpm at last measurement), cutting all power to the motor might cause it to drop to 0rpm before you measure again - severely undershooting the goal. A system like this is very responsive to changes but is not stable: it over/undershoots goals by adjusting power too much and can even oscillate (never stabilize on the desired goal). |
39 | | PID is used to balance responsiveness and stability using factors P, I, D, and sometimes F that you can tune. When you configure your PID control loop (in the Talon or RoboRio), you will need to set those 3 factors. There is no perfect setting, it's always going to be a trade off between responsiveness, overshoot, and stability, but you should experiment with different values to tune your mechanism properly (there are also mathematical approaches to tuning that you can find with some googling). |
| 41 | PID is used to balance responsiveness and stability using factors P, I, D, and sometimes F that you can tune. When you configure your PID control loop (in the Talon or !RoboRio), you will need to set those 3 factors. There is no perfect setting, it's always going to be a trade off between responsiveness, overshoot, and stability, but you should experiment with different values to tune your mechanism properly (there are also mathematical approaches to tuning that you can find with some googling). |