We are trying to set the PID coefficients for an arm controlled by a motor. We wanted to set a feed forward term to counteract gravity and make the system more stable, but when we set the coefficients using the code below, we get a not implemented exception. Why is this implemented for velocity control, but not position control? Is there any way to do this without programming the whole thing ourselves by hand?
I do believe that setPIFDCoefficients() is implemented for Blocks however from the documentation…
'Not all DcMotors support this feature.'
What type of motor are you using?
I think you need to update the firmware on your Control Hub and/or Expansion Hub to version 1.8.2.
I believe that
RUN_TO_POSITION may not implement PIDF control as the F term would not really work for position control. Perhaps you meant to tune the velocity controller and should make sure to change the
RUN_USING_ENCODER to update the velocity controller coefficients. The FTC SDK has some documentation for setting the coefficients. To learn about the cascading control architecture and tuning equations (for a lighter load,) there is this document.
This doesn’t answer your original question about the error, but assuming you get that fixed… you may also need to know this…
If you want to run in RUN_TO_POSITION mode and adjust the controller gains, then you really need to define TWO sets of coefficients:
- set the PIDF coefficients for RUN_USING_ENCODERS mode to control the motor velocity
- set the P coefficient for RUN_TO_POSITION mode to control the motor position.
The two controllers work together when running in RUN_TO_POSITION mode.
Just the P term is used to control the position loop. It calculates the desired velocity. Then the PIDF coeffs are used to obtain the desired velocity. Feed Forward is only relevant with the Velocity control component.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.