added shooter subsystem - #2
Conversation
| private CANSparkMax mShoot; | ||
| private CANPIDController pidController; | ||
| private CANEncoder encoder; | ||
| public double kP, kI, kD, kIz, kFF, kMaxOutput, kMinOutput; |
There was a problem hiding this comment.
Use the Constants file and add a shooter kP, kI, etc..
There was a problem hiding this comment.
Since these can actually be changed though the UI, keep them here but remove the 'k' prefix. See comment below
| double p = SmartDashboard.getNumber("P Gain", 0); | ||
| double i = SmartDashboard.getNumber("I Gain", 0); | ||
| double d = SmartDashboard.getNumber("D Gain", 0); | ||
| // double iz = SmartDashboard.getNumber("I Zone", 0); |
| private CANSparkMax mShoot; | ||
| private CANPIDController pidController; | ||
| private CANEncoder encoder; | ||
| public double kP, kI, kD, kIz, kFF, kMaxOutput, kMinOutput; |
There was a problem hiding this comment.
Since these can actually be changed though the UI, keep them here but remove the 'k' prefix. See comment below
| kP = 0.00010; | ||
| kI = 0; | ||
| kD = .0000; | ||
| kIz = 0; | ||
| kFF = 0.000175; | ||
| kMaxOutput = 1; | ||
| kMinOutput = -1; |
There was a problem hiding this comment.
Create shooter constants in the Constants.java file like Andrew said. Assign the constants as the defaults here.
| } | ||
| public void setPIDVelocitySetpoint(double setpoint) | ||
| { | ||
| pidController.setReference(setpoint, ControlType.kVelocity); |
There was a problem hiding this comment.
Document units for setpoint. I believe they are RPMs
There was a problem hiding this comment.
Document for velocity() method as well
| { | ||
| return encoder.getVelocity(); | ||
| } | ||
| public double fpsToRPM(double fps){ |
There was a problem hiding this comment.
Remove unused function. This was copied from the drive subsystem and is not relevant here
|
|
||
|
|
||
| public ShooterSubsystem() { | ||
| mShoot = new CANSparkMax(1, MotorType.kBrushless); |
There was a problem hiding this comment.
Create a constant in Constants.java for the shooter sparkmax deviceID
| if((i != kI)) { pidController.setI(i); kI = i; | ||
| LOGGER.warning("PID CHANGED");} | ||
| if((d != kD)) { pidController.setD(d); kD = d; | ||
| LOGGER.warning(pidController.getD() +" D CHANGED");} |
There was a problem hiding this comment.
Make these logger outputs more specific/useful. e.g. print the subsystem its related to and which value changed for each
No description provided.