This commit is contained in:
TheRealGreydon 2026-10-15 20:26:36 -04:00
parent fc06699ea8
commit 97b26ce8f6
5 changed files with 8 additions and 33 deletions

View File

@ -163,7 +163,7 @@ public final class Constants {
public static final double SCORING_DISTANCE_MAX_ALLOWED_METERS = 7.0; // The maximum distance from the hub we'll allow the robot to shoot from public static final double SCORING_DISTANCE_MAX_ALLOWED_METERS = 7.0; // The maximum distance from the hub we'll allow the robot to shoot from
// This is the distance increment in inches for adjusting hood angle according to distance from the target, in inches per degree: // This is the distance increment in inches for adjusting hood angle according to distance from the target, in inches per degree:
public static final double HOOD_ANGLE_CALC_DIVISION = (SCORING_DISTANCE_LONG_IN - SCORING_DISTANCE_SHORT_IN) / (HOOD_ANGLE_SCORING_MAX_DEG - HOOD_ANGLE_SCORING_MIN_DEG); public static final double HOOD_ANGLE_CALC_DIVISION = (SCORING_DISTANCE_LONG_IN - SCORING_DISTANCE_SHORT_IN) / (HOOD_ANGLE_SCORING_MAX_DEG - HOOD_ANGLE_SCORING_MIN_DEG);
public static final double SHOOTER_EFFICIENCY_GENERAL = 0.31; // This is the baseline shooter efficiency assumption public static final double SHOOTER_EFFICIENCY_GENERAL = 0.325; // This is the baseline shooter efficiency assumption
public static final double SHOOTER_FLYWHEEL_DIAMETER_IN = 3.0; // Flywheel diameter is 3.0 inches public static final double SHOOTER_FLYWHEEL_DIAMETER_IN = 3.0; // Flywheel diameter is 3.0 inches
public static final double SHOOTER_FLYWHEEL_GEAR_RATIO = 2.0; // Flywheel moves at twice the RPM of the flywheel motor public static final double SHOOTER_FLYWHEEL_GEAR_RATIO = 2.0; // Flywheel moves at twice the RPM of the flywheel motor
public static final Angle TARGET_ELEVATION_DIF = edu.wpi.first.units.Units.Degrees.of(1); public static final Angle TARGET_ELEVATION_DIF = edu.wpi.first.units.Units.Degrees.of(1);

View File

@ -46,7 +46,6 @@ public class UltraShooterCommand extends Command{
@Override @Override
public void initialize() { public void initialize() {
//hopperSubsystem.spindexerOn(); // Activate spindexer so it's on while command is active
hopperSubsystem.stopKicker(); // Make sure kicker is off when command is called hopperSubsystem.stopKicker(); // Make sure kicker is off when command is called
CommandScheduler.getInstance().schedule(waitCommand); // Kick off a wait timer so robot doesn't shoot until hopper is ready CommandScheduler.getInstance().schedule(waitCommand); // Kick off a wait timer so robot doesn't shoot until hopper is ready
alliance = DriverStation.getAlliance().get(); // Fetch our alliance alliance = DriverStation.getAlliance().get(); // Fetch our alliance
@ -201,13 +200,6 @@ public class UltraShooterCommand extends Command{
hopperSubsystem.stopKicker(); hopperSubsystem.stopKicker();
} }
Logger.recordOutput("UltraShooter-OkToShoot", okToShoot); Logger.recordOutput("UltraShooter-OkToShoot", okToShoot);
// OPTIONAL: Activate rumble if it's not ok to shoot
if (!okToShoot) {
// ACTIVATE CONTROLLER RUMBLE
} else {
// DEACTIVATE CONTROLLER RUMBLE
}
} }
@Override @Override
@ -218,27 +210,12 @@ public class UltraShooterCommand extends Command{
@Override @Override
public void end(boolean interrupted) { public void end(boolean interrupted) {
waitCommand.cancel(); waitCommand.cancel();
//hopperSubsystem.spindexerOff();
hopperSubsystem.stopKicker(); hopperSubsystem.stopKicker();
turretSubsystem.setLauncher(0); turretSubsystem.setLauncher(0);
turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_STORED_ANGLE); turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_STORED_ANGLE);
Logger.recordOutput("UltraShooter-State", "INACTIVE"); Logger.recordOutput("UltraShooter-State", "INACTIVE");
// Removed the following since we're don't setting turret targets.
/*
DriverStation.getAlliance().ifPresent((alliance) -> {
if (alliance == Alliance.Blue) {
turretSubsystem.setTurretTargetPose(Constants.FieldPoses.BLUE_HUB_POSE);
} else {
turretSubsystem.setTurretTargetPose(Constants.FieldPoses.RED_HUB_POSE);
}
});
*/
// turretSubsystem.setTurretMotorRotation(-0.34); // Return to 0 after MIAMI VALLEY
// TODO: Deactivate rumble if we decided to use the rumble feature when the robot prevents shooting
} }
} }

