mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
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.
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
/* the project. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#pragma once
|
|
|
|
#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, double setpoint) override;
|
|
|
|
double GetMeasurement() override;
|
|
|
|
bool AtSetpoint();
|
|
|
|
void RunFeeder();
|
|
|
|
void StopFeeder();
|
|
|
|
private:
|
|
frc::PWMVictorSPX m_shooterMotor;
|
|
frc::PWMVictorSPX m_feederMotor;
|
|
frc::Encoder m_shooterEncoder;
|
|
frc::SimpleMotorFeedforward<units::turns> m_shooterFeedforward;
|
|
};
|