Hello! So to get to the point, the PIDController we are using is not calculating an output value.
We set the controller to read input from an encoder and output to a talon. In the code it looks like this:
LiftControl (0.1, 0.1, 0.1, &EnTwoSim, &TwoSim);
We followed example given by the WPILibrary website. We want the PID to basically hold the lift at a position when the driver has stopped pushing the button to move the lift. We thought to accomplish this by making the setpoint of the class to be equal to the encodervalue. This would make the error small by nature but the PID should make the motor “fight” against forces pushing against it by design.
We printed the value of the error, encoder value, setpoint, and output value to the dashboard. As expected the error is small, and the encoder value and setpoint are close. However, the output value remains at 0. I have tried to set the minimum and maximum output values but that did nothing. I looked at the PIDController class and saw that there is a protected function that calculates the output but it can only be accessed by a “Notifier” that is created when the PIDController object is initialized.
Anyway, I hope this wasn’t too confusing and would greatly appreciate any help we could get on this issue. Thanks!