diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index a0cef9f..1b9b7a8 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -100,7 +100,7 @@ public final class Constants { public static final int DEGREES_PER_ROT = 0; //""// public static final int TURRET_MOTOR_POS_AT_ZERO_ROT = 0; //""// public static final int TURRET_MOTOR_ROTS_PER_ROT = 0; //""// - + public static final double ENCODER_TICKS_PER_REV = 2048; //""// /* Turret Constants */ diff --git a/src/main/java/frc4388/robot/subsystems/BoomBoom.java b/src/main/java/frc4388/robot/subsystems/BoomBoom.java index f2809c2..005abdc 100644 --- a/src/main/java/frc4388/robot/subsystems/BoomBoom.java +++ b/src/main/java/frc4388/robot/subsystems/BoomBoom.java @@ -5,21 +5,17 @@ package frc4388.robot.subsystems; import java.util.Base64.Encoder; - import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.TalonFXControlMode; import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import edu.wpi.first.wpilibj.smartdashboard.*; import edu.wpi.first.math.controller.BangBangController; -import edu.wpi.first.math.controller.SimpleMotorFeedforward; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc4388.robot.Constants.ShooterConstants; import frc4388.utility.ShooterTables; import frc4388.utility.Gains; import frc4388.utility.controller.IHandController; -import com.revrobotics.RelativeEncoder; -import com.revrobotics.*; public class BoomBoom extends SubsystemBase { public WPI_TalonFX m_shooterFalconLeft = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_BALLER_ID); @@ -40,8 +36,6 @@ public Turret m_turretSubsystem; -SimpleMotorFeedforward feedforward = new SimpleMotorFeedforward(69, 42, 0); //get real values later - /* @@ -51,15 +45,11 @@ public BoomBoom(){ //Testing purposes resetting gyros //resetGryoAngleADj(); //shooterTrims = new Trims(0,0); -feedforward.calculate(15, 20); // feedforward.calculate(velocity, acceleration); - - } /** Creates a new BoomBoom. */ public BoomBoom(WPI_TalonFX shooterFalconLeft, WPI_TalonFX shooterFalconRight) { m_shooterFalconLeft = shooterFalconLeft; m_shooterFalconRight = shooterFalconRight; - int closedLoopTimeMs = 1; //LEFT FALCON m_shooterFalconLeft.configFactoryDefault(); @@ -72,7 +62,6 @@ feedforward.calculate(15, 20); // feedforward.calculate(velocity, acceleration); m_shooterFalconLeft.configClosedLoopPeriod(0, closedLoopTimeMs, ShooterConstants.SHOOTER_TIMEOUT_MS); m_shooterFalconLeft.configSupplyCurrentLimit(ShooterConstants.SUPPLY_CURRENT_LIMIT_CONFIG, ShooterConstants.SHOOTER_TIMEOUT_MS); - //RIGHT FALCON m_shooterFalconRight.configFactoryDefault(); m_shooterFalconRight.setNeutralMode(NeutralMode.Coast); @@ -139,8 +128,7 @@ public void setShooterGains() { //Controls a motor with the output of the BangBang controller //Controls a motor with the output of the BangBang conroller and a feedforward //Shrinks the feedforward slightly to avoid over speeding the shooter - m_shooterFalconLeft.set(controller.calculate(encoder.getRate(), targetVel) + 0.9 * feedforward.calculate(targetVel)); - + m_shooterFalconLeft.set(controller.calculate(Encoder.getRate(), targetVel) + 0.9 * feedforward.calculate(targetVel)); } }