From 759e6578c424a04672f6e8c88e763100ea79b728 Mon Sep 17 00:00:00 2001 From: minhnguyenbhs Date: Wed, 2 Oct 2024 18:46:37 -0400 Subject: [PATCH] cleaning up --- src/main/java/frc/robot/BuildConstants.java | 10 ++++----- .../subsystems/intake/IntakeNEOVortex.java | 3 +-- .../subsystems/scoring/ShooterIOTalonFX.java | 21 ++++++++----------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/main/java/frc/robot/BuildConstants.java b/src/main/java/frc/robot/BuildConstants.java index 75a6350..a97f6a4 100644 --- a/src/main/java/frc/robot/BuildConstants.java +++ b/src/main/java/frc/robot/BuildConstants.java @@ -5,12 +5,12 @@ public final class BuildConstants { public static final String MAVEN_GROUP = ""; public static final String MAVEN_NAME = "high-key-2024-2"; public static final String VERSION = "unspecified"; - public static final int GIT_REVISION = 20; - public static final String GIT_SHA = "60857c99f27fe0d7e277b51b2878d3550123a1a8"; - public static final String GIT_DATE = "2024-10-02 18:10:46 EDT"; + public static final int GIT_REVISION = 21; + public static final String GIT_SHA = "6f294fbe0f63115f6c9e4f57d2a2ec855bb55efa"; + public static final String GIT_DATE = "2024-10-02 18:42:46 EDT"; public static final String GIT_BRANCH = "shooter-hardware"; - public static final String BUILD_DATE = "2024-10-02 18:25:06 EDT"; - public static final long BUILD_UNIX_TIME = 1727907906440L; + public static final String BUILD_DATE = "2024-10-02 18:45:16 EDT"; + public static final long BUILD_UNIX_TIME = 1727909116112L; public static final int DIRTY = 1; private BuildConstants() {} diff --git a/src/main/java/frc/robot/subsystems/intake/IntakeNEOVortex.java b/src/main/java/frc/robot/subsystems/intake/IntakeNEOVortex.java index 709dcc0..f219ec6 100644 --- a/src/main/java/frc/robot/subsystems/intake/IntakeNEOVortex.java +++ b/src/main/java/frc/robot/subsystems/intake/IntakeNEOVortex.java @@ -14,9 +14,8 @@ import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.motorcontrol.Spark; import com.revrobotics.CANSparkFlex; -import com.revrobotics.SparkLimitSwitch; import com.revrobotics.CANSparkLowLevel.MotorType; - +import com.revrobotics.SparkLimitSwitch; import frc.robot.constants.IntakeConstants; import frc.robot.constants.SensorConstants; import frc.robot.constants.IntakeConstants; diff --git a/src/main/java/frc/robot/subsystems/scoring/ShooterIOTalonFX.java b/src/main/java/frc/robot/subsystems/scoring/ShooterIOTalonFX.java index b739fbf..8d3b0ab 100644 --- a/src/main/java/frc/robot/subsystems/scoring/ShooterIOTalonFX.java +++ b/src/main/java/frc/robot/subsystems/scoring/ShooterIOTalonFX.java @@ -6,19 +6,21 @@ import com.ctre.phoenix6.controls.VelocityDutyCycle; import com.ctre.phoenix6.hardware.TalonFX; import com.ctre.phoenix6.signals.NeutralModeValue; +import com.revrobotics.CANSparkFlex; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.revrobotics.SparkLimitSwitch; import frc.robot.constants.ConversionConstants; import frc.robot.constants.ScoringConstants; public class ShooterIOTalonFX implements ShooterIO { - private final TalonFX kicker = new TalonFX(ScoringConstants.kickerMotorId); + private final CANSparkFlex kicker = + new CANSparkFlex(ScoringConstants.kickerMotorId, MotorType.kBrushless); private final TalonFX shooterLeft = new TalonFX(ScoringConstants.shooterLeftMotorId); private final TalonFX shooterRight = new TalonFX(ScoringConstants.shooterRightMotorId); private final Slot0Configs slot0 = new Slot0Configs(); - /// DigitalInput bannerSensor = new DigitalInput(SensorConstants.indexerSensorPort); - private boolean override = false; private double overrideVolts = 0.0; @@ -48,12 +50,6 @@ public ShooterIOTalonFX() { .withStatorCurrentLimit(ScoringConstants.shooterCurrentLimit) .withStatorCurrentLimitEnable(true)); - TalonFXConfigurator kickerConfig = kicker.getConfigurator(); - kickerConfig.apply( - new CurrentLimitsConfigs() - .withStatorCurrentLimit(ScoringConstants.kickerCurrentLimit) - .withStatorCurrentLimitEnable(true)); - slot0.withKP(ScoringConstants.shooterkP); slot0.withKI(ScoringConstants.shooterkI); slot0.withKD(ScoringConstants.shooterkD); @@ -124,10 +120,11 @@ public void updateInputs(ShooterInputs inputs) { inputs.shooterRightStatorCurrentAmps = shooterRight.getStatorCurrent().getValueAsDouble(); inputs.shooterRightSupplyCurrentAmps = shooterRight.getSupplyCurrent().getValueAsDouble(); - inputs.kickerAppliedVolts = kicker.getMotorVoltage().getValueAsDouble(); - inputs.kickerStatorCurrentAmps = kicker.getStatorCurrent().getValueAsDouble(); + inputs.kickerAppliedVolts = kicker.getBusVoltage(); + inputs.kickerStatorCurrentAmps = kicker.getOutputCurrent(); - inputs.bannerSensor = true; // !bannerSensor.get(); + inputs.bannerSensor = + kicker.getForwardLimitSwitch(SparkLimitSwitch.Type.kNormallyOpen).isPressed(); } @Override