Shooter Subsystem

This commit is contained in:
TheRealGrayden 2026-03-07 13:38:19 -05:00
parent 176171f361
commit 4105d15a53
2 changed files with 13 additions and 12 deletions

View File

@ -7,6 +7,7 @@ package frc.robot;
import edu.wpi.first.math.util.Units; import edu.wpi.first.math.util.Units;
import edu.wpi.first.units.Unit; import edu.wpi.first.units.Unit;
import edu.wpi.first.units.measure.Angle; import edu.wpi.first.units.measure.Angle;
import java.security.PublicKey;
/** /**
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean
@ -82,4 +83,9 @@ public final class Constants {
public static final Angle LIMIT_ELEVATION_POS = edu.wpi.first.units.Units.Degrees.of(90); public static final Angle LIMIT_ELEVATION_POS = edu.wpi.first.units.Units.Degrees.of(90);
public static final Angle LIMIT_ELEVATION_NEG = edu.wpi.first.units.Units.Degrees.of(0); public static final Angle LIMIT_ELEVATION_NEG = edu.wpi.first.units.Units.Degrees.of(0);
} }
public static class HopperConstants {
public static final int KICKER_MOTOR_ID = 0;
public static final int SPINDEXER_MOTOR_ID = 1;
}
} }

View File

@ -10,7 +10,7 @@ import org.fairportrobotics.frc.posty.test.PostTest;
import com.ctre.phoenix6.hardware.TalonFX; import com.ctre.phoenix6.hardware.TalonFX;
import static org.fairportrobotics.frc.posty.assertions.Assertions.*; import static org.fairportrobotics.frc.posty.assertions.Assertions.*;
import frc.robot.Constants;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
public class HopperSubsystem extends TestableSubsystem { public class HopperSubsystem extends TestableSubsystem {
@ -19,28 +19,23 @@ public class HopperSubsystem extends TestableSubsystem {
private TalonFX kickerMotor; private TalonFX kickerMotor;
/** Creates a new HopperSubsystem. */ /** Creates a new HopperSubsystem. */
public HopperSubsystem() { public HopperSubsystem() {
spindexerMotor = new TalonFX(0); spindexerMotor = new TalonFX(Constants.HopperConstants.SPINDEXER_MOTOR_ID);
kickerMotor = new TalonFX(1); kickerMotor = new TalonFX(Constants.HopperConstants.KICKER_MOTOR_ID);
} }
public void feed(){ public void feed() {
kickerMotor.set(0.5); kickerMotor.set(0.5);
} }
public void reverse(){ public void reverse() {
kickerMotor.set(-0.5); kickerMotor.set(-0.5);
} }
public void stop(){ public void stop() {
kickerMotor.set(0); kickerMotor.set(0);
} }
public void spin(double speed){ public void spin(double speed) {
spindexerMotor.set(speed); spindexerMotor.set(speed);
} }