View File

@ -78,11 +78,11 @@ public class HopperSubsystem extends TestableSubsystem {
} }
public void spindexerOn() { public void spindexerOn() {
spindexerMotor.set(0.75); spindexerMotor.set(0.6);
} }
public void spindexerReverse() { public void spindexerReverse() {
spindexerMotor.set(-0.75); spindexerMotor.set(-0.6);
} }
public void spindexerOff() { public void spindexerOff() {

View File

@ -70,7 +70,7 @@ public class IntakeSubsystem extends TestableSubsystem {
public Command intake(XboxController m_XboxController) { public Command intake(XboxController m_XboxController) {
return this.runOnce(() -> { return this.runOnce(() -> {
if (intakeMotor.get() == 0) { if (intakeMotor.get() == 0) {
setSpeed(-.5); setSpeed(-.45);
m_XboxController.setRumble(RumbleType.kBothRumble, .5); m_XboxController.setRumble(RumbleType.kBothRumble, .5);
} else { } else {
intakeMotor.stopMotor(); intakeMotor.stopMotor();
@ -80,7 +80,7 @@ public class IntakeSubsystem extends TestableSubsystem {
} }
public Command reverseIntake() { public Command reverseIntake() {
return this.runEnd(() -> setSpeed(.5), () -> { return this.runEnd(() -> setSpeed(.45), () -> {
intakeMotor.stopMotor(); intakeMotor.stopMotor();
}); });
} }

View File

@ -117,8 +117,8 @@ public class TurretSubsystem extends TestableSubsystem {
SparkMaxConfig config = new SparkMaxConfig().apply((SparkMaxConfig) SparkMaxConfig.Presets.REV_NEO); SparkMaxConfig config = new SparkMaxConfig().apply((SparkMaxConfig) SparkMaxConfig.Presets.REV_NEO);
config.inverted(Constants.ShooterConstants.LAUNCHER_MOTOR_INVERTED); config.inverted(Constants.ShooterConstants.LAUNCHER_MOTOR_INVERTED);
config.voltageCompensation(10); config.voltageCompensation(10);
config.closedLoop.p(0.0002).i(0.000001).d(0.0005); // I = 0.0000001 config.closedLoop.p(0.0002).i(0.000001).d(0.0009); // I = 0.0000001
config.closedLoop.feedForward.kS(0.2).kV(0.00005).kA(0.001); config.closedLoop.feedForward.kS(0.2).kV(0.00009).kA(0.0001);
// config.closedLoop.allowedClosedLoopError(10, ClosedLoopSlot.kSlot0); // config.closedLoop.allowedClosedLoopError(10, ClosedLoopSlot.kSlot0);
config.closedLoop.feedbackSensor(FeedbackSensor.kPrimaryEncoder); config.closedLoop.feedbackSensor(FeedbackSensor.kPrimaryEncoder);
config.closedLoop.positionWrappingEnabled(false); config.closedLoop.positionWrappingEnabled(false);
@ -217,9 +217,7 @@ public class TurretSubsystem extends TestableSubsystem {
public void homeTurret() public void homeTurret()
{ {
if(turretState != TurretState.INIT){ if(turretState != TurretState.INIT) {return;}
return;
}
turretMotor.set(Constants.ShooterConstants.HOMING_SPEED); turretMotor.set(Constants.ShooterConstants.HOMING_SPEED);
turretState = TurretState.HOMING; turretState = TurretState.HOMING;
} }