22template <
class Distance>
40 : m_controller{controller} {
41 SetGoal(initialPosition);
46 UseOutput(m_controller.Calculate(GetMeasurement()),
47 m_controller.GetSetpoint());
56 void SetGoal(State goal) { m_controller.SetGoal(goal); }
69 m_controller.Reset(GetMeasurement());
100 bool m_enabled{
false};
117 virtual void UseOutput(
double output, State setpoint) = 0;
A subsystem that uses a ProfiledPIDController to control an output.
Definition ProfiledPIDSubsystem.h:24
virtual Distance_t GetMeasurement()=0
Returns the measurement of the process variable used by the ProfiledPIDController.
ProfiledPIDSubsystem(frc::ProfiledPIDController< Distance > controller, Distance_t initialPosition=Distance_t{0})
Creates a new ProfiledPIDSubsystem.
Definition ProfiledPIDSubsystem.h:38
bool IsEnabled()
Returns whether the controller is enabled.
Definition ProfiledPIDSubsystem.h:86
frc::ProfiledPIDController< Distance > & GetController()
Returns the ProfiledPIDController.
Definition ProfiledPIDSubsystem.h:93
void Periodic() override
This method is called periodically by the CommandScheduler.
Definition ProfiledPIDSubsystem.h:44
virtual void UseOutput(double output, State setpoint)=0
Uses the output from the ProfiledPIDController.
void SetGoal(Distance_t goal)
Sets the goal state for the subsystem.
Definition ProfiledPIDSubsystem.h:63
frc::ProfiledPIDController< Distance > m_controller
Profiled PID controller.
Definition ProfiledPIDSubsystem.h:97
virtual void Disable()
Disables the PID control.
Definition ProfiledPIDSubsystem.h:76
virtual void Enable()
Enables the PID control.
Definition ProfiledPIDSubsystem.h:68
void SetGoal(State goal)
Sets the goal state for the subsystem.
Definition ProfiledPIDSubsystem.h:56
A base for subsystems that handles registration in the constructor, and provides a more intuitive met...
Definition SubsystemBase.h:24
Implements a PID control loop whose setpoint is constrained by a trapezoid profile.
Definition ProfiledPIDController.h:34
Profile state.
Definition TrapezoidProfile.h:96
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition base.h:1438
Definition FunctionalCommand.h:13