28template <
class Distance>
30 :
public CommandHelper<Command, ProfiledPIDCommand<Distance>> {
50 std::function<State()> goalSource,
51 std::function<
void(
double, State)> useOutput,
55 m_goal{std::move(goalSource)},
57 this->AddRequirements(requirements);
73 std::function<
void(
double, State)> useOutput,
76 controller, measurementSource,
77 [goalSource = std::move(goalSource)]() {
78 return State{goalSource(), Velocity_t{0}};
80 useOutput, requirements) {}
93 std::function<
Distance_t()> measurementSource, State goal,
94 std::function<
void(
double, State)> useOutput,
97 controller, measurementSource, [goal] {
return goal; }, useOutput,
111 std::function<
Distance_t()> measurementSource,
113 std::function<
void(
double, State)> useOutput,
116 controller, measurementSource, [goal] {
return goal; }, useOutput,
130 void End(
bool interrupted)
override {
CRTP implementation to allow polymorphic decorator functions in Command.
Definition: CommandHelper.h:27
A command that controls an output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:30
ProfiledPIDCommand(ProfiledPIDCommand &&other)=default
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, State goal, std::function< void(double, State)> useOutput, Requirements requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:92
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, Distance_t goal, std::function< void(double, State)> useOutput, Requirements requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:110
std::function< Distance_t()> m_measurement
Measurement getter.
Definition: ProfiledPIDCommand.h:146
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< State()> goalSource, std::function< void(double, State)> useOutput, Requirements requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:48
std::function< void(double, State)> m_useOutput
Profiled PID controller output consumer.
Definition: ProfiledPIDCommand.h:152
void Initialize() override
Definition: ProfiledPIDCommand.h:123
std::function< State()> m_goal
Goal getter.
Definition: ProfiledPIDCommand.h:149
void Execute() override
Definition: ProfiledPIDCommand.h:125
void End(bool interrupted) override
Definition: ProfiledPIDCommand.h:130
frc::ProfiledPIDController< Distance > m_controller
Profiled PID controller.
Definition: ProfiledPIDCommand.h:143
frc::ProfiledPIDController< Distance > & GetController()
Returns the ProfiledPIDController used by the command.
Definition: ProfiledPIDCommand.h:139
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< Distance_t()> goalSource, std::function< void(double, State)> useOutput, Requirements requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:70
ProfiledPIDCommand(const ProfiledPIDCommand &other)=default
Represents requirements for a command, which is a set of (pointers to) subsystems.
Definition: Requirements.h:20
Implements a PID control loop whose setpoint is constrained by a trapezoid profile.
Definition: ProfiledPIDController.h:35
Profile state.
Definition: TrapezoidProfile.h:90
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1434
Definition: TrapezoidProfileSubsystem.h:12