WPILibC++ 2024.3.2
|
A command that controls an output with a PIDController. More...
#include <frc2/command/PIDCommand.h>
Public Member Functions | |
PIDCommand (frc::PIDController controller, std::function< double()> measurementSource, std::function< double()> setpointSource, std::function< void(double)> useOutput, Requirements requirements={}) | |
Creates a new PIDCommand, which controls the given output with a PIDController. More... | |
PIDCommand (frc::PIDController controller, std::function< double()> measurementSource, double setpoint, std::function< void(double)> useOutput, Requirements requirements={}) | |
Creates a new PIDCommand, which controls the given output with a PIDController with a constant setpoint. More... | |
PIDCommand (PIDCommand &&other)=default | |
PIDCommand (const PIDCommand &other)=default | |
void | Initialize () override |
void | Execute () override |
void | End (bool interrupted) override |
frc::PIDController & | GetController () |
Returns the PIDController used by the command. More... | |
Public Member Functions inherited from frc2::CommandHelper< Command, PIDCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Protected Attributes | |
frc::PIDController | m_controller |
PID controller. More... | |
std::function< double()> | m_measurement |
Measurement getter. More... | |
std::function< double()> | m_setpoint |
Setpoint getter. More... | |
std::function< void(double)> | m_useOutput |
PID controller output consumer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< Command, PIDCommand > | |
std::unique_ptr< Command > | TransferOwnership () &&override |
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
frc2::PIDCommand::PIDCommand | ( | frc::PIDController | controller, |
std::function< double()> | measurementSource, | ||
std::function< double()> | setpointSource, | ||
std::function< void(double)> | useOutput, | ||
Requirements | requirements = {} |
||
) |
Creates a new PIDCommand, which controls the given output with a PIDController.
controller | the controller that controls the output. |
measurementSource | the measurement of the process variable |
setpointSource | the controller's reference (aka setpoint) |
useOutput | the controller's output |
requirements | the subsystems required by this command |
frc2::PIDCommand::PIDCommand | ( | frc::PIDController | controller, |
std::function< double()> | measurementSource, | ||
double | setpoint, | ||
std::function< void(double)> | useOutput, | ||
Requirements | requirements = {} |
||
) |
Creates a new PIDCommand, which controls the given output with a PIDController with a constant setpoint.
controller | the controller that controls the output. |
measurementSource | the measurement of the process variable |
setpoint | the controller's setpoint (aka setpoint) |
useOutput | the controller's output |
requirements | the subsystems required by this command |
|
default |
|
default |
|
override |
|
override |
frc::PIDController & frc2::PIDCommand::GetController | ( | ) |
Returns the PIDController used by the command.
|
override |
|
protected |
PID controller.
|
protected |
Measurement getter.
|
protected |
Setpoint getter.
|
protected |
PID controller output consumer.