ProportionalController
The most simple controller - a directly proportional controller. The value outputted by this controller will be directly proportional to the error (or the values inputted to the controller).
For most use cases, this type of controller will work perfectly fine. It can be used for a robot's turn controller. While a PID controller might offer more advanced control, this proportional controller is often sufficient and simpler to implement.
Methods
ProportionalController(double coefficient)
Constructs a new ProportionalController.
coefficient: The controller's coefficient. Higher coefficients mean higher outputs, lower coefficients mean lower outputs. A negative coefficient "inverts" the controller. A coefficient of 0 renders the controller completely useless.
getCoefficient()
Returns the controller's coefficient.
calculate(double value)
Calculates an output value by multiplying the distance from the target value (target - input) by the controller's coefficient. The output is then clipped to the controller's configured minimum and maximum output limits.
toString()
Returns a string representation of the ProportionalController, including its coefficient, target, and configured minimum and maximum output values.