mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Improve various subsystem APIs (#2130)
Improves the APIs for various prebuilt subsystems (PIDSubsystem, TrapezoidProfileSubsystem, ProfiledPIDSubsystem). Addresses #2128, and also changes the rather cumbersome getSetpoint API to a more intuitive setSetpoint one. Updates examples to match.
This commit is contained in:
@@ -9,20 +9,18 @@
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/PWMVictorSPX.h>
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
#include <frc2/command/PIDSubsystem.h>
|
||||
#include <units/units.h>
|
||||
|
||||
class ShooterSubsystem : public frc2::PIDSubsystem {
|
||||
public:
|
||||
ShooterSubsystem();
|
||||
|
||||
void UseOutput(double output) override;
|
||||
|
||||
double GetSetpoint() override;
|
||||
void UseOutput(double output, double setpoint) override;
|
||||
|
||||
double GetMeasurement() override;
|
||||
|
||||
void Disable() override;
|
||||
|
||||
bool AtSetpoint();
|
||||
|
||||
void RunFeeder();
|
||||
@@ -33,4 +31,5 @@ class ShooterSubsystem : public frc2::PIDSubsystem {
|
||||
frc::PWMVictorSPX m_shooterMotor;
|
||||
frc::PWMVictorSPX m_feederMotor;
|
||||
frc::Encoder m_shooterEncoder;
|
||||
frc::SimpleMotorFeedforward<units::turns> m_shooterFeedforward;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user