-
Notifications
You must be signed in to change notification settings - Fork 0
(FTC) Motor PIDs
The REV Control Hub and Expansion Hub have built in hardware-based motor controllers controlled via the Lynx protocol.
The motors have two PID control modes: velocity and position.
The velocity mode uses a single velocity PID+F controller, also known as a PVA+F (Position, Velocity, Acceleration plus Feed Forward) controller. The process variable for the PVA controller is the velocity of the motor. The set point for the PVA controller is the desired velocity. The velocity is given in encoder ticks per second, and the output ranges from -32767 to +32767, where +32767 means 100% ouput to the motor.
PVAs do not have the same algorithm as standard PIDs, although the algorithm is related.
The equation for PVA controllers is obtained from the first time derivative of the standard PID equation. As a result, PVAs do not drive their output variable directly: they drive changes to their output variable. (Feed forward is added after the "final" PVA output has been determined and is equal to the velocity setpoint times the constant F.)
Additionally, because of the derivative, the meaning and behavior of the P I and D constants in a PVA controller is different from that of the standard PID controller. The I constant of a PVA controller takes on the role of the P constant in the PID controller. The P constant of a PVA controller takes on the role of the D constant of the PID controller. The D constant of the PVA controller and the I constant of the PID controller have no equivant to each other.
PID PVA
-----------------------------------------
P I
I no equivalent
D P
no equiavlent D
The position mode makes use of two PIDs: a P-only PID that uses the current position of the motor as the process variable and the desired psosition as the set point and the previously described velocity PVA. The output of the position PID is used as the velocity setpoint for the the velocity PVA.