8#include <initializer_list>
29template <
class Distance>
31 :
public CommandHelper<CommandBase, ProfiledPIDCommand<Distance>> {
51 std::function<State()> goalSource,
52 std::function<
void(
double, State)> useOutput,
53 std::initializer_list<Subsystem*> requirements)
58 this->AddRequirements(requirements);
73 std::function<State()> goalSource,
74 std::function<
void(
double, State)> useOutput,
75 std::span<Subsystem* const> requirements = {})
78 m_goal{std::move(goalSource)},
80 this->AddRequirements(requirements);
96 std::function<
void(
double, State)> useOutput,
97 std::initializer_list<Subsystem*> requirements)
99 controller, measurementSource,
100 [goalSource =
std::move(goalSource)]() {
103 useOutput, requirements) {}
116 std::function<
Distance_t()> measurementSource,
118 std::function<
void(
double, State)> useOutput,
119 std::span<Subsystem* const> requirements = {})
121 controller, measurementSource,
122 [goalSource = std::move(goalSource)]() {
123 return State{goalSource(), Velocity_t{0}};
125 useOutput, requirements) {}
138 std::function<
Distance_t()> measurementSource, State goal,
139 std::function<
void(
double, State)> useOutput,
140 std::initializer_list<Subsystem*> requirements)
142 controller, measurementSource, [goal] {
return goal; }, useOutput,
156 std::function<
Distance_t()> measurementSource, State goal,
157 std::function<
void(
double, State)> useOutput,
158 std::span<Subsystem* const> requirements = {})
160 controller, measurementSource, [goal] {
return goal; }, useOutput,
174 std::function<
Distance_t()> measurementSource,
176 std::function<
void(
double, State)> useOutput,
177 std::initializer_list<Subsystem*> requirements)
179 controller, measurementSource, [goal] {
return goal; }, useOutput,
193 std::function<
Distance_t()> measurementSource,
195 std::function<
void(
double, State)> useOutput,
196 std::span<Subsystem* const> requirements = {})
198 controller, measurementSource, [goal] {
return goal; }, useOutput,
212 void End(
bool interrupted)
override {
CRTP implementation to allow polymorphic decorator functions in Command.
Definition: CommandHelper.h:25
A command that controls an output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:31
ProfiledPIDCommand(ProfiledPIDCommand &&other)=default
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, Distance_t goal, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:173
std::function< Distance_t()> m_measurement
Definition: ProfiledPIDCommand.h:225
std::function< void(double, State)> m_useOutput
Definition: ProfiledPIDCommand.h:227
void Initialize() override
Definition: ProfiledPIDCommand.h:205
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< State()> goalSource, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:49
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, State goal, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:155
std::function< State()> m_goal
Definition: ProfiledPIDCommand.h:226
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, State goal, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:137
void Execute() override
Definition: ProfiledPIDCommand.h:207
void End(bool interrupted) override
Definition: ProfiledPIDCommand.h:212
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< Distance_t()> goalSource, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:115
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< Distance_t()> goalSource, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:93
frc::ProfiledPIDController< Distance > m_controller
Definition: ProfiledPIDCommand.h:224
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, Distance_t goal, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constan...
Definition: ProfiledPIDCommand.h:192
frc::ProfiledPIDController< Distance > & GetController()
Returns the ProfiledPIDController used by the command.
Definition: ProfiledPIDCommand.h:221
ProfiledPIDCommand(frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< State()> goalSource, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.
Definition: ProfiledPIDCommand.h:71
ProfiledPIDCommand(const ProfiledPIDCommand &other)=default
Implements a PID control loop whose setpoint is constrained by a trapezoid profile.
Definition: ProfiledPIDController.h:35
Definition: TrapezoidProfile.h:67
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1445
Definition: ProfiledPIDCommand.h:18
Definition: BFloat16.h:88