Class PIDController

java.lang.Object
edu.wpi.first.wpilibj.PIDBase
edu.wpi.first.wpilibj.PIDController
All Implemented Interfaces:
Sendable, Controller, PIDInterface, PIDOutput, AutoCloseable

@Deprecated(since="2020",
            forRemoval=true)
public class PIDController
extends PIDBase
implements Controller
Deprecated, for removal: This API element is subject to removal in a future version.
Use PIDController instead.
Class implements a PID Control Loop.

Creates a separate thread which reads the given PIDSource and takes care of the integral calculations, as well as writing the given PIDOutput.

This feedback controller runs in discrete time, so time deltas are not used in the integral and derivative calculations. Therefore, the sample rate affects the controller's behavior for a given set of PID constants.

This class is provided by the OldCommands VendorDep

  • Constructor Details

    • PIDController

      public PIDController​(double Kp, double Ki, double Kd, double Kf, PIDSource source, PIDOutput output, double period)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocate a PID object with the given constants for P, I, D, and F.
      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
      period - the loop time for doing calculations in seconds. This particularly affects calculations of the integral and differential terms. The default is 0.05 (50ms).
    • PIDController

      public PIDController​(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output, double period)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocate a PID object with the given constants for P, I, D and period.
      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
      period - the loop time for doing calculations in seconds. This particularly affects calculations of the integral and differential terms. The default is 0.05 (50ms).
    • PIDController

      public PIDController​(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocate a PID object with the given constants for P, I, D, using a 50ms period.
      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
    • PIDController

      public PIDController​(double Kp, double Ki, double Kd, double Kf, PIDSource source, PIDOutput output)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Allocate a PID object with the given constants for P, I, D, using a 50ms period.
      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 Details

    • close

      public void close()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class PIDBase
    • enable

      public void enable()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Begin running the PIDController.
      Specified by:
      enable in interface Controller
    • disable

      public void disable()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Stop running the PIDController, this sets the output to zero before stopping.
      Specified by:
      disable in interface Controller
    • setEnabled

      public void setEnabled​(boolean enable)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the enabled state of the PIDController.
      Parameters:
      enable - True to enable the PIDController.
    • isEnabled

      public boolean isEnabled()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return true if PIDController is enabled.
      Returns:
      True if PIDController is enabled.
    • reset

      public void reset()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Reset the previous error, the integral term, and disable the controller.
      Specified by:
      reset in interface PIDInterface
      Overrides:
      reset in class PIDBase
    • initSendable

      public void initSendable​(SendableBuilder builder)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Sendable
      Initializes this Sendable object.
      Specified by:
      initSendable in interface Sendable
      Overrides:
      initSendable in class PIDBase
      Parameters:
      builder - sendable builder