Class PIDCommand

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.PIDCommand
All Implemented Interfaces:
Sendable

@Deprecated(forRemoval=true, since="2025") public class PIDCommand extends Command
Deprecated, for removal: This API element is subject to removal in a future version.
Use a PIDController instead
A command that controls an output with a PIDController. Runs forever by default - to add exit conditions and/or other behavior, subclass this class. The controller calculation and output are performed synchronously in the command's execute() method.

This class is provided by the NewCommands VendorDep

  • Field Details

    • m_controller

      protected final PIDController m_controller
      Deprecated, for removal: This API element is subject to removal in a future version.
      PID controller.
    • m_measurement

      Deprecated, for removal: This API element is subject to removal in a future version.
      Measurement getter.
    • m_setpoint

      Deprecated, for removal: This API element is subject to removal in a future version.
      Setpoint getter.
    • m_useOutput

      Deprecated, for removal: This API element is subject to removal in a future version.
      PID controller output consumer.
  • Constructor Details

    • PIDCommand

      public PIDCommand(PIDController controller, DoubleSupplier measurementSource, DoubleSupplier setpointSource, DoubleConsumer useOutput, Subsystem... requirements)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new PIDCommand, which controls the given output with a PIDController.
      Parameters:
      controller - the controller that controls the output.
      measurementSource - the measurement of the process variable
      setpointSource - the controller's setpoint
      useOutput - the controller's output
      requirements - the subsystems required by this command
    • PIDCommand

      public PIDCommand(PIDController controller, DoubleSupplier measurementSource, double setpoint, DoubleConsumer useOutput, Subsystem... requirements)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new PIDCommand, which controls the given output with a PIDController.
      Parameters:
      controller - the controller that controls the output.
      measurementSource - the measurement of the process variable
      setpoint - the controller's setpoint
      useOutput - the controller's output
      requirements - the subsystems required by this command
  • Method Details

    • initialize

      public void initialize()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: Command
      The initial subroutine of a command. Called once when the command is initially scheduled.
      Overrides:
      initialize in class Command
    • execute

      public void execute()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: Command
      The main body of a command. Called repeatedly while the command is scheduled.
      Overrides:
      execute in class Command
    • end

      public void end(boolean interrupted)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from class: Command
      The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.

      Do not schedule commands here that share requirements with this command. Use Command.andThen(Command...) instead.

      Overrides:
      end in class Command
      Parameters:
      interrupted - whether the command was interrupted/canceled
    • getController

      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the PIDController used by the command.
      Returns:
      The PIDController