I’ve read over the documentation and examples for enabling trapezoidal pid control with spark max controllers, but I am still unsure on how to set it all up and use it. So far, I have set the constants for the pid controller and the max velocity and acceleration parameters. But I have no idea how the controller actually changes modes to start controlling the motors via the pid. Does it just magically do it everytime I call setReference with CANSparkMax.ControlType.kSmartMotion? If I want to to implement a drive forward N meters, do I need to set the encoder position to 0 before the first setReference? How do exit smart motion mode and return to open loop? Do I just stop calling setReference and just start calling set()? What would I do in my comand end() method to ensure the PID was no longer trying to command the motor?
Thanks in advance
AJ