Class SynchronousPID

  • All Implemented Interfaces:
    PIDInterface, PIDOutput, Sendable, AutoCloseable

    public class SynchronousPID
    extends PIDBase
    Class implements a synchronous PID control loop.

    Provides a calculate method for the user to call at their desired update rate.

    • Constructor Detail

      • SynchronousPID

        public SynchronousPID​(double Kp,
                              double Ki,
                              double Kd,
                              PIDSource source,
                              PIDOutput output)
        Allocate a PID object with the given constants for P, I, and D.
        Parameters:
        Kp - the proportional coefficient
        Ki - the integral coefficient
        Kd - the derivative coefficient
        source - The PIDSource object that is used to get values
        output - The PIDOutput object that is set to the output percentage
      • SynchronousPID

        public SynchronousPID​(double Kp,
                              double Ki,
                              double Kd,
                              double Kf,
                              PIDSource source,
                              PIDOutput output)
        Allocate a PID object with the given constants for P, I, and D.
        Parameters:
        Kp - the proportional coefficient
        Ki - the integral coefficient
        Kd - the derivative coefficient
        Kf - the feed forward term
        source - The PIDSource object that is used to get values
        output - The PIDOutput object that is set to the output percentage
    • Method Detail

      • free

        public void free()
        Free the PID object.
        Overrides:
        free in class SendableBase
      • calculate

        public void calculate()
        Read the input, calculate the output accordingly, and write to the output.
        Overrides:
        calculate in class PIDBase