WPILibC++ 2023.4.3-108-ge5452e3
|
A command that controls an output with a PIDController. More...
#include <frc2/command/PIDCommand.h>
Public Member Functions | |
PIDCommand (PIDController controller, std::function< double()> measurementSource, std::function< double()> setpointSource, std::function< void(double)> useOutput, std::initializer_list< Subsystem * > requirements) | |
Creates a new PIDCommand, which controls the given output with a PIDController. More... | |
PIDCommand (PIDController controller, std::function< double()> measurementSource, std::function< double()> setpointSource, std::function< void(double)> useOutput, std::span< Subsystem *const > requirements={}) | |
Creates a new PIDCommand, which controls the given output with a PIDController. More... | |
PIDCommand (PIDController controller, std::function< double()> measurementSource, double setpoint, std::function< void(double)> useOutput, std::initializer_list< Subsystem * > requirements) | |
Creates a new PIDCommand, which controls the given output with a PIDController with a constant setpoint. More... | |
PIDCommand (PIDController controller, std::function< double()> measurementSource, double setpoint, std::function< void(double)> useOutput, std::span< Subsystem *const > 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 |
PIDController & | GetController () |
Returns the PIDController used by the command. More... | |
Public Member Functions inherited from frc2::CommandHelper< CommandBase, PIDCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Protected Attributes | |
PIDController | m_controller |
std::function< double()> | m_measurement |
std::function< double()> | m_setpoint |
std::function< void(double)> | m_useOutput |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< CommandBase, 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 | ( | PIDController | controller, |
std::function< double()> | measurementSource, | ||
std::function< double()> | setpointSource, | ||
std::function< void(double)> | useOutput, | ||
std::initializer_list< Subsystem * > | 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 | ( | PIDController | controller, |
std::function< double()> | measurementSource, | ||
std::function< double()> | setpointSource, | ||
std::function< void(double)> | useOutput, | ||
std::span< Subsystem *const > | 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 | ( | PIDController | controller, |
std::function< double()> | measurementSource, | ||
double | setpoint, | ||
std::function< void(double)> | useOutput, | ||
std::initializer_list< Subsystem * > | 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 |
frc2::PIDCommand::PIDCommand | ( | PIDController | controller, |
std::function< double()> | measurementSource, | ||
double | setpoint, | ||
std::function< void(double)> | useOutput, | ||
std::span< Subsystem *const > | 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 |
PIDController & frc2::PIDCommand::GetController | ( | ) |
Returns the PIDController used by the command.
|
override |
|
protected |
|
protected |
|
protected |
|
protected |