SmartDashboard ile PID Ayarı
The PID (Proportional, Integral, Differential) is an algorithm for determining the motor speed based on sensor feedback to reach a setpoint as quickly as possible. For example, a robot with an elevator that moves to a predetermined position should move there as fast as possible then stop without excessive overshoot leading to oscillation. Getting the PID controller to behave this way is called “tuning”. The idea is to compute an error value that is the difference between the current value of the mechanism feedback element and the desired (setpoint) value. In the case of the arm, there might be a potentiometer connected to an analog channel that provides a voltage that is proportional to the position of the arm. The desired value is the voltage that is predetermined for the position the arm should move to, and the current value is the voltage for the actual position of the arm.
Finding the setpoint values with LiveWindow

Create a PID Subsystem for each mechanism with feedback. The PID Subsystems contain the actuator (motor) and the feedback sensor (potentiometer in this case). You can use Test mode to display the subsystem sensors and actuators. Using the slider manually adjust the actuator to each desired position. Note the sensor values (2) for each of the desired positions. These will become the setpoints for the PID controller.
Viewing the PIDController in LiveWindow

In Test mode, the PID Subsystems display their P, I, and D parameters that are set in the code. The P, I, and D values are the weights applied to the computed error (P), sum of errors over time (I), and the rate of change of errors (D). Each of those terms is multiplied by the weights and added together to form the motor value. Choosing the optimal P, I, and D values can be difficult and requires some amount of experimentation. The Test mode on the robot allows the values to be modified, and the mechanism response observed.
Önemli
The enable option does not affect the PIDController introduced in 2020, as the controller is updated every robot loop. See the example here on how to retain this functionality.
Tuning the PIDController

PID kontrolörünün ayarlaması zorlayıcı olabilmekte ve kullanılabilecek teknikleri açıklayan birçok makale bulunmaktadır. P değeri ile başlamak en iyi tercih olacaktır. Farklı değerleri denemek için P’ye düşük bir değer atayıp bu belgede daha öncedem belirlenmiş bir ayar noktası giriniz, düzeneğin ne kadar hızlı tepki verdiğine dikkat ediniz. Belki de ayar noktasında hiç ulaşamayacak çok yavaş bir tepki söz konusuysa P değerini arttırınız. Belki de sallanacak kadar çok hızlı bir tepki söz konusuysa P değerini azaltınız. Sallanma olmadan olabildiğince hızlı bir tepki alana kadar bu ayarlama işlemini tekrar ediniz. Düzeneğiniz üzerinde yeterli kontrole sahip olmak için gerekli tek şeyin P terimi olması mümkündür. Daha fazla bilgi için bkz. Tuning a Flywheel Velocity Controller belgesi.
Once you have determined P, I, and D values they can be inserted into the program. You’ll find them either in the properties for the PIDSubsystem in RobotBuilder or in the constructor for the PID Subsystem in your code.
The F (feedforward) term is used for controlling velocity with a PID controller.
More information can be found at WPILib’de PID Kontrolü.