What I cannot find is a method to determine if it has reached its goal so I can mark the command finished. WPILib PIDController give the method “getController().atSetpoint()” so we can close a command.
I’ve never worked with SparkMax APIs, but according to their javadoc it appears that you should be able to get your current measurement, you know or can query your desired measurement, and you know or can query the allowable error in the measurement that would be considered success.
With those three pieces of information you should be able to get where you need in terms of knowing when it has completed.
So the important things to know about PIDs is really you’re just measuring (more or less) the following:
Where am I? → current measurement
Where do I want to be? → set point
How far away am I? → error, (setpoint - current = error)
The PID controller is doing that rough calculation, and then based on the error measurements is applying corrections (positive or negative) to get you where you want to be efficiently.